10 UART (UART)
10-6
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
Data receiving procedure (read by two bytes)
1. Wait for a UART interrupt when using the interrupt.
2. Check to see if the UA
n
INTF.RB2FIF bit is set to 1 (receive buffer two bytes full).
3. Read the received data from the UA
n
RXD register twice.
4. Repeat Steps 1 to 3 (or 2 and 3) until the end of data reception.
UART data receiving operations
The UART Ch.
n
starts data receiving operations when a start bit is input to the USIN
n
pin.
After the receive circuit has detected a low level as a start bit, it starts sampling the following data bits and
loads the received data into the receive shift register. The UA
n
INTF.RBSY bit is set to 1 when the start bit is
detected.
The UA
n
INTF.RBSY bit is cleared to 0 and the receive shift register data is transferred to the receive data buf-
fer at the stop bit receive timing.
The receive data buffer consists of a 2-byte FIFO and receives data until it becomes full. When the receive data
buffer receives the first data, it sets the UA
n
INTF.RB1FIF bit to 1 (receive buffer one byte full). If the second
data is received without reading the first data, the UA
n
INTF.RB2FIF bit is set to 1 (receive buffer two bytes
full).
USIN
n
UA
n
INTF.RB1FIF
UA
n
INTF.RB2FIF
UA
n
INTF.RBSY
Software operations
st D0
···
p sp st D0
···
p sp st D0
···
p sp st D0
···
p sp
(st: start bit, sp: stop bit, p: parity bit)
data 1
data 2
data 3
data 4
UA
n
RXD
→
data 1 (R)
UA
n
RXD
→
data 3 (R)
UA
n
RXD
→
data 2 (R)
5.3.1 Example of Data Receiving Operations
Figure 10.
Data reception (1 byte read)
End
Wait for an interrupt request
(UA
n
INTF.RB1FIF = 1)
Read receive data (1 byte) from
the UA
n
RXD register
NO
YES
Receive data remained?
Data reception (2 bytes read)
End
Wait for an interrupt request
(UA
n
INTF.RB2FIF = 1)
Read receive data (1 byte) from
the UA
n
RXD register
Read receive data (1 byte) from
the UA
n
RXD register
NO
YES
Receive data remained?
5.3.2 Data Reception Flowcharts
Figure 10.
IrDA Interface
10.5.4
This UART includes an RZI modulator/demodulator circuit enabling implementation of IrDA 1.0-compatible infra-
red communication function simply by adding simple external circuits.
Set the UA
n
MOD.IRMD bit to 1 to use the IrDA interface.
Data transfer control is identical to that for normal interface even if the IrDA interface function is enabled.