There are different types of BCD codes; however, the 8421 code is the most popular one. In this article, we will highlight three different types of BCD codes, such as 8421, 2421, and Excess-3. Both 8421 and 2421 are weighted code, whereas Excess-3 is not weighted.
The above table shows the binary code groups for different BCD representations. Using 4 binary bits, a total of 16 numbers can be represented. However, for BCD, 10 decimal digits (0 through 9) need to be represented. Therefore, there are six unused code words / invalid codes for all BCD representations, as shown above.
As stated earlier, both 8421 and 2421 are weighted codes, where each decimal digit can be found from its code word by assigning a fixed weight to each code word bit. For example, the weights of four bits of 8421 code are 23, 22, 21, and 20. So, decimal digit 5 in 8421 is “0101”, which is 0 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 5.
Both 2421 and Excess-3 codes are self-complementing codes. This means that the code word for the 9s’ complement of any digit can be obtained by complementing the individual bits of the digit’s code word. For example, decimal digit 2 in Excess-3 is “0101”. If we complement “0101”, then it will be “1010”, which is the Excess-3 code of decimal digit 7 (check the above table). Since 7 is 9s’ complement of 2, this shows that Excess-3 code is self-complementing.