You are on page 1of 17

Error correction

-Error Correction method

Error correction methods


Single bit error correction:A single bit error occurs only when a receiver reads a 1 bit data as 0 or a 0 bit data as 1. To correct the error, the receiver simply reverses the value of the altered bit. To do so, however, it must know which bit is in error & for that we have to locate that bit.

Error correction methods


For example, to correct a single-bit error in an ASCII character,the error correction code must determine which of seven bits has changed. In this case , we have to distinguish between eight different states: no error, error in position 1, error in position 2, up to error in position 7. To do so requires enough redundancy bit to show all eight states.

Error correction methods


A three bit redundancy code should be adequate because three bits can showeight different states (000 to 111)and can therefore indicate the location.

Hamming Code
-Error Correction method

Hamming Codes Description


The most common types of error-correcting codes used in RAM are based on the codes devised by R.W. Hamming. Kparity bits are added to an n-bit data word, forming a new word of n+ kbits. The bit positions are numbered in sequence from 1 to n+ k. Those positions numbered with powers of two are reserved for the parity bits. The code can be used with words of any length.

What is Hamming code


Hamming code is a technique developed by R.W. Hamming to provide a practical solution in Error correction. It can be applied to the data units of any length.It uses data unit and 4 redundancy bits (for 7 bit ASCII code) which can be added to the end of the bits or in between.Generally these bits are placed at positions 1,2,4and 8. For ex.

(11,7) Hamming Code Example

7-bit data word "0110101(d -data bits, p -parity bits)

Combinations for the parity


In the Hamming code, each p bit is the VRC bit for one combination of data bits: p1 is the VRC bit for the combination of data bits having 1 at ones posion in their ASCII code. p2 is the VRC bit for the combination of data bits having 1 at second position in their ASSCII code and so on . The combination used to calculate each of four p values for a seven bit data can be counted as:

Combination cont
p1 : bits 1 3 5 7 9
p2 : bits 2,3,6,7,10,11 p4 : bits 4,5,6,7 p8 : bits 8,9,10,11

Hamming Code Example (Cont.)

Assume the final bit gets corrupted and turned from 1 to 0 Flag each parity bit as 1 when the even parity check fails

Hamming CodeExample (Cont.)

Evaluate the value of the parity bits. The integer value of the parity bits is 11, signifying that the 11th bit in the data word (including parity bits) is wrong and needs to be flipped.

Hamming Rule

d + p + 1 < = 2p

Where d is the number of data bits and p is the number of parity bits

Hamming CodeExample (Cont.)


Flipping the 11th bit gives changes 10001100100back into 10001100101. Removing the Hamming codes gives the original data word of 0110101.

How about parity bit error?


As parity bits do not check each other, if a single parity bit check fails and all others succeed, then it is the parity bit in question that is wrong and not any bit it checks.

Hamming codes with additional parity


The extra parity bit applies to all bits after the Hamming code check bits have been added. Then all single-bit, two-bit and three-bit errors can be detected. two-bit errors can be distinguished from singlebit and three-bit errors. Single-bit errors can be corrected.

Two-bit errors
Two-bit errors can at least be recognized:
When using correction, if a parity error is detected and the Hamming code indicates that there is an error, this error can be corrected. However, if a parity error is not detected but the Hamming code indicates that there is an error, this is assumed to have been due to a two-bit error, which is detected but cannot be corrected. Hamming Codes are capable of correcting one error or detecting two errors but not capable of doing both simultaneously.