Hamming Code
Hamming Code
TOPICS COVERED:
• Error Detection using hamming code
• Error Correction using hamming code
• Sums based on hamming code
• Advantages and disadvantages of hamming code
• Applications of hamming code
PRE-REQUISITE KNOWLEDGE:
• Parity
- Even Parity
- Odd Parity
- Block Parity
• Binary to Decimal Conversion
HAMMING CODE
7 6 5 4 3 2
1
Redundant/Parity bits are extra binary bits that are generated and added to the information-carrying
bits of data transfer to ensure that no bits were lost during the data transfer. The number of parity
bits can be calculated using the following formula:
For 7-bits-
>
2^0=1 D7 D6 D5 P4 D3 P2 P1
2^1=2
2^2=4
2^3=8 7 6 5 4 3 2
1m=4
QUESTION: p+m+1-> p+4+1-> p+5
How many parity bits are needed if the data size is 4 bits? 2p >= p+5
ANSWER: 23 >= 3+5 SATISFIED
3 SOLUTION-> Therefore, we need3 parity bits.
7 6 5 4 3 2 1
D7 D6 D5 P4 D3 P2 P1
P1-> 3,5,7
P2-> 3,6,7
P4-> 5,6,7
Example-1
If the 7-bit hamming code word received by a receiver is 1011011.
Assuming the even parity state whether the received code word is
correct or wrong. If wrong locate the bit having error.
Advantages of the Hamming Code:
• On networks where data streams are delivered for single-bit mistakes, the Hamming coding approach is
effective.
• Hamming code not only detects bit errors but also aids in the identification of bits containing errors so
that they can be repaired.
• Because of their simplicity, hamming codes are ideal for computer memory and single-error correction.
• ECC RAM uses Hamming code with SECDED to automatically correct single errors and
raise an alarm on two errors.
• Hamming code is used for data transmission in satellite and space communication.