Error Control

Parity Check

A simple error detection method based on counting the number of ones.

A Basic Error Detection Method

Parity checking detects transmission errors by constraining the total number of '1's in each data block. It does not correct errors. It gives the receiver a basic way to determine whether a data block was corrupted during transmission. The core idea is to add one extra bit, the parity bit, to each block of data.

This method adds only a small amount of to achieve a basic level of integrity checking.

How Parity Check Works

The sender and receiver must first agree on which type of parity to use. There are two options: even parity or odd parity.

Even Parity

The goal is to ensure that the total number of '1's in the data block (including the parity bit) is an even number.

  • If the original data has an odd number of '1's, the parity bit is set to 1.
  • If the original data has an even number of '1's, the parity bit is set to 0.

Odd Parity

The goal is to ensure that the total number of '1's in the data block (including the parity bit) is an odd number.

  • If the original data has an odd number of '1's, the parity bit is set to 0.
  • If the original data has an even number of '1's, the parity bit is set to 1.

Even Parity Example

  1. Sender's side: Consider the 7-bit ASCII code for the letter 'K', which is 10010111001011.
    • Count the '1's in 10010111001011: There are four '1's.
    • Since four is an even number, the sender sets the parity bit to 0.
    • The transmitted 8-bit block is 10010111001011 followed by 00.
  2. Receiver's side: The receiver gets the 8-bit block 1001011010010110.
    • It counts the total number of '1's: There are four '1's.
    • Since four is an even number, it matches the agreed-upon even parity. The parity check accepts the block as valid.

Limits of a Parity Check

A single parity check cannot detect an even number of bit errors. The following example uses data 10010111001011, an even parity bit 00, and the transmitted block 1001011010010110.

One-Bit Error

During transmission, a single bit flips. The receiver gets 1001111010011110.

  • The receiver counts the '1's: there are now five.
  • Five is an odd number. This does not match the agreed-upon even parity.
  • Result: The parity check detects the error. The receiver can mark the data as corrupt and request a retransmission.

Two-Bit Error

During transmission, bits at positions 4 and 5 flip. The receiver gets 1000111010001110.

  • The receiver counts the '1's: there are now four.
  • Four is an even number. This matches the agreed-upon even parity.
  • Result: No error is detected, even though the data is wrong. The receiver accepts the corrupted data as valid.

With one parity bit, the parity check detects any odd number of errors (1, 3, 5, etc.). It does not detect an even number of errors (2, 4, 6, etc.).

Related articles