Digital Clock Design: Part 2 – 7 Segment Display & Truth Table

Digital Clock Design: Part 2 – 7 Segment Display & Truth Table

This is the second article of a series where I go over my process of designing a digital clock.  In this article, we’ll go over what 7-segment displays are and how to creat a truth table for it!

What do you notice about how most digital clocks display their numbers?  You might have seen that each digit is made up of seven lights that are in the shape of an 8.  These lights turn on and off as needed to create the desired number shape.  This is called a 7-segment display.  Here’s my attempt at showing you what I mean using text instead of adding an image.  I’ll probably come back later to add images.  Forgive the weird spacing of all the lines in the meantime:

_ _ _
|           |
| _ _ _ |
|            |
| _ _ _ |

 

So how do we tell our system to send power to specific lights?  Lets dig into it:

We need to be able to count to 9 using a 7-segment display.  Each binary number will be used as a code that can tell our system which lights need to turn on to create a number.  Let’s start by creating a chart of binary numbers that goes up to 9.  We’ll assign each bit a letter so we can refer to it easier

Decimal   |   w x y z   |
0                   0 0 0 0
1                   0 0 0 1
2                   0 0 1 0
3                   0 0 1 1
4                   0 1 0 0
5                   0 1 0 1
6                   0 1 1 0
7                   0 1 1 1
8                   1 0 0 0
9                   1 0 0 1

So this next part may be difficult to show with text.  I may come back and attach a picture to refer to instead. So here’s the text version of that 8 that I showed before.  What we need to do now is assign each section a letter and add it to our chart.  So I’m going to add a letter starting at “a” and go through the alphabet and start assigning letters from the top, going counter-clockwise and ending in the middle with “g”.  You can assign these letters any which way that you want to! Your truth table will look different later on, but that doesn’t mean you are wrong! This is my preferred method, and it’s the method you’ll see most people assign their letters when working with 7-segment displays.

_ _ a _ _
|                  |
f                  b
| _ _ g _ _ |
|                  |
e                  c
| _ _ d _ _ |

 

Here’s that chart we made before again.  Now we are going to add our new letters to the chart.  The next step is to start assigning these letters binary values.  How do we know where to put 0’s and where to put 1’s?  The trick is to look at a digital clock.  When there is a “0” on the screen, which sections are lit up?  Every section except “g” is lit up for the “0”, so we will put 1’s in all of the lit-up sections for the decimal number 0!  Under the chart is another attempt at showing what should appear on our 7-segment display.

Decimal   |   w x y z   |   a b c d e f g
0                   0 0 0 0       1 1 1 1 1 1 0
1                   0 0 0 1
2                   0 0 1 0
3                   0 0 1 1
4                   0 1 0 0
5                   0 1 0 1
6                   0 1 1 0
7                   0 1 1 1
8                   1 0 0 0
9                   1 0 0 1

_ _ _
|            |
|            |
|            |
| _ _ _ |

 

This is what a truth table is!  We’re essentially turning our 4-bit number into a 7-bit code, and that code is what determines which lights turn on and display our number! Let me fill out the remaining numbers and paste the completed truth table below:

Decimal   |   w x y z   |   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 1 1 1 1 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

Okay!  We’ve got all 10 codes for our 7-segment display.  There’s one final thing we need to do before we end here.  We need to add a few more things to our truth table.  You may have noticed that we didn’t use every number that 4 bits can count to.  We are able to count all the way to 15 with 4 bits.  So now we’re going to add the remaining numbers we didn’t use BUT the codes for all of those numbers will be all 0’s, because we don’t expect our 7-segment display to be able to display those numbers.  Every number below the line in the chart is what I refer to as a “dud” or an empty code.  You’ll see why we need to keep all these 0’s in our chart in the next article.

Decimal   |   w x y z   |   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 1 1 1 1 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
__________________________
10                 1 0 1 0        0 0 0 0 0 0 0
11                  1 0 1 1        0 0 0 0 0 0 0
12                  1 1 0 0       0 0 0 0 0 0 0
13                  1 1 0 1        0 0 0 0 0 0 0
14                  1 1 1 0        0 0 0 0 0 0 0
15                  1 1 1 1        0 0 0 0 0 0 0

Now our truth table is complete!

Next Time: Karnaugh Maps and Logic Gate Equations

Like (1)