Parity Bit - Error Detection

Error Detection

If an odd number of bits (including the parity bit) are transmitted incorrectly, the parity bit will be incorrect and thus indicates that a parity error occurred in transmission. The parity bit is only suitable for detecting errors; it cannot correct any errors, as there is no way to determine which particular bit is corrupted. The data must be discarded entirely, and re-transmitted from scratch. On a noisy transmission medium, successful transmission can therefore take a long time, or even never occur. However, parity has the advantage that it uses only a single bit and requires only a number of XOR gates to generate. See Hamming code for an example of an error-correcting code.

Parity bit checking is used occasionally for transmitting ASCII characters, which have 7 bits, leaving the 8th bit as a parity bit.

For example, the parity bit can be computed as follows, assuming we are sending a simple 4-bit value 1001 with the parity bit following on the right, and with ^ denoting an XOR gate:

Transmission sent using even parity:

A wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 0 A adds parity bit and sends: 10010 B receives: 10010 B computes parity: 1^0^0^1^0 = 0 B reports correct transmission after observing expected even result.

Same transmission sent using odd parity:

A wants to transmit: 1001 A computes parity bit value: ~(1^0^0^1) = 1 A adds parity bit and sends: 10011 B receives: 10011 B computes overall parity: 1^0^0^1^1 = 1 B reports correct transmission after observing expected odd result.

This mechanism enables the detection of single bit errors, because if one bit gets flipped due to line noise, there will be an incorrect number of ones in the received data. In the two examples above, B's calculated parity value matches the parity bit in its received value, indicating there are no single bit errors. Consider the following example with a transmission error in the second bit:

Transmission sent using even parity:

A wants to transmit: 1001 A computes parity bit value: 1^0^0^1 = 0 A adds parity bit and sends: 10010 *** TRANSMISSION ERROR *** B receives: 11010 B computes overall parity: 1^1^0^1^0 = 1 B reports incorrect transmission after observing unexpected odd result.

B calculates an odd overall parity indicating the bit error. Here's the same example but now the parity bit itself gets corrupted:

A wants to transmit: 1001 A computes even parity value: 1^0^0^1 = 0 A sends: 10010 *** TRANSMISSION ERROR *** B receives: 10011 B computes overall parity: 1^0^0^1^1 = 1 B reports incorrect transmission after observing unexpected odd result.

Once again, B computes an odd overall parity, indicating the bit error.

There is a limitation to parity schemes. A parity bit is only guaranteed to detect an odd number of bit errors. If an even number of bits have errors, the parity bit records the correct number of ones, even though the data is corrupt. (See also error detection and correction.) Consider the same example as before with an even number of corrupted bits:

A wants to transmit: 1001 A computes even parity value: 1^0^0^1 = 0 A sends: 10010 *** TRANSMISSION ERROR *** B receives: 11011 B computes overall parity: 1^1^0^1^1 = 0 B reports correct transmission though actually incorrect.

B observes even parity, as expected, thereby failing to catch the two bit errors.

Read more about this topic:  Parity Bit

Famous quotes containing the word error:

    It is an old error of man to forget to put quotation marks where he borrows from a woman’s brain!
    Anna Garlin Spencer (1851–1931)