
Rev. 2.0, 09/02, page 385 of 732
13.4.4
SCI initialization (Asynchronous mode)
Before transmitting and receiving data, you should first clear the TE and RE bits in SCR to 0, then
initialize the SCI as described below. When the operating mode, transfer format, etc., is changed,
the TE and RE bits must be cleared to 0 before making the change using the following procedure.
When the TE bit is cleared to 0, the TDRE flag is set to 1. Note that clearing the RE bit to 0 does
not initialize the contents of the RDRF, PER, FER, and ORER flags, or the contents of RDR.
When the external clock is used in asynchronous mode, the clock must be supplied even during
initialization.
[1]
Start Initialization
Clear RIE, TIE, TEIE, MPIE, TE
and RE bits in SCR to 0
*
[2]
Yes
No
Set value in BRR
[3]
[4]
[5]
[6]
1-bit interval elapsed
< Initialization completion>
Note :
*
In simultaneous transmit/receive operation, the TE and RE bits must be cleared to 0 or set to 1
simultaneously.
[1] Set the clock selection in SCR.
[2] Set the data transfer format in SMR
and SDCR.
[3] Write a value corresponding to the
bit rate to BRR. Not necessary if an
external colck is used.
[4] Set the RIE, TIE, TEIE, and MPIE
bits in SCR.
[5] The PFC bits corresponding to the
external circuit to be used are
specified, so that the pin is RxD
input at data receive, and TxD
output at data transmission. In
addition, set the input/output to the
SCK according to the setting of
CKE1 and CKE0.
Not necessary to set the SCK pin
setting if CKE1 and CKE0 is set to
00 and asynchronous mode.
If the SCK pin setting is
synchronous clock output mode at
this time, then a clock starts being
output from the SCK pin.
[6] The TE and RE bits of SCR are set
to 1
*
. By doing this, the TxD, RxD,
and SCK pins can be used. When
transmitting, the TxD pin enters the
mark condition. When reception,
the RxD pin enters the idle state
wating for the start bit.
Set data transfer format in SMR
Set RIE, TIE, TEIE, and MPIE bits.
Set TE and RE bits in SCR to 1.
Set PFC for the pins to be used
(SCK, TXD, RXD)
Set CKE1 and CKE0 bits in SCR
(TE, RE bits are 0)
Figure 13.5 Sample SCI Initialization Flowchart