Self Complementing Codes
~ on ~ 0 commentsSelf Complementing Codes:
Selfcomplementing binary codes are those whose members complement on themselves. For a binary code to become a selfcomplementing code, the following two conditions must be satisfied:
1. The complement of a binary number should be obtained from that number by replacing 1’s with 0’s and 0’s with 1’s (already stated procedure).
2. The sum of the binary number and its complement should be equal to decimal 9.
The following example will illustrate this procedure.
The Excess3 (Xs3) Code
Let us now consider the excess3 (Xs3) binary coding system. An Xs3 equivalent of a given binary number is obtained using the following steps:
1. Find the decimal equivalent of the given binary number.
2. Add +3 to the decimal equivalent obtained in 1.
3. Convert the newly obtained decimal number back to binary number to get the desired Xs3 equivalent.
Following the steps given above, we draw Table 1.24, which shows the binary and Xs3 equivalents.
Table Xs3 binary codes
Binary numbers

Decimal equivalent

Decimal +3

Xs3 equivalent

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

0
1
2
3
4
5
6
7
8
9

3
4
5
6
7
8
9
10
11
12

0011
0100
0101
0110
0111
1000
1001
1010
1011
1100

Example 23: Prove that Xs3 code is a selfcomplementing code.
Solution: Consider the Xs3 number 0101. From Table 1.24, we obtain 0101 ≡ decimal 2. Its complement (by changing 1s to 0s and vice versa) is 1010. From Table 1.24, we find that decimal equivalent of 1010 is 7. Now adding the decimal equivalents of 0101 (≡2) and 1010 (≡7) yields decimal 9. It can be seen that all the numbers in Xs3 code obeys this condition. Then by condition 2 (see Section 1.14), Xs3 code is a selfcomplementing code.
The 8421 Binary Weighted (or, Conventional) Code
In the decimal number system, we know that (123)_{10} = 1× 10^{2} + 2× 10^{21} +3× 10^{0}, where 10^{2}, 10^{1}, and 10^{0} are the positional weights (or simply, weights) of the coefficients 1, 2, and 3, respectively. In the same fashion, we may express (1011)_{2 }= 1× 2^{3} + 0× 2^{2} +1× 2^{1}+1× 2^{0}. The weights of 1, 0, 1, and 1 are, respectively, 2^{3} = 8, 2^{2} = 4, 2^{1 }= 2, and 2^{0 }= 1. Since the positional weights are 8, 4, 2, and 1, we call the conventional binary system as the 8421 binary number system also. We multiply the bits in a given binary number with their respective weights and add them to yield their decimal equivalent. For example, we have seen that 1011 = 1× 8 + 0× 4 +1× 2^{}+1× 1 = (11)_{10}. In Example 24, we prove that the 8421 code is not a selfcomplementing code.
Example 24: Prove that the conventional binary code is not a selfcomplementing code.
Solution: To illustrate this, consider binary number 1011, whose 1’s complement is 0100. We know that (1011)_{2} º (11)_{10} and (0100)_{2} º (4)_{10}. Now, the sum of (11)_{10} + (4)_{10} = (15)_{10}, and not (9)_{10}. Therefore, we conclude that 1011 and 0100 are not complementary numbers and hence, the conventional binary code is not a selfcomplementing code.
The 2421 Binary Weighted Code
Example 25: Prove that 2421 code is a selfcomplementing code.
Solution: The basic members of this family are given in Table 1.25. The bits in each of the binary numbers given in the first column may be multiplied with their respective weights to get the equivalent decimal in the second column. For example, number 1011 has its equivalent decimal as 5. This is obtained as follows:
1011 = 1× 2 + 0×4+1× 2 +1= 2 + 2 + 1 = 5
All the other decimal equivalents can be similarly obtained.
Table: The 2421 code
2421 code

Decimal equivalent

0000
0001
0010
0011
0100
1011
1100
1101
1110
1111

0
1
2
3
4
5
6
7
8
9

Now, consider number (1011)_{2} ≡ (5)_{10} in Table 1.25 again. The complement of 1011 is 0100. From Table 1.25, we obtain the decimal equivalent of 0100 as 4. Adding 5 and 4 yields 9. Hence, we conclude that the 2421 code exhibits the necessary property of selfcomplementing codes. In similar fashions, we can prove that all the other numbers of this coding scheme also exhibit this property. Therefore we conclude that the 2421 code is a selfcomplementing code.
No comments: