The binary coded decimal (BCD) is a type of binary code used to represent a given decimal number in an equivalent binary form. Its main advantage is that it allows easy conversion to decimal digits for printing or display and faster calculations.
The most common BCD code is the 8421 BCD code. In this, the BCD equivalent of a decimal number is written by replacing each decimal digit in integer and fractional parts with its four-bit binary equivalent ‘(or nibble). Here 8, 4, 2 and 1 represent the weights of different bits in the four-bit groups, starting from the (MSB) most significant bit (to extreme left) and proceeding towards the least significant (LSB) bit.
This feature makes it a weighted code, whose main characteristic is that each binary digit in the four bit group representing a given decimal digit is assigned a weight, and for each group of four bits, the sum of the weights of those binary digits whose value is 1 is equal to the decimal digit which they represent.
For example, if we look at table, we find that the decimal digit 9 when represented in 8421 BCD is 1001. Now the decimal digit assigned to first 1 is 8 and to the second 1 is 1. If we add 8 and 1 we get the required decimal number which is 9.
The 4221 BCD and 5421 BCD are other weighted BCD codes shown in table. The numbers 4, 2, 2, 1 in 4221 BCD and 5, 4, 2 and 1 in 5421 BCD represent weights of the relevant bits.
Now let us consider some examples, where we convert the given decimal numbers to BCD.
The 8421 BCD code for 9.2 is 1001.0010.
The 4221 BCD code for 9.2 is 1111.0010.
The 5421 BCD code for 9.2 is 1100.0010.
BCD code is useful for outputting to displays that are always numeric (0 to 9), such as those found in digital clocks or digital voltmeters.