Character Length

Character length is controlled by the MODE bits of UART Control Register 0 (UxCON0):

In Parity modes, the first eight bits of each byte are the data bits, and the ninth bit is the parity bit. Parity bits are used in error detection. Even Parity means that the expected number of ‘1’ bits in a character is an even number, while Odd Parity means that the expected number of ‘1’ bits in a character is an odd number. When in Even Parity mode, the parity bit will be set if the number of ‘1’ bits in the 8-bit transmit data is an odd number; when the number of ‘1’ bits are even, the parity bit is cleared. In Odd Parity mode, when the number of ‘1’ bits in the 8-bit transmit data is odd, the parity bit is cleared; when the number of bits are even, the parity bit is set. Table 1 gives examples of how the parity bit value is determined.

Table 1. Even/Odd Parity Examples
Byte Value Even Parity Bit Value Odd Parity Bit Value
1010 1010 0 1
1010 1000 1 0

In Asynchronous 9-bit UART Address mode, each byte transmitted or received consists of nine bits, and the 9th bit determines whether the byte is an address or data. When the 9th bit is set, the other eight bytes are used as an address; when the 9th bit is clear, the other eight bytes are used as data (see Address Mode for more details).