When the clock source is an external clock (SBT0 pin input):

Set the SC0SBTM flag of the SC0MD3 register.

Set bit 2 of the P0DIR register to input mode.

Set the P0PLU register, if necessary.

(7)Select the SC0SBOM flag of the SC0MD3 register.

(8)Select the SC0IOM flag of the SC0MD3 register.

(9)Select serial communication by setting the SC0SBOS flag of the SC0MD3 register to "1."

(10)Set transmit data to serial interface 0 transmit/receive shift register (SC0TRB). This will start the serial transmission.

(11)When serial transmission begins, the SC0BSY flag of the SC0CTR register is set to "1," indicating that a serial transfer is in progress.

(12)When the serial transmission has completed, the SC0BSY flag of the SC0CTR register is cleared to "0" and the SC0 transfer complete interrupt request flag is set to "1." The SC0TRI flag of SC0MD1 register 1 is cleared to "0."

After the transfer is complete, the transfer bit count in the SC0LNG2 to 0 flags of the SC0MD0 register will be changed. Except in an 8-bit transfer, reset the transfer bit count at the time of the next transmission.

When switching from transmission to reception, set the SC0SBOS flag of the SC0MD3 register to "0" and then set the SC0SBIS flag to "1." Do not change both of these flags at the same time.

The SC0SBTS flag of the SC0MD3 register must be set to "1" before the SC0SBOS flag of the SC0MD3 register is set to "1."

Chapter 5 Serial Functions

When the serial port is enabled and the SC0CE1 to 0 flags of the SC0MD0 register are changed, the transfer bit count in the SC0LNG2 to 0 flags of the SC0MD0 register may be incremented.

Enabling the start condition drives the SBO0 pin high for a fixed time interval (1/2 the clock source cycle) after the transmission is completed. If the start condition is disabled, the SBO0 pin will remain at the value of the of the last data bit.

If the SC0IOM flag of the SC0MD3 register is set for a pin connection, the SBI0 pin can be used as a port. The SBO0 pin receives data during the input mode and transmits data during the output mode.

The SC0LNG2 to 0 flags change at the opposite edge of the transmit data output edge.

Serial interface 0 begins operation when the SC0SBOS flag or the SC0SBIS flag is set to "1." Set the SC0SBOS flag or the SC0SBIS flag after all conditions have been set.

Synchronous Serial Interface

95

Page 109
Image 109
Panasonic MN101C00 user manual Serial Functions