An 8-bit byte with binary value 11001101 is to be encoded using an even-parity Hamming code. What is the binary value after encoding?
Step1: Counting the number of parity bits
2p ≥ n + p + 1
Here, n is the number of data bits and p is the number of parity bits.
2p ≥ 8 + p + 1
2p ≥ 9 + p, when p=4 24 ≥ 13
Step2: positioning all the parity bits
It is located at bit positions of powers of 2, i.e. 1, 2, 4, 8, etc. Data bits in other positions.
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
P1 |
P2 |
D1 |
P3 |
D2 |
D3 |
D4 |
P4 |
D5 |
D6 |
D7 |
D8 |
|
P1 |
P2 |
1 |
P3 |
1 |
0 |
0 |
P4 |
1 |
1 |
0 |
1 |
Step 3) Parity check
Parity bits need to be calculated based on data bits and the redundant bits.
p1 checks the positions (1, 3, 5, 7, 9, 11…) and total the number of 1’s in all this positions should be even number
similarly, p2 checks the positions (2, 3, 6, 7, 10, 11… )
p3 checks the positions (4-7, 12-15, 20-23… )
p4 checks(8-15,…..)
p1 -> p1,1,1,0,1,0 -> number of 1’s 3, to make it even p1=1
p2->p2,1,0,0,1,0-> number of 1’s even, so p2=0
p3->p3,1,0,0,1 ->number of 1’s even, so p3=0
p4->p4,1,1,0,1->number of 1’s 3, to make it even p4=1
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
P1 |
P2 |
D1 |
P3 |
D2 |
D3 |
D4 |
P4 |
D5 |
D6 |
D7 |
D8 |
|
1 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
Encoded data=101010011101
Get Answers For Free
Most questions answered within 1 hours.