CircuitNote

Quick electronics calculators for lab work and circuit design. Free, no sign-up, works in your browser.

Values accept SI prefixes. Examples: 4.7k 4k7 100n 10u 20mA 1M

7SEG

7-Segment Display Decoder

Pick 0–F to see which segments light, the BCD input, and the hex byte to send from a microcontroller.

Segment names and cautions

Going clockwise from the top the segments are a, b, c, d, e, f, with g in the middle. A common-cathode display lights on High, a common-anode one on Low. BCD decoder ICs such as the 74LS47 only show 0–9 as digits, draw 6 and 9 without tails (no a or d), and show odd symbols for 10–15. Each segment needs its own current-limiting resistor.

Worked example: the segment code for 2

  1. The digit 2 lights the top (a), upper right (b), middle (g), lower left (e) and bottom (d) → a b d e g
  2. In the order g f e d c b a with lit = 1: 1 0 1 1 0 1 1 → common-cathode code 0x5B
  3. A common-anode display lights on Low, so invert every bit → 0xA4

7-segment code table for 0–F

DigitLit segmentsDCBAg f e d c b aCommon cathodeCommon anode
Digit0Lit segmentsa b c d e fDCBA0000g f e d c b a0 1 1 1 1 1 1Common cathode0x3FCommon anode0xC0
Digit1Lit segmentsb cDCBA0001g f e d c b a0 0 0 0 1 1 0Common cathode0x06Common anode0xF9
Digit2Lit segmentsa b d e gDCBA0010g f e d c b a1 0 1 1 0 1 1Common cathode0x5BCommon anode0xA4
Digit3Lit segmentsa b c d gDCBA0011g f e d c b a1 0 0 1 1 1 1Common cathode0x4FCommon anode0xB0
Digit4Lit segmentsb c f gDCBA0100g f e d c b a1 1 0 0 1 1 0Common cathode0x66Common anode0x99
Digit5Lit segmentsa c d f gDCBA0101g f e d c b a1 1 0 1 1 0 1Common cathode0x6DCommon anode0x92
Digit6Lit segmentsa c d e f gDCBA0110g f e d c b a1 1 1 1 1 0 1Common cathode0x7DCommon anode0x82
Digit7Lit segmentsa b cDCBA0111g f e d c b a0 0 0 0 1 1 1Common cathode0x07Common anode0xF8
Digit8Lit segmentsa b c d e f gDCBA1000g f e d c b a1 1 1 1 1 1 1Common cathode0x7FCommon anode0x80
Digit9Lit segmentsa b c d f gDCBA1001g f e d c b a1 1 0 1 1 1 1Common cathode0x6FCommon anode0x90
DigitALit segmentsa b c e f gDCBA1010g f e d c b a1 1 1 0 1 1 1Common cathode0x77Common anode0x88
DigitBLit segmentsc d e f gDCBA1011g f e d c b a1 1 1 1 1 0 0Common cathode0x7CCommon anode0x83
DigitCLit segmentsa d e fDCBA1100g f e d c b a0 1 1 1 0 0 1Common cathode0x39Common anode0xC6
DigitDLit segmentsb c d e gDCBA1101g f e d c b a1 0 1 1 1 1 0Common cathode0x5ECommon anode0xA1
DigitELit segmentsa d e f gDCBA1110g f e d c b a1 1 1 1 0 0 1Common cathode0x79Common anode0x86
DigitFLit segmentsa e f gDCBA1111g f e d c b a1 1 1 0 0 0 1Common cathode0x71Common anode0x8E

Codes use the bit order dp g f e d c b a (a is the least significant bit) with the decimal point off. BCD decoders such as the 7447 show different shapes for 10–15.

Using it in practice

Step by step

  1. Choose common cathode or common anode to match your display.
  2. Pick a digit from 0 to F and see which segments light, the BCD input and the byte to send.
  3. Check the bit order the tool uses against how you wired segments a to g to your port.

Common mistakes

  • Wrong display type. A common-anode display lights a segment when its pin is pulled low, so every bit is inverted compared with common cathode. If your digits look like negatives, this is why.
  • One resistor in the common lead. With a single shared resistor, the brightness changes with the number of lit segments (an 8 is dimmer than a 1). Use one resistor per segment.
  • Pairing the wrong decoder. The 7447 has active-low outputs for common-anode displays; the 7448 and CD4511 drive common-cathode displays.

Practical tips

Segments are labelled a to g clockwise from the top, with g in the middle and dp for the decimal point. Pinouts vary between display models, so find the common pins with a meter on diode test before wiring. To drive several digits, multiplex: light one digit at a time fast enough (above roughly 100 Hz per digit) that the eye sees them all, and raise the segment current to make up for the shorter on-time.

Frequently asked questions

What hex codes show 0–9 on a common-cathode display?

With bit 0 = a through bit 6 = g: 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F. For a common-anode display invert the bits (0xC0 for 0).

Why does my 74LS47 show strange symbols for 10–15?

The 74LS47 is a BCD decoder: it is designed for 0–9 only, and inputs 10–15 produce fixed special patterns rather than A–F. Use a microcontroller or a hex decoder to show A–F.