Introduction to Data Communications | ||
---|---|---|
Previous | 20c. Parity Bits (cont'd) | Next |
When a data with odd parity is received. The number of 1s in both the data and the parity bit are counted. If the number of 1s is an odd number than the data is good data, if it is an even number than the data is corrupted.
Data | Odd Parity Bit | |
0100 1010 |
|
3 x 1s in data and parity bit = Good data |
0111 1110 |
|
6 x 1s in data and parity bit = Bad data |
1010 1010 |
|
Is this good or bad data? |
Parity Agreement
Both receive and transmit stations must agree on the type of parity checking used before transmitting. Usually it is setup in the communications parameters setup. Most common transfer are: 8n1 (8 data bits, no parity, 1 stop bit) or 7e2 (7 data bits, even parity, 2 stop bits).
The parity bit is added in the asynchronous bit stream just before the stop bits and adds to the overhead for asynchronous transmission. A total of 12 bits must be transmitted in order to send 8 bits of data.
Problems with Parity Checking
There is a problem with parity checking. It only works reliably if there is only 1 bit error in the transmitted character stream. If there are 2 bit errors, the parity checking may not detect that there is an error. For example:
Data | Odd Parity Bit | ||
Transmitted | 0100 1010 |
|
3 x 1s in data and parity bit = Good data |
Received | 0110 1110 |
|
5 x 1s in data and parity bit = Good data? |
Parity checking would pass the received data as good data even though 2 bits are corrupted!
Introduction to Data Communications | ||
---|---|---|
Previous | Table of Contents | Next |