Hamming Code: G. Bindu Madhavi (Ph. D) Assistant Professor Anurag University
Hamming Code: G. Bindu Madhavi (Ph. D) Assistant Professor Anurag University
G. Bindu Madhavi(Ph. D)
Assistant Professor
Anurag University
Hamming Code
• This error detecting and correcting code technique is developed by
R.W.Hamming . This code not only identifies the error bit, in the
whole data sequence and it also corrects it. This code uses a
number of parity bits located at certain positions in the codeword.
The number of parity bits depends upon the number of information
bits. The hamming code uses the relation between redundancy bits
and the data bits and this code can be applied to any number of
data bits.
What is a Redundancy Bit?
• By calculating and inserting the parity bits in to the data bits, we can achieve
error correction through Hamming code.
• Let’s understand this clearly, by looking into an example.
Example:
Encode the data 1101 in even parity, by using Hamming code.
Step 1
• Calculate the required number of parity bits.
• Let P = 2, then
2P = 22 = 4 and n + P + 1 = 4 + 2 + 1 = 7.
• 2 parity bits are not sufficient for 4 bit data.
• So let’s try P = 3, then
• 2P = 23 = 8 and n + P + 1 = 4 + 3 + 1 = 8
• Therefore 3 parity bits are sufficient for 4 bit data.
• The total bits in the code word are 4 + 3 = 7
Encode the data 1101 in even parity, by using
Hamming code….
Encode the data 1101 in even parity, by using
Hamming code.
Step 3
• Determine the parity bits.
• For P1 : 3, 5 and 7 bits are having three 1’s so for even parity, P1 = 1.
• For P2 : 3, 6 and 7 bits are having two 1’s so for even parity, P2 = 0.
For P3 : 5, 6 and 7 bits are having two 1’s so for even parity, P3 = 0.
• By entering / inserting the parity bits at their respective positions, codeword can be
formed and is transmitted. It is 1100101.
• NOTE: If the codeword has all zeros (ex: 0000000), then there is no error in
Hamming code.
ASSIGNMENT
• Encode the data 1010 in odd parity, by using Hamming code.
THANK YOU