Displays come in common-cathode and common-anode versions, and wiring them backwards means all on or all off. This page explains how the a to g plus dp segments are laid out, why the drive level is inverted between the two types, and how to read the segment-code table.
The seven segments are really eight: a to g plus the decimal point dp at lower right. Standard layout has a at top, b upper right, c lower right, d bottom, e lower left, f upper left, g middle bar. A segment code drives each of the eight bits high or low; for example 8 lights a through g, while 1 lights only b and c.
Common-cathode ties all LED cathodes to ground, so light a segment by driving it high; common-anode ties all anodes to plus V, so light a segment by driving it low. The two segment codes are bitwise complements. Wire an anode type with high-level drive and nothing lights at all, so confirm the polarity before buying parts and drawing the board.
Read the segment-code table instead of computing it. Common-cathode codes with dp leading are 0 equals 0x3F, 1 equals 0x06, 2 equals 0x5B, 8 equals 0x7F; common-anode is each value inverted. In multiplexed scans the digit-select pin switches in turn while segment lines are shared, with a current-limit resistor per segment at 5 to 15 mA.
| Digit | Cathode code hex | Anode code hex |
|---|---|---|
| 0 | 0x3F | 0xC0 |
| 1 | 0x06 | 0xF9 |
| 2 | 0x5B | 0xA4 |
| 3 | 0x4F | 0xB0 |
| 8 | 0x7F | 0x80 |
| All on | 0x7F | 0x80 |
Confirm display polarity before drawing the board; reversed wiring leaves it dark. Multiplex needs digit-current limiting and a refresh above 50 Hz or it flickers visibly.
The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Display devices per GB/T 4728 and IEC 60748. Always check the device datasheet and the product design file for ratings and derating.
Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.