Error Checking Algorithms

Introduction

Why do we need error checking?

There are 4 main areas where data errors are common:

  • Input Error – where the user enters the wrong value.
  • Write Error – where the data is either stored incorrectly on the device or it becomes corrupted over time.
  • Read Error – where the computer fails to retrieve the correct data from a storage device
  • Transmission Error – where the data is corrupted somewhere during transmission from on device to another

 

Demo

Demo

Click the binary bits to see what happens to the light coloured parity bits at the end of each row/column.

Game

Parity bit game

In this game you have to work out which bit in the grid is the incorrect bit, by using even parity. All digits in each row and each column should add up to an even number so you need to find which bit is the wrong number.

Parity Bits

Parity Bits

Parity Bits are used to check that data has been transmitted / read / written successfully. You can have either even or odd parity but they work on the same principle.

Even parity

When a byte of a data is transmitted an extra bit is added to the data. The extra bit is used to ensure that the total value of all bits added together is an even number.

Example 1 – 1110 1010

Here the bits add up to 5, and odd number, so a 1 is added at the end to ensure that the number adds up to an even number.  1110 1010 1

The number is now even and can be transmitted. When the device receives the data it checks to ensure that the 9 bits still add up to an even number. If one of the bits has been corrupted during transmission then the bits will now add up to an odd number.

Limitations of parity bits

Parity bits are only effective if only 1 bit has been corrupted. If more than one bit has been corrupted then there is a 50% chance that the number will end up even anyhow. A more reliable but complex method of error checking is through the use a checksum.

 

 

Resources

Resources

Check Bits – check bit magic trick

Checksums

Barcode checking – Mod 10

Credit Cards – Mod 13

https://csunplugged.org/en/topics/error-detection-and-correction/

https://csfieldguide.org.nz/en/chapters/coding-error-control/the-parity-magic-trick/

Worksheet – barcode checker questions (check barcodes / calculate checksums)