12 UART (UART3)
S1C17M20/M21/M22/M23/M24/M25
Seiko Epson Corporation
12-5
TECHNICAL MANUAL (Rev. 1.0)
12.5.2 Data Transmission
A data sending procedure and the UART3 Ch.
n
operations are shown below. Figures 12.5.2.1 and 12.5.2.2 show a
timing chart and a flowchart, respectively.
Data sending procedure
1. Check to see if the UA
n
INTF.TBEIF bit is set to 1 (transmit buffer empty).
2. Write transmit data to the UA
n
TXD register.
3. Wait for a UART3 interrupt when using the interrupt.
4. Repeat Steps 1 to 3 (or 1 and 2) until the end of transmit data.
UART3 data sending operations
The UART3 Ch.
n
starts data sending operations when transmit data is written to the UA
n
TXD register.
The transmit data in the UA
n
TXD register is automatically transferred to the shift register and the UA
n
INTF.
TBEIF bit is set to 1 (transmit buffer empty).
The USOUT
n
pin outputs a start bit and the UA
n
INTF.TBSY bit is set to 1 (transmit busy). The shift register
data bits are then output successively from the LSB. Following output of MSB, the parity bit (if parity is en-
abled) and the stop bit are output.
Even if transmit data is being output from the USOUT
n
pin, the next transmit data can be written to the
UA
n
TXD register after making sure the UA
n
INTF.TBEIF bit is set to 1.
If no transmit data remains in the UA
n
TXD register after the stop bit has been output from the USOUT
n
pin,
the UA
n
INTF.TBSY bit is cleared to 0 and the UA
n
INTF.TENDIF bit is set to 1 (transmission completed).
USOUTn
UAnINTF.TBEIF
UAnINTF.TBSY
UAnINTF.TENDIF
Software operations
st D0 D1 D2 D3 D4 D5 D6 D7 p sp st D0 D1
D7 p sp
st D0 D1
D7 p sp
(st: start bit, sp: stop bit, p: parity bit)
Data (W)
→
UAnTXD
Data (W)
→
UAnTXD
1 (W)
→
UAnINTF.TENDIF
Data (W)
→
UAnTXD
Figure 12.5.2.1 Example of Data Sending Operations
Data transmission
End
Read the UAnINTF.TBEIF bit
Write transmit data to
the UAnTXD register
YES
NO
NO
YES
Transmit data remained?
UAnINTF.TBEIF = 1 ?
Wait for an interrupt request
(UAnINTF.TBEIF = 1)
Figure 12.5.2.2 Data Transmission Flowchart