2.5 UART
125
TIE
: 0
c) Start of Communication
Communication starts by writing to the SODR register. Note that even if no data is to be sent, it is
first necessary to write dummy data to the SORD register.
d) End of Communication
The end of communication can be verified by the change of the RDRF flag in the SSR register to
‘1.’ To determine whether the communication was performed normally, read the ORE bit in the SSR
register.
(5) Interrupt Generation and Flag Set Timing
The UART has five flags and two interrupt sources.
The five flags are the PE, ORE, FRE, RDRF and TDRE flags. The first three are set when receiving
errors occur: the PE flag indicates a parity error, the ORE flag indicates an overrun error, and the FRE
flag indicates a framing error. The RDRF flag is set when receiving data is loaded into the SORD
register, and cleared when the data is read out of the SODR register. Note,however,that there is no
parity detect function in mode 1, and no parity detect function or framing error detect function in mode
2. The TDRE flag is set when the SODR register is empty and ready for data write access, and is
cleared when data is written to the SODR register.
The two interrupt sources are for receiving and sending respectively. During receiving, interrupt
requests are initiated by the PE, ORE, FRE or RDRF flags. During sending, interrupt requests are
initiated by the TDRE flag. The following sections describe interrupt flag set timing in each operating
mode.
a) Mode 0 Receiving
The PE, ORE, FRE and RDRF flags are set and the interrupt request signal is sent to the CPU after
the end of a receiving transfer, when the final stop bit is detected. If any one of the PE, ORE or FRE
flags is active, the data in the SIDR register will be invalid.
Fig. 2.5.4 ORE, FRE, RDRF Flag Set Timing (Mode 0)
b) Mode 1 Receiving
The ORE, FRE and RDRF flags are set and the interrupt request signal is sent to the CPU after the
end of a receiving transfer, when the final stop bit is detected. Also, if the receiving data length is 8
bits, the 9th bit indicating address/data will be invalid. If either the ORE or FRE flags is active, the
data in the SIDR register will be invalid.
D6
D7
Stop
Data
Receiving interrupt
PE,ORE,FRE
RDRF