CRUMB
Not enough ratings
4-bit binary number to BCD to 7-segment display
By Maodaifu
A simplified guide to introduce the binary to BCD to 7-segment conversion.
   
Award
Favorite
Favorited
Unfavorite
Overview
This guide will include the basic theories of BCD and 7-segment display. The simplified boolean expressions of the circuit will be shared.

Contents:
  • Codec (Encoder and Decoder)
  • Binary to Binary Coded Decimal (BCD)
  • BCD to 7-segment display
  • Summary
  • Conclusion

*Note: This guide assumed you already have basic understanding of K-map, boolean algebra and binary number.
Codec (Encoder and Decoder)
In electronics, we sometime will use encoder to convert a set of data into another set of data. Encoder is a combinational circuits that perform the conversion. Decoder is a combinational circuits that reverse the conversion. In this guide, we want to convert a binary number to BCD.
The table below is the truth table of the binary to BCD conversion.



As you can see from the table, the binary and BCD share the same data from 0 to 9. However, when binary number is 1010 (10 in decimal), we need 2 BCD set to represent the decimal 10, which is 0001 0000.
Another example, 15 is 0001 0101. In binary 0001=1 and 0101=5. This is because one set of BCD can only represent the number 0-9. So conveniently speaking, 1 set of BCD represents one digit in decimal number.

The diagram below is the block diagram of this guide, we need to build 2 converter, binary to BCD and BCD to 7-segment.

Binary to Binary Coded Decimal (BCD)
Firstly, we need to refer to the truth table of the conversion.


From table we can see that we need 2 set of BCD to represent 4-bit binary number. Firstly, we can simplify the circuit by using K-map. The simplified boolean expressions of the BCD is shown below.



In BCD_1, we can see that B3=B2=B1=0. This is because we will never get 1 (or HIGH) in these bits. So we can just connect them to 0 (or LOW).

The boolean expression of each bit is simplified using K-map.
BCD to 7-segment display
***IMPORTANT: The ABCD in this part is referring to BCD, not the initial 4-bit binary number before the conversion.

After obtained the BCD, we can now construct the BCD to 7-segment display. The table below shows the BCD to 7-segment display truth table. The truth table is built using the common cathode configuration.



The output is based on the number we want to display. For example, 1001 is nine. So based on the 7-segment display, we need to turn on a,b,c,d,f and g to show "9".

Next, we need to again, simplify the expression using K-map. But, this time we can put "don't care" in K-map to further simplify our expression. All outputs from 1010 to 1111 will be "don't care" or "X" in this truth table. This is because we are using BCD and we will never encounter the input from 1010 to 1111 unless you did something wrong in binary to BCD conversion.

In K-map, "1" is essential and "X" is not essential. Because "1" is essential so we must circle all of them in order to get the expression. But "X" is not essential so we can choose not to circle "X" when it doesn't help us in further simplifying the expression.

For example, this is the K-map for output "a". The "1" MUST be circled.



The solution of the K-map will be:



So, the expression of "a" is:
a = C+A+B'D'+BD

The summary of the expressions for BCD_0 are:


For BCD_1, we can replace A,B,C=0 (A',B',C'=1).
So the expression will be:



So now you can build the BCD to 7-segment display circuit using these expressions.
Summary
Here are the summary of the expressions for you to refer

4-bit Binary to BCD:


BCD to 7-segment:


Extra:
The picture below is a 5-bit binary to BCD truth table and expressions.
Disclaimer: I haven't verify the expressions through simulation. The expressions are obtained by using Quine Mccluskey's method.





BCD to 7-segment circuit from 4-bit conversion can be reused for 5-bit as well. But BCD_1 you need to redo the simplification by replacing the A and B with "0".
Conclusion
Thank you for reading this guide. I hope this guide can ease your works in your project. Please leave a comment if you need any helps. =)
6 Comments
kenpeter 15 Jan @ 6:19am 
Hexidecimal Table for EEPROM 3F 06 5B 4F 66 6D 7D 07 7F 67 77 7C 39 5E 79 71
Frog Bomber 30 Nov, 2024 @ 1:27pm 
I did a lab for this in class once! one of the most frustrating breadboards i've dealt with lol
Maodaifu  [author] 25 Feb, 2023 @ 6:16pm 
Yea, you can use the EEPROM and there is an example for that in the game.
kenpeter 25 Feb, 2023 @ 11:46am 
Or program the table to CRUMB's 28C16 EEPROM.
a miserable pile 7 Jan, 2023 @ 9:48am 
Thank you for your work
Maodaifu  [author] 11 Dec, 2022 @ 11:25pm 
This is my last guide for now. There is no further planning for more guides. Anyway, have fun. =)