One of the simplest forms of automatic error detection
Frequently used with ASCII code
7 bits + 1 redundant (parity) bit = 8-bit data word
Two common types of parity:
even: every 8-bit data word in a message contains an even number of 1's
odd: every word has an odd number of 1's
| ASCII Character (7-bit) | Data Word (8-bit), Even parity | Data Word (8-bit), Odd parity |
|---|---|---|
| 110 0001 a (61H) |
three ones, set the parity bit 1110 0001 |
three ones, already at odd parity 0110 0001 |
| 111 0010 u (75H) |
four ones, already at even parity 0111 0010 |
four ones, set the parity bit 1111 0010 |
| 110 0101 e (65H) |
four ones, already at even parity 0110 0101 |
four ones, set the parity bit 1110 0101 |
The receiver checks the parity of each incoming ASCII character to see if it is correct.
If the receiver is programmed to receive odd parity, every incoming data word must have odd parity.
If the receiver is programmed for even parity, every data word must have even parity.
When incorrect parity is received, it is called a parity error.
Since the parity bit is added to the ASCII character by the sending terminal, it is either set (1) or cleared (0) to form the correct parity.
A parity error is generated when an odd number of bits is changed, but no parity error is generated when an even number of bits is changed!
For example, two bits are changed by noise:
Like all methods of error detection, parity adds redundant information to the data stream.
A disadvantage of parity is that it only detects errors that affect an odd number of bits in a data word.
An advantage of parity is that it is simple to implement, so it is widely used.
Back to Error Detection and Correction