Funding for 'IT Lab' Project, Phase 1: Progress of sticker sales. Purchase a sticker to help us reach our target.Updated: 2010-02-28 11:53
10.7%
What is a parity?


by Donald Gaminitillake


One of the main advantages of digital computers over analogue devices is that the errors and inaccuracies that occur in all electrical circuits do not accumulate as a signal is passed through many circuits. However, when data is transmitted over any distance, the background electrical ‘noise’ in the line can sometimes be enough to flip a single digit from zero (0) to one (1) or vice verse. Normally the receiving computer would have no way of knowing that this had happened, and would accept the erroneous data as being correct. 

Look what happens if one bit in ASCII code for letter “Q” becomes corrupt.
[ ] 1010001(transmitted ASCII code for Q)
[ ] 1000001(received ASCII code for A)

An error such as this in the transmission of data would, at the least, be a nuisance and could be potentially catastrophic. However, you know that ASCII codes are assigned only to value 127,which only require seven bits. (numbered 0 to6) The most significant bit (bit seven) is therefore often used as a “parity” bit, to detect when an error occurred.

There are two conventions for sing parity bits. “even parity” and “odd parity”.
“Even parity” means that the parity bit (bit seven in ASCII code) is set to a total number of 1 (one) bits in byte is always an even number.

See how letter “Q” and “A” would look with even parity.
[0] 1000001 (ASCII code for A with even parity)
[1] 1010001 (ASCII code for Q with even parity)

There are two 1 bits in the ASCII code for A , so the parity bit made Zero (0) so that the total of eight bits is even. In the ASCII code fro “Q” there are three “1” (one) bits, so the parity bit is made to “1” (one). This brings the total number of one bits to four, which is an even number.

Now lets see what would happen if bit four in our ASCII letter Q became corrupted as in the example above.
[1] 1000001 (corrupted ASCII Q)

When the parity of the byte is checked (either by software or special hardware) it is seen that the correct “Q” has an even number of one (1) in it (including the parity bit) . The corrupted Q, by contrast, accidently had bit four changed from “ONE” to a ”ZERO” but the original parity bit – bit seven- is still “one”. 
THE BASIC, ONE BYTE = 8 BITS (binary digits, zero and one)
When the parity of this corrupted byte is checked, it will be found to have an odd number of 1 bits, and so this byte is known to be corrupted and can be rejected.

Please note that if you look at the ASCII codes used in your own computer, you will probably find that bit seven (the Most Significant Bit or MSB) is in fact used, but not as a parity bit. This is done to enable the computer to have an additional character set (usually a graphic character). Errors in data transmission “inside” the computer are VERY RARE. Parity is normally used to transmit data over long distance and when recorded data into magnetic recording surface which is equally susceptible to ‘bit errors’. Also note that if two bits in a byte become corrupted, an incorrectly transmitted byte could be taken as a correct one.

But in cases where the receiving device detects an error, it can send back an error message and the software can arrange for the incorrect byte to be sent again.  More sophisticated error detecting and correcting schemes have been devised that can pinpoint which bit or bits were in errors. Also can be automatically corrected. 

Share/Save
No votes yet

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options