Professional Documents
Culture Documents
by
Noor Dheyaa
Hamming code
Hamming code : can detect up to two bit errors or correct one bit error.
invented by Richard Hamming in 1950.
In the code word, there are k data bits and 𝑟=𝑛−𝑘 redundant (check)
bits, giving a total of n code word bits. 𝑛=𝑘+𝑟
Hamming Code Algorithm:
1. r parity bits are added to an k - bit data word, forming a code word of n bits.
2. The bit positions are numbered in sequence from 1 to n.
3. Those positions are numbered with powers of two, reserved for the parity
bits and the remaining bits are the data bits.
4. Parity bits are calculated by XOR operation of some combination of data
bits.
hamming code Method
1- Equations Method:
Example: Hamming(7,4)
H=rxn
G=nxk
Code word = G * M
Syndrome = H* R
:Example
A: Using equations method for hamming code of (7, 4),
1- Determine the code word of the following message: m1= 1100 and
m2= 0110.
2- Calculate the syndrome, if the error occurs at the sixth bit of each
received code word.
A- For first message =1100
7 6 5 4 3 2 1 Bit position
d4 d3 d2 p3 d1 p2 p1 Bit name
0 0 1 1 1 1 0 Code ward
7 6 5 4 3 2 1 Bit position
d4 d3 d2 p3 d1 P2 p1 Bit name
0 1 1 0 0 1 1 Code ward
The received code word: R1 = 0111110, Now calculate the
syndrome:
So that CBA = 110 which indicate that an error in the sixth bit.
B) Using matrices method for Hamming code of (7, 4),
1- Determine the code word of the fallowing messages: m1= 0011 and
m2= 1001.
2- Calculate the syndrome, if the error occurs at the fifth bit of each
received code word.
2- Now for an error in bit 5 occurs, then R1=[1000111] and
R2=[0011101].
Using the syndrome equation S=[H] * R where R is the received vector
and the parity check matrix is given by:
Example 2
Thank you