ATmega32(L)
The USART Character SiZe (UCSZ2:0) bits select the number of data bits in the frame.
The USART Parity mode (UPM1:0) bits enable and set the type of parity bit. The selec-
tion between one or two stop bits is done by the USART Stop Bit Select (USBS) bit. The
receiver ignores the second stop bit. An FE (Frame Error) will therefore only be detected
in the cases where the first stop bit is zero.
Parity Bit Calculation
The parity bit is calculated by doing an exclusive-or of all the data bits. If odd parity is
used, the result of the exclusive or is inverted. The relation between the parity bit and
data bits is as follows::
P
P
= d
= d
⊕ … ⊕ d ⊕ d ⊕ d ⊕ d ⊕ 0
⊕ … ⊕ d ⊕ d ⊕ d ⊕ d ⊕ 1
3 2 1 0
even
n – 1
n – 1
3 2 1 0
odd
Peven Parity bit using even parity
Podd
dn
Parity bit using odd parity
Data bit n of the character
If used, the parity bit is located between the last data bit and first stop bit of a serial
frame.
145
2503J–AVR–10/06