This code is used for single error correction i.e. using this code we can detect only single error. In parity bit method we used only single extra bit but in this method number of extra bits (which also are parity bits) vary with the number of bits of the message.
Suppose we have the number of information bits as m=4 then we have to determine number of parity bits using above relation
2p >= 4 + p + 1
2p >= 5 + p
From this we can check for values of p, which one satisfies
For p=1 2 >= 6 doesn’t satisfy
For p=2 4>= 7 doesn’t satisfy
For p=3 8>=8 satisfies hence we have p=3
So now we have 4 information bits and 3 parity bits so total of 7 bits. In the parity bit method, we placed the parity bit at rightmost position. But here we don’t place the extra bits consecutively but the positions are fixed by following rule:
As we need only three positions so we have to pick first 3 which are 1, 2, and 4.
So we have the composition of hamming code as follow:
Bit1 bit2 bit3 bit4 bit5 bit6 bit7
Parity parity parity
P1 P2 M1 P3 M2 M3 M4
Now we have to decide positions in the hamming code which would be covered by the parity bit i.e. the positions considering which value of parity bit would be decided. We’ll be using following rule for this:
16 Replies to “Hamming code”