10 UART (UART)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
10-5
(Rev. 1.0)
UART data sending operations
The UART 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).
USOUT
n
UA
n
INTF.TBEIF
UA
n
INTF.TBSY
UA
n
INTF.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)
→
UA
n
TXD
Data (W)
→
UA
n
TXD
1 (W)
→
UA
n
INTF.TENDIF
Data (W)
→
UA
n
TXD
5.2.1 Example of Data Sending Operations
Figure 10.
Data transmission
End
Read the UA
n
INTF.TBEIF bit
Write transmit data to
the UA
n
TXD register
YES
NO
NO
YES
Transmit data remained?
UA
n
INTF.TBEIF = 1 ?
Wait for an interrupt request
(UA
n
INTF.TBEIF = 1)
5.2.2 Data Transmission Flowchart
Figure 10.
Data Reception
10.5.3
A data receiving procedure and the UART Ch.
n
operations are shown below. Figures 10.5.3.1 and 10.5.3.2 show a
timing chart and flowcharts, respectively.
Data receiving procedure (read by one byte)
1. Wait for a UART interrupt when using the interrupt.
2. Check to see if the UA
n
INTF.RB1FIF bit is set to 1 (receive buffer one byte full).
3. Read the received data from the UA
n
RXD register.
4. Repeat Steps 1 to 3 (or 2 and 3) until the end of data reception.