Hamming Error Detection Simulation

written by Teresa Carrigan


Run model in your browser


Top

WHAT IS IT?

This model demonstrates detection and correction of single bit errors, using Hamming SEC (single-error-correction, even parity) with eight data bits.

Top

HOW IT WORKS

First a random 12-bit pattern is generated. This represents either stored data or a message received, that is already in Hamming SEC. Next the check bits are marked; they will be the bits that occupy positions 1, 2, 4, and 8.

Each position is then marked with the binary equivalent of the position number. This will help us determine easily which bits are checked by which check bit. Each check bit has a single one in the binary equivalent of its position number, and checks all bits that have a one in that same place in the binary equivalent.

Next we check the parity of each check bit group. If any group has odd parity, we know that there is an error in one of the bits in that group, and we mark its check bit in red.

After checking every check bit group, if there are no red check bits, then no error occurred and we can just strip the check bits to get the data. If there was an error, we add the position numbers of all the red check bits to get the position of the bit that has been flipped. If the sum of the red check bit positions is greater than the number of bits we have, then multiple errors occurred and we cannot fix the error. Otherwise, we simply flip the erroneous bit, and then strip the check bits to give the correct data bits.


Home

Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.