In the previous lesson, we learned about binary codes and how they are used for representing a distinct discrete element of information using 1s and 0s.
People use the decimal system for everything and it’s easier for them to use decimal numbers on a computer than binary numbers. But binary is what the computer understands.
So we need a system to convert decimal to binary and perform the calculation using binary numbers and convert the output back to decimal for users.
This binary representation of a decimal number is called the binary coded decimal code or BCD code.
Binary-Coded Decimal (BCD code)
The binary coded decimal is a 4-bit code and each 4-bit code represents one decimal digit from 0 to 9. See the table below
|Decimal Digit||Binary Coded Decimal|
But there are 16 codes because combinations. The codes from to does not matter and are not used in BCD.
The binary and BCD value of 128 is given below for your understanding.
|Binary number for 12810||BCD Code for 12810|
|1000 0000||0001 0010 1000|
Important points to remember
- Decimal number is so on, and BCD code is … It means they are same.
- The binary number is not BCD, there is a difference.
- BCD coded decimal numbers need more bits. See the example above.
When two BCD numbers are added then two things happen
- Sum is less than = decimal
- The sum is equal to or more than decimal
Suppose you add following BCD numbers
The result is a BCD sum and less than .
First Case – when BCD sum does not have a carry
Consider another example
The BCD does not allow 1100 and we need 12 as an answer in BCD. The first digit is 1 and the second digit is 2.There are 16 codes in BCD and we are using only 10 of them.
carry = in BCD carry = in BCD carry = in BCD carry = in BCD carry = in BCD carry = in BCD
Then whenever, you get an invalid BCD sum, add a 0110 = 6 to the result and you will get the correct BCD sum.
Second Case – when BCD sum has a carry
We now look at another case of BCD sum when the result appears to be correct but it has a carry.
In this case, we still add to the 4 least significant bits.
----------------- = carry =
Example – BCD Addition
In this example, we will add two decimal numbers,
John.F.Wakerly. 2008. Digital Design: Principles And Practices, 4/E. Pearson Education, India.
Mano, M. Morris. 1984. Digital Design. Pearson.