Truth table, segment equations and display resistors
Inputs (click each bit):
Or choose the digit:
A 7-segment display is seven elongated LEDs, named a to g clockwise starting from the top, plus the decimal point (dp). To show a number, the right combination of segments must be lit. The decoder does that translation: it receives a digit in BCD (binary-coded decimal, 4 bits weighted 8-4-2-1, called D, C, B and A in datasheets) and drives the seven outputs.
It is a combinational circuit with 4 inputs and 7 outputs, so each segment is an independent logic function. Since codes 10 to 15 do not exist in BCD, they are treated as don't cares when simplifying, and the equations become much shorter. For example, segment a is off only for 1 and 4:
The tool computes every equation with the Quine-McCluskey method, the same one used by the Karnaugh map. You can build any of them in the logic gate simulator.
If you connect the wrong display type you will see the digit «in negative» (the segments that should be off are lit) or nothing at all.
| IC | Display | Outputs | Codes 10 to 15 | Extras |
|---|---|---|---|---|
| 74LS47 / 74HC47 | Common anode | Open collector, active low | Meaningless symbols | Lamp test (LT), zero blanking (RBI/RBO) |
| 74LS48 | Common cathode | Active high with internal pull-up | Meaningless symbols | Like the 47; supplies little current |
| CD4511 | Common cathode | Active high, up to about 25 mA | Display blanked | Digit latch, LT and blanking (BL) |
| CD4543 | Both, and LCD | Selectable polarity | Display blanked | Suitable for liquid crystal displays |
Some decoders, such as the 47 family, draw the 6 without segment a and the 9 without segment d («without tail»). Untick «6 and 9 with tail» to see it. Today it is common to decode in software on a microcontroller and use drivers such as the MAX7219 or the TM1637, which also multiplex several digits.
Each segment is an LED and needs its own resistor; it is calculated just like an LED resistor:
A single resistor in the common line looks easier, but then brightness depends on the number of lit segments: a 1 (two segments) would look much brighter than an 8 (seven). Also check the total current of digit 8 against the maximum the decoder or the common pin can handle.
Related: multiplexers and demultiplexers, number system converter (BCD) and transistor as a switch for large displays.