Seven-Segment Decoder from Logic Gates
A seven-segment display shows a digit by lighting some of its seven bars, a to g. A decoder turns a binary number into which bars to light. This one is built from gates alone — no 74LS47 — and shows the digits 0 to 7 from three switches, C, D and E.
Try it live
This is the Circuit Simulator itself, running in the page — it is LogicsBench's own example design, read-only. Open it full size, and sign in to make your own copy to change.
- Count through all eight inputs and read the digit.
- Ctrl-click (⌘-click on a Mac) a segment line to trace it back to the terms that light it.
Seven-segment decoder truth table
| C | D | E | Digit shown |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 2 |
| 0 | 1 | 1 | 3 |
| 1 | 0 | 0 | 4 |
| 1 | 0 | 1 | 5 |
| 1 | 1 | 0 | 6 |
| 1 | 1 | 1 | 7 |
How it works
a = D + C′E′ + CE (the top bar: on for 0, 2, 3, 5, 6, 7)
Each of the seven segments is its own function of the three inputs: segment a, for one, is off only for 1 and 4.
Several segments need the same product terms, so each term is built once and shared — which is how a real decoder keeps its gate count down.
A 74LS47 (common-anode) or 74LS48 (common-cathode) does all of this in one chip, for the digits 0–9.