You are on page 1of 1

Some students ask about the Hamming code calculation, here is the detail explanation

using example 8.1 in page 406.


Note ⊕ symbol is not exclusive OR, it is use to make up the parity for even or odd.

Example 8.1 Encode 1011 Using the Hamming code and Odd Parity

1. First the P bits has to be on the bit location that are two’s power -> so for 4 bits
we can have on 20, 21, 22 location 23 is not use because our data is not long enough
to have something on the 8 position.
So the Encode will look like -> P1 P2 1 P4 0 1 1
Position 1 2 3 4 5 6 7

2. P1 is on the first position using a three bit value to display the position 001, so P1
will be calculate with position 3 (011), 5(101), and 7(111). Because they all have
the same last bit as 1 on the three bit position value.
Since this is Odd Parity so P1 ⊕ D3⊕D5⊕D7 has to have odd numbers of 1
So P1 has to be 1 so P1D3D5D7 will have odd numbers of 1
3. Same apply for P2, P2 (010)will be calculate with D3 (011), D6(110) and D7(111),
and to be in odd parity P2 has to be 0.
4. Same apply for P4, P4(100)will be calculate with D5 (101), D6(110) and D7(111),
and to be in odd parity P4 has to be 1.
5. So the final Hamming code will be 1 0 1 1 0 1 1
P1 P2 1 P4 0 1 1

You might also like