2.5UART
103
As shown in Figure 2.5.3 "Transfer Data Format," transfer data always begins with a start bit ('L' level
data value), then the transfer data at the bit-length designated on LSB-first basis, and ends with a stop
bit ('H' level data value). When an external clock signal is selected, the clock should be input at all
times. When an internal clock signal (from the dedicated baud rate generator or internal timer) is
selected, the clock signal will be output at all times. In CLK synchronous transfer operation, transfer
should not begin until the clock has stabilized at the selected baud rate (for two signal periods).
In CLK asynchronous transfer, the SCK0 bit in the UMC register should be set to "0" so that no clock
signal is output. The SID0 and SOD0 data transfer formats are the same as shown in Figure 2.5.3
"Transfer Data Format."
(4) Parity Bit
When parity is enabled, the P bit in the URD register can be used to designate either even parity or odd
parity. Parity is enabled using the PEN bit in the UMC register.
Figure 2.5.4 shows a parity error generated when incoming data at SID0 is received with even parity is
designated. Also shown in Figure 2.5.4 is transmission of an outgoing data value of 001101B with odd/
even parity designated.
Fig. 2.5.4 Serial Data with Parity Enabled
(5) Interrupt Generation and Flag Set Timing
The UART has 6 flags and 2 interrupt sources. The 6 flags are identified by the names RDRF/ORFE/
PE/TDRE/RBF/TBF.
The RDRF flag is set when receiving data is loaded into the UIDR register, and is cleared when data is
read out from the UIDR register, or when "0" is written to the RFC bit in the UMC register. The ORFE
flag is the overrun/framing error flag , and is set when an overrun or framing error occurs during receiv-
ing and cleared when "0" is written to the RFC bit in the UMC register. The PE flag indicates a parity
error, and is set when a parity error occurs during receiving, and is cleared by writing "0" to the RFC bit
in the UMC register. Note that there is no parity detection function in mode 2. The TDRE flag is set
when the UODR register is empty and ready for write, and cleared when transmission data is written to
the UODR register.
The above 4 flags (RDRF/ORFE/PE/TDRE) function as interrupt factor flags for data transmission and
receiving.
010110
001
Start LSB
MSB
Stop
(Parity)
010110
011
Start LSB
MSB
Stop
(Parity)
0101100
01
Start LSB
MSB
Stop
(Parity)
SID0
SOD0
(Receiving parity error generated, P=0)
(Transmission with even parity, P=0)
(Transmission with odd parity, P=1)