Last modified on 1 June 2013, at 10:56

Fundamentals of Data Representation: Parity bits

UNIT 1 - ⇑ Fundamentals of Data Representation ⇑

← Error checking and correction Parity bits Hamming code →

Sometime when you see ASCII code it only appears to have 7 bits. Surely they should be using a byte to represent a character, after all that would mean they could represent more characters than the measily 128 they can currently store (Note there is extended ASCII that uses the 8th bit as well but we don't need to cover that here). The eigth bit is used as a parity bit to detect that the data you have been sent is correct. It will not be able to tell you which digit is wrong, so it isn't corrective.

There are two types of parity odd and even. If you think back to primary school you would have learnt about odd and even numbers, hold that thought, we are going to need it.

  • Odd numbers : 1,3,5,7,9
  • Even numbers : 0,2,4,6,8 (note 0 is here too)
Example: How to detect errors using parity bits

When we send binary data we need to count the number of 1s that are present in it. For example sending the ASCII character 'B' 1000010. This has two occurrences of 1. We can then apply another bit to the front of it and send it across the internet.

  • If we are using even parity 01000010
  • If we are using odd parity 11000010

Now when the data gets to the other end and we were using even parity

  • 01001010 - odd parity, there has been an error in transmission, ask for data to be sent again
  • 01000010 - even parity, the data has been sent correctly
Exercise: Test your knowledge of parity bits

Try and apply the correct parity bit to the following:

_1011010 (even parity)

Answer :

01011010

_1011010 (odd parity)

Answer :

11011010

_1111110 (even parity)

Answer :

01111110

_0000000 (odd parity)

Answer :

10000000

However, if we receive 10010110, knowing that the number had odd parity, where is the error? The best we can do is ask for the data to be resent and hope it's correct next time. Parity bits only provide detective error. We need something that detects and corrects..