Unit 4
Unit 4
The BCD stands for Binary Coded Decimal Number. In BCD code, each digit of
the decimal number is represented as its equivalent binary number. So, the LSB
and MSB of the decimal numbers are represented as its binary numbers.
There are many methods or techniques which can be used to convert code from
one format to another. We'll demonstrate here the following
Calculating BCD Equivalent. Convert each digit into groups of four binary digits
equivalent.
Result
(11101)2 = (00101001)BCD
Questions:
Convert 10110110 to BCD format
(1 * 2^7) + (0 * 2^6) + (1 * 2^5) + (1 * 2^4) + (0 * 2^3) + (1 * 2^2) + (1 * 2^1) + (0 * 2^0)
= (128) + (0) + (32) + (16) + (0) + (4) + (2) + (0) = 182
BCD: 0001 1000 0010
1. (10110)2 = ( ? )BCD
Solution:
(10110)2 = (_______)BCD
∴ (10110)2 = (22)10
2 2
0010 0010
∴ (22)10 = (00100010)BCD
∴ (10110)2 = (00100010)BCD
2. (10011)2 = ( ? )BCD
Solution:
(10011)2 = (_______)BCD
1 9
0001 1001
∴ (19)10 = (00011001)BCD
∴ (10011)2 = (00011001)BCD
BCD to Binary Conversion
he process of converting BCD code into Binary is opposite to the process of
converting Binary code into BCD. There are the following steps to convert the BCD
code into Binary:
In the first step, we will convert the BCD number into a decimal by making the
four-bit groups and finding the equivalent decimal number for each group.
In the last step, we will convert a decimal number into Binary using the process of
converting decimal to binary number.
Steps
Calculating Decimal Equivalent. Convert each four digit into a group and get
decimal equivalent for each group.
Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7/2 3 1
Step 4 3/2 1 1
Step 5 1/2 0 1
Result
(00101001)BCD = (11101)2
BCD to seven-segment LED code conversion
The Binary Coded Decimal (BCD) encoding method uses binary patterns to
encode each decimal value (from 0 to 9), generally of 4-bits.
1. Common Cathode Type (CCT) - This form of the display works by connecting
all seven of the LEDs' cathodes to ground or -Vcc (thus, common cathode),
which causes the LEDs to display numbers when a "HIGH" signal is applied to
each anode.
2. Common Anode Type (CAT) - The seven LEDs in this display have all seven
of their anodes linked to a battery or +Vcc, and when a 'LOW' signal is applied
to each individual cathode, the LEDs display numbers.
The separate LED segments of a seven-segment display are not directly powered.
However, for it to function, we first convert our decimal number to its BCD equivalent
signal, and then a BCD to seven-segment decoder converts that signal into the form
supplied to the seven-segment display.
The seven-segment decoder, which has four input lines and seven output lines
(a, b, c, d, e, f, and g), receives this BCD (A, B, C, and D) input. The output is
provided to a seven-segment LED display that shows the decimal number depending
on the inputs.
The truth table of Common Cathode Type BCD to the seven-segment decoder is
given below:
A B C D A b C d e f G
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
Important points:
1. For a seven-segment LED display of the Common Anode type, all we need to
do is swap all of the '0's and '1's on the output side, i.e., for a, b, c, d, e, f, and
g, swap all of the '1's for '0's, and use k-map to solve.
2. In the above truth table, the combinations of inputs represent the digits from
0 to 1.
3. The range of BCD numbers is 0 to 9, and the rest of the inputs are invalid.
The input lines for Zero are A = 0, B = 0, C = 0, and D = 0 and in the output lines, a
to f are 1 and only g = 0. So, the g LED display will not glow, and the rest of the LEDs
will glow, and we get zero on display.
For Decimal Number = 2
The input lines for two are A = 0, B = 0, C = 1, and D = 0; in the output lines, a, b, d,
e, and g are 1 and c and f are zero. So, only a, b, d, e, and g will glow, and we get two
on display.
Karnaugh Maps Simplification
For other combinations of input, the output is “don’t care X” as there are no more
digits to display. We will derive the expression for each output using Karnaugh map
(K-MAP).
For output a:
For output b:
For output c:
For output d:
For output e:
For output f:
For output g:
BCD Addition
Steps of BCD Addition
Step 1: Add the two BCD numbers using the rules for binary addition.
Step 2: If a 4-bit sum is equal to or less than 9, it is a valid BCD number.
Step 3: If a 4-bit sum is greater than 9 or if a carry-out of the 4-bit group is
generated, it is an invalid result. Add 6 (0110) to the 4-bit sum in order to skip the
six invalid BCD code words and return the code to 8421. If a carry results when
6 is added, simply add the carry to the next 4-bit group.
Example 1: Find the sum of the BCD numbers 01000011 + 00110101
Solution:
In the above example, all the 4-bit BCD additions generate valid BCD numbers, which means
less than 9. So, the final correct result is 7810 = 01111000BCD.
Let’s take an example where the addition generates an invalid BCD number.
In BCD (Binary Coded Decimal) addition, 6 is added to the result of an addition when the result is
larger than 9. This is because the maximum value that can be counted in a BCD nibble (4 bits) is
16, while the maximum value in BCD is 9. The difference between 15 and 9 is 6.
Solution:
In the above example, both the BCD code addition generated result larger than 9, so invalid. To
get the correct result, we added 6 (0110 2) to both the invalid sum. Notice that the carry generated
from the left group is forwarded to the right group. The final correct result is 110 10 =
000100010000BCD.
Solve
BCD Subtraction