parity bit in uart communication

Papabravo

Joined Feb 24, 2006
21,159
The parity bit was used, once upon a time, for error detection. It would set set or cleared by the transmitter to make the number of data bits equal to '1', either an odd number or an even number. The receiver could check the number of '1's in the received character to see if it matched the expectation, either odd or even. It is rarely used nowadays.
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
Now something called CRC is used "Cycle Redundancy Check"
It is a check sum using two bytes, It is based on binary division and is also called polynomial code checksum.
(See MODBUS)
Max.
 

Papabravo

Joined Feb 24, 2006
21,159
Now something called CRC is used "Cycle Redundancy Check"
It is a check sum using two bytes, It is based on binary division and is also called polynomial code checksum.
(See MODBUS)
Max.
Longer CRCs can also be used for error correction. They do this on disk and solid state drives.
 

MrChips

Joined Oct 2, 2009
30,712
You can enable or not enable parity bit generation and still use parity for error checking.

If you do not enable parity generation and checking, the general practice is to send 7-bit ASCII and add parity bit via SW as the eight bit. The receiver has to use SW in order to detect errors or the receiver may choose to ignore the parity bit. (Or you can set the receiver to receiver 7 bits plus parity and have HW check for parity error.)

If you enable parity generation and checking and you select 8-bit data, then a parity bit is automatically added by HW as the ninth bit. The receiver HW will automatically check for parity errors if it's parity checking is enabled.

Edit: Parity checking is still used for error checking in communications.
Simple parity bit can detect single bit errors but cannot repair the error.
Simple parity bit cannot detect two bits in error.
 
Top