Driving a seven-segment display
Four bits in, seven bars out: seven truth tables that share their inputs, with six rows nobody cares about.
Seven bars make a digit
A four bit number is fine for a machine and useless for a person. A seven-segment display is the fix you have seen on every clock radio and petrol pump: seven bars arranged as a figure eight, each one a lamp that is on or off. Light the right bars and the shape is a digit. The bars are lettered a across the top, then b, c and d clockwise round to the bottom, e and f back up the left side, and g across the middle. A 0 is every bar except g; a 1 is just b and c on the right; an 8 is all seven.
Four bits in, seven out
The display wants seven on-or-off signals. What you have is a number, in the usual case one decimal digit written in four bits: 0 is 0000, 9 is 1001. That code is called BCD, binary coded decimal, and it was met in stage 1: each decimal digit gets its own four bits. The circuit between the two is the seven-segment decoder: four inputs, B3 down to B0, and seven outputs, one per bar. Feed it 1001 and bars a, b, c, d, f and g come on, which is a 9.
There is no clever trick in it, which is exactly why it is a good exercise. Segment a is its own boolean function of the four inputs. So is segment b, and so on for all seven. Write a truth table with ten rows, one per digit, four input columns and seven output columns, and each output column is one small design problem you already know how to solve: simplify it and build it. Seven truth tables sharing four inputs, side by side.
The rows nobody cares about
Four bits make sixteen patterns, but a decimal digit only uses ten. The codes 10 to 15, 1010 to 1111, never arrive at a BCD decoder. That means it does not matter what the circuit does for them, and in stage 4 you saw what to do with such rows: mark them as don't cares, and let the Karnaugh map groups grow across them. Every one of the seven expressions comes out shorter than it would if those six rows had to be forced to 0.
Why?: what does the display show for 10 to 15?
Whatever the simplified circuit happens to produce, and nobody designed it. Click the input bits above past 9 and you will see a mix of real digits and shapes that are no digit at all. That is not a fault. Those inputs were promised never to happen, and the freedom to ignore them is what paid for the smaller circuit.
One segment, worked through
Take segment e, the bottom left bar. Look at the digits: it is lit for 0, 2, 6 and 8 and dark for the rest. From that column, with the six spare codes as don't cares, the Karnaugh map gives ¬B2 ∧ ¬B0 ∨ B1 ∧ ¬B0, where B3 B2 B1 B0 are the four input bits, ¬ means NOT, ∧ means AND and ∨ means OR. In words: segment e lights when the bottom bit is 0 and either B2 is 0 or B1 is 1. Notice that B3 does not appear at all; the don't cares let the groups swallow it. Click through the inputs and check it against the list of digits.
Worked example. Which segments light for the digit 4?
Draw a 4 on the figure eight. It has the two right hand bars, b and c, the top left bar, f, and the middle bar, g. No top, no bottom, no bottom left. So the decoder's row for input 0100 has 1s in the b, c, f and g columns and 0s in a, d and e. Four of the seven output functions are 1 on that row.
Common mistake: one output per digit
The decoder does not have ten outputs, one saying "this is a 3" and so on. It has seven, one per bar, and a 3 is simply the pattern a, b, c, d, g being on at once. A circuit with ten one-hot outputs is the decoder from the last lesson, and you could build the display driver from one by ORing the right lines together, but it would be far bigger than the seven simplified expressions.
Build it
Open the seven segment display example in the simulator and trace one segment back from the display to the four switches. Then try designing segment a yourself: write its column of the truth table, mark the six don't cares, and compare your expression with the one on the seven-segment decoder page, which derives all seven.
What to remember
- A seven-segment display is seven lamps, a to g, lettered clockwise from the top with g in the middle.
- The decoder takes a four bit BCD digit and drives seven outputs, one per bar.
- It is seven truth tables sharing four inputs; each output column is designed on its own.
- Codes 10 to 15 never occur, so their rows are don't cares, and every expression gets shorter.
Build it: the seven segment display example in the simulator.
Check yourself
Get 5 right in a row and the lesson is done. A wrong answer costs the run, not the lesson.
A seven-segment display has segments a, c, d, e, f, g lit and the rest dark. Which digit is showing?
acdefg
Already know this? and come back to the quiz any time.