When the digit is wrong
A seven-segment digit is its own debugger: every wrong picture points at one cause. Dark is power or LATCH, the same wrong shape every time is bit order, the gaps lit instead of the digit is a common-anode table, random segments are swapped wires, and dim is 3.3 V.
Read the digit
The sketch meant to show 2. Pick what the digit shows instead:
Dark. No power, or the latch never rises. With VCC and GND right, the digit only changes when LATCH goes from LOW to HIGH, so a LATCH wire on the wrong pin looks exactly like a dead board.
The same wrong shape every time. Bit order. 0x5B sent LSBFIRST arrives as 0xDA: the dot lit, the shape mirrored. Change the one word.
Everything but the digit. A common-anode table. Every bit is flipped, so the segments that should be dark are lit and the 2 is drawn in the gaps.
Random segments. DATA and CLOCK swapped, or a pin number that is not the one wired. The chip clocks whenever DATA changes and shifts in whatever it finds. On an ESP32, a sketch left with the Uno's numbers uses pins the ESP32 needs for its flash.
Dim. VCC is 3.3 V. That is right beside a 3.3 V board, and it gives each segment less than half the current 5 V would. VCC sets the current has the numbers.
Check in this order
- GND-1 to GND and VCC-2 to your logic supply. NC-3 empty.
- LATCH-4, CLOCK-5 and DATA-6 to the pins the sketch names, not swapped.
- Send 0xFF for a moment: all eight lit shows every segment and joint works.
- Send 0x5B: a 2 shows the table and the bit order agree.
When it does not work
Send 0xFF for a moment, which lights all eight. A segment that stays dark then is on the board, not in the sketch: a cracked joint on one of the digit's legs or its resistor. Look at the back for a dull or missing joint.
Normal. Nothing clears the 595 at power-up on this board, so it shows whatever it woke up holding until the sketch writes its first byte. The book's sketch writes 0 in setup to blank it.
Keep the five wires together and short: CLOCK is an edge, and a long loose wire can ring and give the chip two edges for one. Under 30 cm of jumper wire is a sensible start.
They share LATCH. Give each its own LATCH pin and raise only the one you mean. DATA and CLOCK can be shared.
Four digits and a colon on two wires, with a driver chip that does the multiplexing for you.
Four digits: the TK51 →Edit this page — content/books/hc595-segment-led/when-the-digit-is-wrong.mdx
Questions about this product
See what other owners have asked, and read their solutions.
74HC595 Segment LED
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.