Understanding the UART/USART Parity Bit

The parity bit in the data frame of the UART or USART communication tells the receiving device if there is any error in the data bits. The parity mode can be set for even parity or odd parity. The transmitting device sets the parity bit. If the parity is set for even, the transmitting device will put a 0 in the parity bit if there is an even number of 1's in the data bits. This makes the number of 1's including the parity bit even. If the data bits have an odd number of 1's in the data bits, then the transmitting device will put a 1 in the parity bit to make the number of 1's including the parity bit to an even number. The receiving device will determine if the data bits have an error. If the parity mode is set for even, then there must be an even number of 1's including the parity bit. If not, then the receiving device should reject that data frame and request another to be sent. This is the same for odd parity. The number of 1's in the data bit must have an odd number of 1's including the parity bit.



Back to blog

Leave a comment

Please note, comments need to be approved before they are published.