Binary Coded Decimal (BCD) Addition


Let's start this article with an overview of Binary Coded Decimal (BCD) codes before moving on to discuss BCD addition.

What is BCD?

BCD or Binary Coded Decimal is a coding scheme used to represent decimal number (0 to 9) in the form of binary digits of a group of 4-bits. Binary coded decimal is the simplest form to convert decimal numbers into their equivalent binary format. Although, binary coded decimal or BCD is not the same as the normal binary representation.

In binary coded decimal (BCD) coding scheme, each decimal digit is represented as a group of 4-bit binary number. For a multi-digit decimal number, each digit of the decimal number is encoded separately in the BCD.

As we know, a 4-bit binary number can represent 16 decimal digits, but in binary coded decimal, BCD codes 1010, 1011, 1100, 1101, 1110, and 1111 equivalent to decimal 10, 11, 12, 13, 14, and 15 are considered illegal combinations.

Decimal to Binary Coded Decimal Truth Table

The following is the truth table representing binary coded decimal (BCD) equivalent of decimal digits from 0 to 9 −

Decimal Digit

Binary Coded Decimal Code

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

Let’s now understand how to convert a given decimal number into its equivalent binary coded decimal.

Example: Decimal to Binary Coded Decimal Conversion

The following example shows how a decimal number is converted to a BCD code −

Convert (125)10 into its equivalent binary coded decimal (BCD) code.

Decimal number

1

2

5

BCD Weights

8

4

2

1

8

4

2

1

8

4

2

1

BCD Code

0

0

0

1

0

0

1

0

0

1

0

1

Hence, the binary coded decimal for (125)10 is (0001 0010 0101).

Now, let’s discuss the binary coded decimal (BCD) addition.

Binary Coded Decimal Addition

Binary coded decimal addition follows the rules of binary arithmetic, however there are some extra things that require to be taken care of. The BCD addition of two BCD numbers is performed as per the following steps −

  • Step 1 − Perform addition of two BCD numbers by following the rules of binary addition.

  • Step 2 − If the result or sum is a 4-bit binary number which is less than or equal to 9, then the sum is a valid BCD number.

  • Step 3 − If the sum is a 4-bit number that is greater than 9 or if a carry is generated, then it is an invalid sum.

  • Step 4 − To obtain the corrected result/sum, add 6 (0110) to the 4-bit invalid sum. If a carry is generated when 6 is added, then propagate and add this carry to the next 4-bit group. This step is done to skip the six illegal BCD codes (i.e. 1010, 1011, 1100, 1101, 1110, and 1111).

Rules of Binary Addition

The following are the rules used to perform binary addition of two binary digits −

First Bit Second Bit Result
0 0 0 + 0 = 0; no carry
0 1 0 + 1 = 1; no carry
1 0 1 + 0 = 1; no carry
1 1 1 + 1 = 0; carry = 1

After getting the knowledge of BCD addition and rules of binary addition, let us now consider some solved examples to understand the BCD addition in detail.

Example 1

Perform the addition 30 + 15 in BCD scheme.

Solution − Given decimal numbers and their equivalent BCD representation is,

(30)10 = (0011 0000)BCD

(15)10 = (0001 0101)BCD

The BCD addition of the given numbers is as below −

30

0011

0000

+ 15

+

0001

0101

45

0100

0101

Example 2

Perform addition 678 + 535 in Binary Coded Decimal.

Solution − Given decimal numbers and their BCD representation is,

  • (678)10 = 0110 0111 1000

  • (535)10 = 0101 0011 0101

The BCD addition is as below −

678

0110

0111

1000

+ 535

+

0101

0011

0101

1213

1011

1010

1101

(All are illegal codes)

+

0110

0110

0110

(Add 0110 to each)

1 0001

1 0000

1 0011

(Propagate carry)

+1

1

1

0001

0010

0001

0011

(Corrected Sum = 1213)

Tutorial Problems

  • Find the sum of BCD numbers (0001 1001) and (0100 1000).

  • Find the sum of decimal number 25 and 35 in BCD.

Conclusion

In conclusion, BCD addition is performed by adding individual digits of the decimal numbers represented in 4-bit binary groups starting from the right most digit. If the sum term is not an illegal BCD code and there is no carry output, then no correction is required. If the sum term is an illegal BCD code or if a carry is produced, then 6 (0110) is added to the sum term of the group to correct the result.

Updated on: 08-Aug-2023

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements