Bcd code
An 8421 code is a binary-coded decimal (Bcd) code consisting of four binary digits. It is used to represent the digits 0 through 9. The 8421 designation refers to the binary weight of the 4 bits.
The main advantage of this code is that it permits easy conversion between decimal and binary form. This is the predominant BCD code used and is the one referred to unless otherwise stated.
Each decimal digit (0 through 9) is represented by a binary combination as follows:
Although 16 numbers (24) can be represented by four binary positions, the six code combinations above decimal 9 (1010, 1011, 1100, 1101, 1110, and 1111) are invalid in the 8421 code.
To express any decimal number in the 8421 code, replace each decimal digit by the appropriate 4-bit code.
To determine a decimal number from an 8421 code number, break the code into groups of 4 bits. Then write the decimal digit represented by each 4-bit group.