EN

BCD to 7-segment decoder

Truth table, segment equations and display resistors

Simulator

Decoder and display

Inputs (click each bit):

Or choose the digit:

Level of each output

Segment resistors

Display supply
V
V
mA
V

Minimal equation of each segment

Complete truth table

What a BCD to 7-segment decoder is

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:

\[ a = D + B + C\,A + \overline{C}\,\overline{A} \]

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.

Common anode or common cathode

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.

Decoder ICs

ICDisplayOutputsCodes 10 to 15Extras
74LS47 / 74HC47Common anodeOpen collector, active lowMeaningless symbolsLamp test (LT), zero blanking (RBI/RBO)
74LS48Common cathodeActive high with internal pull-upMeaningless symbolsLike the 47; supplies little current
CD4511Common cathodeActive high, up to about 25 mADisplay blankedDigit latch, LT and blanking (BL)
CD4543Both, and LCDSelectable polarityDisplay blankedSuitable 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.

Resistors: one per segment

Each segment is an LED and needs its own resistor; it is calculated just like an LED resistor:

\[ R = \frac{V_{CC} - V_F - V_{\text{out}}}{I_{\text{seg}}} \]

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.