Chapter 13
Serial Interface 2
XIII - 16
Operation
■ Setting Data I/O Pin
Communication modes have 2 types: 3 channels (clock pin (SBT2 pin), data output pin (SBO2 pin) and data input
pin (SBI2 pin )) and 2 channels (clock pin SBT2 pin) and data I/O pin (SBO2 pin)). The SBO2 pin can be used
only for serial data input. The SBI2 pin can be used for serial data input and output. The SC2IOM flag of the
SC2CTR1 register can select whether serial data is fed from the SBI2 pin or SBO2 pin. When “data input from the
SBO2 pin” is selected, 2-channel communication is used. In this case, the P17D flag of the P1DIR register con-
trols the SBO2 pin direction and switches between transmission and reception. The SBI2 pin can be used as a gen-
eral-purpose port because it not used at this time, .
..
Maximum transfer speed should be under 5.0 MHz. If transfer clock exceeds 5.0 MHz, data
may not be transferred properly.
..
In reception, the SBI2 pin can be used as a general-purpose port when the SC2IOM of the
SC2CTR1 register is set to “1” and “serial data input from the SBO2 pin” is selected.
..
■ Reception Buffer Empty Flag Operation
After reception is completed, (communication complete interrupt SC2TIRQ), data is automatically stored from
the internal shift register into SC2RB. If data is stored in the shift register SC2RB while the SC2SBIS flag of the
SC2CTR1 register is set to “serial input” , the reception buffer empty flag SC2REMP of the SC2STR register is
set to “1”. This indicates that reception data is ready to be read out. SC2REMP is cleared to “0” when data is read
from SC2RB.
■ Transmission Buffer Empty Flag Operation
If data is set in SC2TB during communication (till the communication complete interrupt SC2TIRQ is generated
after data is load into the internal shift register), the transmission buffer empty flag SC2TEMP of the SC2TB reg-
ister is set to “1”. This indicates that the next transmission data is ready to be loaded. When data is loaded into the
internal shift register from SC2TB after SC2TIRQ is generated and when SC2TEMP is cleared to “0”, the next
transfer is automatically started.
■ Reception BUSY Flag Operation
The BUSY flag SC2RBSY of the SC2STR register is set to “1” when data is set in SC2TB or when a start condi-
tion is recognized while “serial data input” is selected with the SC2SBIS flag of the SC2CTR1 register. The
BUSY flag is cleared to “0” after generation of the communication end interrupt SC2TIRQ. The SC2RBSY flag
setting is maintained during continuous communication. If the transmission buffer empty flag SC2TEMP is
cleared to “0” when the communication complete interrupt SC2TIRQ is generated, SC2RBSY is cleared to “0”.
The SC2RBSY flag is reset to “0” when the SC2SBIS flag is set to “0” during communication.
■ Transmission BUSY Flag Operation
The SC2TBSY flag of the SC2STR register is set if the SC2SBOS flag of the SC2CTR1 register is set to “1”
when data is set in SC2TB or a when a start condition is recognized while “serial data output” is selected with the
SC2SBOS flag of the SC2CTR1 register. The SC2TBSY flag is cleared to “0” after generation of the communica-
tion end interrupt SC2TIRQ. The SC2TBSY flag setting is maintained during continuous communication. If
transmission buffer empty flag SC2TEMP is set to”0” when the communication complete interrupt SC2TIRQ is
generated, SC2RBSY is cleared to “0”. The SC2TBSY flag is reset to “0” when the SC2SBOS flag is cleared to
“0” during communication.