Header Ads

Header ADS

Hamming code



The hamming codes are used extra parity bits to identify a single bit error. To get from one-bit pattern to the other, few bits are to be changed in the data. Such a number of bits can be termed as Hamming distance. It can only detect a single bit error correction. If the parity has a distance of 2, a one-bit flip can be detected. But this can't be corrected. Also, any two-bit flips cannot be detected.

7-bit Hamming code is commonly used which contains 4 data bits and 3 Parity bits.  The position of the parity bit is determined by the formula – 2^n (where n=0,1,2…).

For n=0, the position of first parity, P12^0=1
For n=1, the position of first parity, P22^1=2
For n=2, the position of first parity, P42^2=4

The value of P1 depends on the data bits D3, D5, and D7.
The value of P2 depends on the data bits D3, D6, and D7.
The value of P3 depends on the data bits D5, D6, and D7.

Example: If data is 1011 then find the value of P1, P2 & P4 ( Even parity)?
Solution: The data bit with the corresponding symbol is shown in the table:

7
6
5
4
3
2
1
D7
D6
D5
P4
D3
P2
P1
1
0
1
?
1
?
?
Now, P1 depends on the data bits D3, D5 and D7 i.e (111) which contains the odd number of 1’s.
So, for even parity P1 = 1.

P2 depends on the data bits D3, D6 and D7 i.e (101) which contains the even number of 1’s.
So, for even parity P2= 0.

P4 depends on the data bits D5, D6 and D7 i.e (101) which contains the even number of 1’s.
So, for even parity P3 = 0.

1 comment:

Powered by Blogger.