15 BCD Addition
15 BCD Addition
TABLE 1-4
Binary-Coded Decimal (BCD)
Decimal BCD
Symbol Digit
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
The BCD value has 12 bits, but the equivalent binary number needs only 8 bits. It
is obvious that a BCD number needs more bits than its equivalent binary value.
However, BCD representation of decimal numbers is still important, because com-
puter input and output data used by most people needs to be in the decimal sys-
tem. BCD numbers are decimal numbers and not binary numbers, even though
they are represented using bits. The only difference between a decimal and a BCD
number is that decimals are written with the symbols 0, 1, 2, ..., 9, and BCD num-
bers use the binary codes 0000, 0001, 0010, ..., 1001.
BCD Addition
Consider the addition of two decimal digits in BCD, together with a possible
carry of 1 from a previous less significant pair of digits. Since each digit does not
exceed 9, the sum cannot be greater than 9 9 1 19, the 1 being a carry.
Suppose we add the BCD digits as if they were binary numbers. Then the binary
sum will produce a result in the range from 0 to 19. In binary, this will be from
0000 to 10011, but in BCD, it should be from 0000 to 1 1001, the first 1 being a
carry and the next four bits being the BCD digit sum. When the binary sum is
less than 1010 (without a carry), the corresponding BCD digit is correct. But
when the binary sum is greater than or equal to 1010, the result is an invalid
BCD digit. The addition of binary 6, (0110)2, to the sum converts it to the correct
digit and also produces a decimal carry as required. The reason is that the differ-
ence between a carry from the most significant bit position of the binary sum and
a decimal carry is 16 10 6. Thus, the decimal carry and the correct BCD sum
ManoCh01v4.fm Page 25 Wednesday, May 2, 2007 6:11 PM
digit are forced by adding 6 in binary. Consider the next three-digit BCD addi-
tion example.
In each position, the two BCD digits are added as if they were two binary numbers.
If the binary sum is greater than 1001, we add 0110 to obtain the correct BCD digit
sum and a carry. In the right column, the binary sum is equal to 17. The presence of
the carry indicates that the sum is greater than 16 (certainly greater than 9), so a
correction is needed. The addition of 0110 produces the correct BCD digit sum,
0111 (7), and a carry of 1. In the next column, the binary sum is 1101 (13), an
invalid BCD digit. Addition of 0110 produces the correct BCD digit sum, 0011 (3),
and a carry of 1. In the final column, the binary sum is equal to 1001 (9) and is the
correct BCD digit. ■