BCD to 7-Segment Decoder: From Numbers to Display
TL;DR: A BCD to 7-segment decoder takes a 4-bit binary-coded-decimal digit (0–9) and lights the right combination of segments a–g on a digital display. The mapping is defined by a 10-row truth table; each segment’s boolean expression is derived from the table and minimized using K-maps, then implemented in a chip like the 74LS47 (common anode) or 74LS48 (common cathode).
The seven-segment display is the most recognizable output device in digital electronics — clocks, microwaves, calculators, scoreboards, and old gas pumps all use it. Behind every digit on the screen is a small combinational circuit that turns a 4-bit number into a 7-bit pattern of which LEDs to light. That circuit is the BCD to 7-segment decoder, and it is one of the cleanest practical applications of Boolean algebra and Karnaugh maps.
This post defines BCD, lays out the segment-naming convention, builds the truth table, derives the boolean equations for each segment, contrasts common-anode with common-cathode wiring, and points to the 74LS47 / 74LS48 chips that implement the whole thing. The simulator templates referenced at the end let you wire one up by hand.
What Is BCD?
BCD — Binary-Coded Decimal — is an encoding that uses 4 bits to represent each decimal digit 0 through 9. Unlike straight binary, BCD wastes the codes 1010 through 1111 (decimal 10–15): they are simply not used.
| Decimal digit | BCD (4 bits) | A B C D |
|---|---|---|
| 0 | 0000 | 0 0 0 0 |
| 1 | 0001 | 0 0 0 1 |
| 2 | 0010 | 0 0 1 0 |
| 3 | 0011 | 0 0 1 1 |
| 4 | 0100 | 0 1 0 0 |
| 5 | 0101 | 0 1 0 1 |
| 6 | 0110 | 0 1 1 0 |
| 7 | 0111 | 0 1 1 1 |
| 8 | 1000 | 1 0 0 0 |
| 9 | 1001 | 1 0 0 1 |
| 10–15 | 1010–1111 | unused (don’t-cares) |
The convention used in this post: A is the most-significant bit, D is the least. Some textbooks use the opposite order; the equations are identical with relabeling.
Why BCD instead of straight binary? Two answers: (1) decimal digits map directly to display segments, so converting binary to decimal for display is unnecessary; (2) financial and timekeeping arithmetic is exact in BCD because powers of ten are representable without rounding. The cost is about 17 % more bits per digit compared with packed binary.
The 6 unused codes — 1010 through 1111 — become don’t-care entries when minimizing the segment equations. Treating them as “either 0 or 1, whichever simplifies the gate count” is a major source of the savings that K-map analysis produces.
The Seven Segments
A standard 7-segment display has seven LEDs arranged like an 8, conventionally labeled a through g:
┌─── a ───┐
│ │
f b
│ │
├─── g ───┤
│ │
e c
│ │
└─── d ───┘
ais the top horizontal bar.bis the upper-right vertical.cis the lower-right vertical.dis the bottom horizontal.eis the lower-left vertical.fis the upper-left vertical.gis the middle horizontal.
A decimal digit lights a specific subset:
| Digit | Segments lit |
|---|---|
| 0 | a, b, c, d, e, f |
| 1 | b, c |
| 2 | a, b, d, e, g |
| 3 | a, b, c, d, g |
| 4 | b, c, f, g |
| 5 | a, c, d, f, g |
| 6 | a, c, d, e, f, g |
| 7 | a, b, c |
| 8 | a, b, c, d, e, f, g |
| 9 | a, b, c, d, f, g |
DigiSim’s SEVEN_SEGMENT_DISPLAY component takes seven inputs in this exact order; the DIGIT_DISPLAY is a higher-level abstraction that takes the 4-bit BCD input directly and handles decoding internally.
The Full Truth Table
Combining the BCD encoding with the segment mapping gives one table with 16 rows (10 valid + 6 don’t-cares) and 7 segment columns:
| ABCD | digit | a | b | c | d | e | f | g |
|---|---|---|---|---|---|---|---|---|
| 0000 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| 0001 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 0010 | 2 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 0011 | 3 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
| 0100 | 4 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 0101 | 5 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 0110 | 6 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 0111 | 7 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 1000 | 8 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1001 | 9 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1010 | — | × | × | × | × | × | × | × |
| 1011 | — | × | × | × | × | × | × | × |
| 1100 | — | × | × | × | × | × | × | × |
| 1101 | — | × | × | × | × | × | × | × |
| 1110 | — | × | × | × | × | × | × | × |
| 1111 | — | × | × | × | × | × | × | × |
The table assumes active-high segments — a 1 means the LED is lit. Real chips are split between active-high (common-cathode) and active-low (common-anode); the truth table is the same, the inverter is in the output stage.
Deriving the Segment Equations
Each segment column above is one Boolean function of four inputs. With 6 don’t-care rows, the K-map minimization gives much shorter expressions than a naive sum-of-products. The technique is the Sum of Products method with K-map reduction.
Segment a
Segment a is on for digits 0, 2, 3, 5, 6, 7, 8, 9 — and off for 1, 4. With the don’t-cares treated optimally, K-map minimization gives:
(Here means NOT B; some books write it .) The term — both B and D are zero — covers the 0 and 2 cases efficiently; — both ones — covers 3, 5, 7, 9; alone covers 8 and 9 (and the don’t-cares 10–15); alone covers 2, 3, 6, 7.
This expression uses one AND per product term and a single OR to combine them. Two AND gates and one 4-input OR — a handful of transistors.
Segment b
Segment b is on for 0, 1, 2, 3, 4, 7, 8, 9 — off for 5, 6. K-map gives:
Segment c
Segment c is on for 0, 1, 3, 4, 5, 6, 7, 8, 9 — off only for 2. K-map gives:
This is the simplest of all — only three terms because there is only one zero-output row and the don’t-cares fill the rest of the map.
Segment d
Segment d is on for 0, 2, 3, 5, 6, 8, 9 — off for 1, 4, 7. K-map gives:
Segment e
Segment e is on for 0, 2, 6, 8 — off for 1, 3, 4, 5, 7, 9. K-map gives:
Note both terms share — equivalently . Even digits are necessary for e (segment e is off whenever ), but not sufficient: digit 4 has yet e is off because both and for that input. The factored form uses only 2 AND gates plus one OR.
Segment f
Segment f is on for 0, 4, 5, 6, 8, 9 — off for 1, 2, 3, 7. K-map gives:
Segment g
Segment g — the middle bar — is on for 2, 3, 4, 5, 6, 8, 9 — off for 0, 1, 7. K-map gives:
These seven boolean expressions are the canonical results that have appeared in textbook treatments and the actual silicon of the 74LS47/48 since the 1970s. Implementing them in DigiSim is a matter of dropping seven small AND/OR networks behind a 4-bit BCD input bus.
Common Anode vs Common Cathode
The 7-segment display itself comes in two physical wirings. They differ in which side of every LED is shared with a single common pin.
Common Cathode
All seven LED cathodes (negative terminals) are tied together to a single common pin connected to ground. Each anode is driven separately. To light a segment, drive its anode high.
- Driver output: active-high —
1lights the segment. - Truth table interpretation: matches the table above directly.
- Companion chip: 74LS48 — outputs are active-high.
Common Anode
All seven LED anodes are tied together to a single common pin connected to V_CC. Each cathode is driven separately. To light a segment, pull its cathode low.
- Driver output: active-low —
0lights the segment. - Truth table interpretation: invert every output column.
- Companion chip: 74LS47 — outputs are active-low (open-collector).
For the same boolean equations, the only thing that changes is whether you put an inverter at each output. Modern designs typically use common-cathode displays with active-high drivers because GPIO outputs source current more cleanly than they sink it.
The 74LS47 and 74LS48
The 74LS47 and 74LS48 are TTL chips from the 1970s that implement the entire BCD-to-7-segment function on a single piece of silicon. Pinout is identical between the two; only the output polarity differs.
| Chip | Output polarity | Display type |
|---|---|---|
| 74LS47 | Active-low (open-collector) | Common anode |
| 74LS48 | Active-high (with internal pull-ups) | Common cathode |
Both chips also include three useful auxiliary inputs:
- LT (Lamp Test): Pulled low to force all seven outputs on, regardless of the BCD input. Used to verify every LED is functional.
- RBI (Ripple Blanking Input): Pulled low along with BCD input
0000to blank the display instead of showing 0. Used to suppress leading zeros in multi-digit displays —00073becomes73. - BI/RBO (Blanking Input / Ripple Blanking Output): Bidirectional — input function blanks the display when pulled low; output function asserts low when this digit is blanked, which then drives the next digit’s RBI to continue the leading-zero suppression chain.
Together those three pins enable cascading multiple decoder/display pairs into a multi-digit numeric display where leading zeros automatically vanish.
The behavior for invalid BCD inputs (1010–1111) is chip-defined and produces idiosyncratic non-digit segment patterns — useful as a debugging signal but not portable.
Real-World Applications
The BCD-to-7-segment decoder appears in nearly every device with a numeric display:
- Digital clocks — six digits (HH:MM:SS), each driven by a decoder fed from a counter chain. The seconds counter is a modulo-60 counter built from cascaded BCD counters.
- Calculators — eight to twelve digits multiplexed at high frequency. Only one decoder chip is needed because the BCD inputs are switched between digits 1000+ times per second; persistence of vision makes them all appear lit at once.
- Multi-digit voltmeters and frequency counters — a counter feeds a BCD-encoded register, the register feeds the decoder, and the decoder lights the segments.
- Score boards and odometers — same multiplexing trick, often with brighter LED arrays.
Build It in DigiSim
Open the DECODER component to see the general-purpose decoder building block. For the BCD-to-7-segment specific case, drop a DIGIT_DISPLAY — which has the conversion baked in — or build the decoder by hand and feed the seven outputs to a SEVEN_SEGMENT_DISPLAY.
Wire four input switches as A, B, C, D (most significant to least). Implement segment a first using the equation above:
- Two AND gates: one for , one for .
- One 4-input OR combining , , and the two AND outputs.
Toggle the switches through the BCD codes 0–9 and verify segment a lights in the correct cases. Then add segments b through g following the equations above.
The next post in the combinational track — BCD: Binary-Coded Decimal Fundamentals — covers BCD addition, the half-carry adjustment, and packed vs unpacked BCD storage. Read alongside Decoders and Encoders Driving a 7-Segment Display for the broader story of how a few binary inputs select one display pattern out of many.