1.2 Character Length

Character length is controlled by the MODE bits of UART Control Register 0 (UxCON0):
  • In Asynchronous 7-bit UART mode, only the seven Least Significant bits (LSbs) of the transmit/receive byte are used, while the Most Significant bit (MSb) is ignored.
  • In Asynchronous 8-bit UART mode, all eight bits of the transmitted or received byte are used.
  • In Asynchronous 8-bit UART mode with 9th bit odd/even Parity modes, each byte transmitted or received consists of nine bits.

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-1 gives examples of how the parity bit value is determined.

Table 1-1. Even/Odd Parity Examples
Byte ValueEven Parity Bit ValueOdd Parity Bit Value
1010 101001
1010 100010

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).