BCD to 7-Segment Display

7-segment-display

What is BCD code?


In computing and electronic systems, binary-coded decimal (BCD) is used to encode decimal numbers (base-10) in a binary form where each decimal digit is represented by a nibble (4 bits).

For instance decimal number 5 is represented as 0101 in BCD as 5 = 4 + 1

8 4 2 1
0 1 0 1

The 16 hexadecimal digits in binary:

Hexadecimal Digit Binary Nibble
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111

Note that, when using BCD (as opposed to Hexadecimal) we only use digits 0 to 9. Numbers larger than 9, having two or more digits in the decimal system, are expressed one digit at a time using on nibble per digit. For example, the decimal number 365 is encoded as:

0011 0110 0101

7-Segment Display


A lot of electronic devices use 7-segment displays (Watch, alarm clock, calculator etc.).
Typically 7-segment displays consist of seven individual coloured LED’s (called the segments). Each segment can be turned on or off to create a unique pattern/combination. Each segment is identified using a letter between A to G as follows:

7-segment-display-connections

The 16 hexadecimal digits can be displayed on a seven-segment display as follows:

BCD to 7-Segment Display: Truth Tables & Karnaugh Maps


We will use four inputs A,B,C and D to represent the four BCD digits as ABCD (A is the most significant digit, D is the least significant digit). When creating an electronic circuit we could use 4 switches to represent these 4 inputs.

We will need 7 outputs one for each segment. So let’s investigate each segment one at a time.

Segment ABCDEFG
Segment A should be on for the following values:

tmp-00000 tmp-00010 tmp-00011 tmp-00101
tmp-00110 tmp-00111 tmp-01000 tmp-01001
tmp-01010 tmp-01100 tmp-01110 tmp-01111

Segment A should be off for the following values:

tmp-00001 tmp-00100 tmp-01011 tmp-01101

Hence the Truth Table for Segment A is as follows:

Inputs Output
A B C D Segment A
0 0 0 0 1
0 0 0 1 0
0 0 1 0 1
0 0 1 1 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1

This Truth table can be represented using a Karnaugh Map:

Karnaugh Map for Segment A

Follow the same process to define the Truth Table and Karnaugh Map of the B segment:

Follow the same process to define the Truth Table and Karnaugh Map of the C segment:

Follow the same process to define the Truth Table and Karnaugh Map of the D segment:

Follow the same process to define the Truth Table and Karnaugh Map of the E segment:

Follow the same process to define the Truth Table and Karnaugh Map of the F segment:

Follow the same process to define the Truth Table and Karnaugh Map of the G segment:

BCD to 7-Segment Display: Boolean Expressions


The Karnaugh maps will help us define the Boolean Expressions associated with each of the 7 segments.

Segment ABCDEFG
Karnaugh Map: Boolean Expression:
Use the Karnaugh Map for the B segment to define the Boolean Expression of the B segment.
Use the Karnaugh Map for the C segment to define the Boolean Expression of the C segment.
Use the Karnaugh Map for the D segment to define the Boolean Expression of the D segment.
Use the Karnaugh Map for the E segment to define the Boolean Expression of the E segment.
Use the Karnaugh Map for the F segment to define the Boolean Expression of the F segment.
Use the Karnaugh Map for the G segment to define the Boolean Expression of the G segment.

BCD to 7-Segment Display: Logic Gates Diagrams


We can now convert each Boolean expression into a Logic Gates circuit to link our 4 inputs (switches) to our 7-segment display using a range of logic gates.
Segment ABCDEFG
Boolean Expression:
Logic Gates Circuit:

Testing


You can now recreate your logic gates circuit using our logic gates studio tool to test if it behaves as expected for all 16 digits.

Use the Boolean Expression of the B segment to draw the logic gates diagram required to control the LED of the B segment.
Use the Boolean Expression of the C segment to draw the logic gates diagram required to control the LED of the C segment.
Use the Boolean Expression of the D segment to draw the logic gates diagram required to control the LED of the D segment.
Use the Boolean Expression of the E segment to draw the logic gates diagram required to control the LED of the E segment.
Use the Boolean Expression of the F segment to draw the logic gates diagram required to control the LED of the F segment.
Use the Boolean Expression of the G segment to draw the logic gates diagram required to control the LED of the G segment.

Hex/BCD to 7-Segment Display Integrated Circuit


integrated-circuitAll these 7 logic gates diagrams can all be integrated into one single integrated circuit: The CD74HCT4511E is a CMOS logic high-speed BCD to 7-segment Latch/Decoder/Driver with four inputs and is used to use these 4 inputs (Hex/BCD nibble) to control the display of a 7-segment display.

Did you like this challenge?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 27

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!