44
Digital Electronics
Table 2.10 Example 2.6.
Binary
Parity
Three-time
Binary
Parity
Three-time
number
code
repetition
number
code
repetition
Code
code
0000
00000
000000000000
1000
11000
100010001000
0001
10001
000100010001
1001
01001
100110011001
0010
10010
001000100010
1010
01010
101010101010
0011
00011
001100110011
1011
11011
101110111011
0100
10100
010001000100
1100
01100
110011001100
0101
00101
010101010101
1101
11101
110111011101
0110
00110
011001100110
1110
11110
111011101110
0111
10111
011101110111
1111
01111
111111111111
corrupted to 1010001 in the transmission channel, show how the Hamming code can be used to identify
the error. Use even parity.
Solution
• The generalized form of the Hamming code in this case is P 1 P 2 D 1 P 3 D 2 D 3 D 4 P 4 D 5 D 6 D 7 =
P 1 P 2 1P 3 000P 4 001.
• The four groups of bits using different parity bits are P 1 D 1 D 2 D 4 D 5 D 7 , P 2 D 1 D 3 D 4 D 6 D 7 , P 3 D 2 D 3 D 4
and P 4 D 5 D 6 D 7 .
• This gives P 1 = 0, P 2 = 0, P 3 = 0 and P 4 = 1.
• Therefore, the transmitted Hamming code for ‘A’ is 00100001001.
• The received Hamming code is 00100101001.
• Checking the parity for the P 1 group gives ‘0’ as it passes the test.
• Checking the parity for the P 2 group gives ‘1’ as it fails the test.
• Checking the parity for the P 3 group gives ‘1’ as it fails the test.
• Checking the parity for the P 4 group gives ‘0’ as it passes the test.
• The bits resulting from the parity check, written in reverse order, constitute 0110, which is the
binary equivalent of ‘6’. This shows that the bit in error is the sixth from the MSB.
• Therefore, the corrected Hamming code is 00100001001, which is the same as the transmitted code.
• The received data word is 1000001.
Review Questions
1. Distinguish between weighted and unweighted codes. Give two examples each of both types of
code.
2. What is an excess-3 BCD code? Which shortcoming of the 8421 BCD code is overcome in the
excess-3 BCD code? Illustrate with the help of an example.
3. What is the Gray code? Why is it also known as the binary-reflected Gray code? Briefly outline
some of the important applications of the Gray code.
4. Briefly describe salient features of the ASCII and EBCDIC codes in terms of their capability to
represent characters and suitability for their use in different platforms.
5. What is the Unicode? Why is it called the most complete character code?
Digital Electronics
Table 2.10 Example 2.6.
Binary
Parity
Three-time
Binary
Parity
Three-time
number
code
repetition
number
code
repetition
Code
code
0000
00000
000000000000
1000
11000
100010001000
0001
10001
000100010001
1001
01001
100110011001
0010
10010
001000100010
1010
01010
101010101010
0011
00011
001100110011
1011
11011
101110111011
0100
10100
010001000100
1100
01100
110011001100
0101
00101
010101010101
1101
11101
110111011101
0110
00110
011001100110
1110
11110
111011101110
0111
10111
011101110111
1111
01111
111111111111
corrupted to 1010001 in the transmission channel, show how the Hamming code can be used to identify
the error. Use even parity.
Solution
• The generalized form of the Hamming code in this case is P 1 P 2 D 1 P 3 D 2 D 3 D 4 P 4 D 5 D 6 D 7 =
P 1 P 2 1P 3 000P 4 001.
• The four groups of bits using different parity bits are P 1 D 1 D 2 D 4 D 5 D 7 , P 2 D 1 D 3 D 4 D 6 D 7 , P 3 D 2 D 3 D 4
and P 4 D 5 D 6 D 7 .
• This gives P 1 = 0, P 2 = 0, P 3 = 0 and P 4 = 1.
• Therefore, the transmitted Hamming code for ‘A’ is 00100001001.
• The received Hamming code is 00100101001.
• Checking the parity for the P 1 group gives ‘0’ as it passes the test.
• Checking the parity for the P 2 group gives ‘1’ as it fails the test.
• Checking the parity for the P 3 group gives ‘1’ as it fails the test.
• Checking the parity for the P 4 group gives ‘0’ as it passes the test.
• The bits resulting from the parity check, written in reverse order, constitute 0110, which is the
binary equivalent of ‘6’. This shows that the bit in error is the sixth from the MSB.
• Therefore, the corrected Hamming code is 00100001001, which is the same as the transmitted code.
• The received data word is 1000001.
Review Questions
1. Distinguish between weighted and unweighted codes. Give two examples each of both types of
code.
2. What is an excess-3 BCD code? Which shortcoming of the 8421 BCD code is overcome in the
excess-3 BCD code? Illustrate with the help of an example.
3. What is the Gray code? Why is it also known as the binary-reflected Gray code? Briefly outline
some of the important applications of the Gray code.
4. Briefly describe salient features of the ASCII and EBCDIC codes in terms of their capability to
represent characters and suitability for their use in different platforms.
5. What is the Unicode? Why is it called the most complete character code?
