Data Representation: Error checking

Bits can change by error during transmission due to electrial interference. Error checking is the process of trying to ensure that the bits received during transmission are the bits that were intended.

The four methods we will be looking at are parity bits, majority voting, checksums, and check digits.

Parity bits

When using an 8 bit system, but transmitting 7 bit ASCII, the additional bit can be used for error checking.

Either even or odd parity can be used. If using odd parity, the extra bit will be assigned a 1 if the number of 1 is currently even and a 0 if it is currently odd. Any 8 bit group that does not have an odd number of 1s there has been an error. With even parity the extra bit is set so that there is an even number of 1s.

Odd parity Parity bit
1 0 1 0 1 0 1 1
1 1 1 0 1 0 1 0

Even parity Parity bit
1 0 1 0 1 0 1 0
1 1 1 0 1 0 1 1

Majority voting

Majority voting involves sending each bit times. If they are not all the same then the value in 2 out of 3 places is considered correct. The obvious problem with this method is that it triples the amount of data to be sent.

1 1 0 1 0 1 1 0
1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0

In the example above the majority bit has been selected where three bits don't agree to give the final byte 11010110.

Checksums

A checksum is where a mathematical formula is applied to convert bytes of data to their decimal equivalent value. When a block of data is transmitted, the sum of all the bytes of data is sent along with it. At the receiving end the same algorithm is applied. If the checksum is the same as the one transmitted then you know there has been no error.

248 85 252
1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0

A larger group of bytes would be transitted and the total of all byte values transmitted alongside. If we were transmitting just these three bytes the checksum would be 248 + 252 + 85 = 585.

Check digits

A check digit is another method to ensure there have not been mistakes on input or transmission. ISBN which is a system for book numbering uses check digits. 12 of the digits represent the unique product number and the last is a check digit.

The check digit is calculated by assigning a weight of 1 to all the even digits i.e. the 1st, 3rd, 5th digits etc. and a weight of to all the even digits i.e. the 2nd, 4th, etc. Each digit is multiplied by it's weight and the total of all weighted digits is calculated. This number is divided by 10 using modulus and the remainder obtained. This remainder is then taken away from 10. The result is the check digit.

ISBN 9 1 4 1 1 8 0 7 7 0 4 3 Check digit
Weight 1 3 1 3 1 3 1 3 1 3 1 3
Weighted 9 3 4 3 1 24 0 21 7 0 4 9
Total 9+3+4+3+1+24+0+21+7+0+4+9 = 85
Modulus 85 % 10 = 5
10 - modulus 10 - 5 = 5 5

Knowledge check


Questions:
Correct:

Question text


© All materials created by and copyright S.Goff