Thursday, 10 November 2016

Parity bit

  • A parity bit or check bit is a bit added to a string of binary code that indicates whether the number of 1-bits in the string is even or odd.
  • Parity bit are used as the simplest form of error detecting code to find error that may occur during data transmission.
  • Parity bits are generally applied to the smallest units of a communication protocol, typically 8-bit octets (bytes), although they can also be applied separately to an entire message string of bits.



Even parity


  • In case of even parity for a given set of bits, the occurrences of bits whose value is 1 is counted.
  • If the count is odd the parity bit set to 1, making the total count of occurrences of 1's in the whole set an even number.
  • If the count of 1's in a given set of bits is already even the parity bit's value is 0.
  • Even parity is a special case of a cyclic redundancy check (CRC), where the 1-bit CRC is generated by the polynomial x+1.



Odd parity


  • In the case of odd parity, the coding is reversed.
  • For a given set of bits, if the count of bits with a value of 1 is even, the parity bit value is set to 1 making the total count of 1's in the whole set an odd number.
  • If the count of bits with a value of 1 is odd, the count is already odd so the parity bit's value is 0.


Error detection

  • If a odd number of bits(including parity bit) are transmitted incorrectly, the parity bit will be incorrect, thus indicating that a parity error occurred in transmission.
  • Parity bit cannot correct any errors, the data must be discarded entirely and re-transmitted.
  • 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 simple 4-bit values 1001:


  • In 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.

Following example with a transmission error in the second bit using XOR:

  • 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.

My notes



No comments: