[Back to Lecture Notes page]

Error Detection and Correction

Error Correcting Codes

Eg.
Hamming distance between 0011 and 0010 is 1 – only the last bit is different.
Hamming distance between 1011 and 0010 is 2 – first and last bits are different.
Hamming distance between 1011 and 0100 is 4 – all four bits are different.

Eg 1.

We have a code consisting of 000000, 000111, 111000, and 111111 – using this code we can ONLY transmit these four bit sequences.
The Hamming distance between 000000 and 000111 is 3.
The Hamming distance between 000000 and 111000 is 3.
The Hamming distance between 000000 and 111111 is 6.
The Hamming distance between 000111 and 111000 is 6.
The Hamming distance between 000111 and 111111 is 3.
The Hamming distance between 111000 and 111111 is 3.
So the Hamming distance of this code (the minimum distance from above) is 3.

Eg
If we use the code from eg 1 above:
If a sender sends 000111 but the first bit was changed on transmission, the receiver will receive 100111. The receiver knows it is an error because 100111 is not a valid codeword in this code. To figure out what the real codeword should be, he just looks for the "nearest" legal codeword, which is 000111, which is correct.
Note that this will not work if there are 2 errors, eg 000111 becomes 110111. If a receiver receives 110111, he will infer that the correct codeword is 111111, which is wrong. For a code with Hamming distance n, it can only handle n/2 number of bit errors.

Designing Error Correcting Codes

Eg (we will put the parity bit at the beginning of the codeword).
In even parity, the parity bit for 1100 is 0 – so the codeword is 01100 (even number of 1’s).
In even parity, the parity bit for 1110 is 1 – so the codeword is 11110 (even number of 1’s).
In odd parity, the parity bit for 1100 is 1 – so the codeword is 11100 (odd number of 1’s).
In odd parity, the parity bit for 1110 is 0 – so the codeword is 01110 (odd number of 1’s).

Hamming Code

(Read the textbook p185 on how to do this).

See Fig 3-6 p186

The idea is to take a series of k codewords and transmit all the first bits first, then all their second bits, the all their third bits, and so on. If we get a burst error (up to k bits), then all we lose is a single bit in each of the codewords. As we described above, we can still recover the original codeword from a single bit error.

Error Detecting Codes

 

Cyclic Redundancy Code (CRC code)

[Back to Lecture Notes page]