A simple display (4 digit) using a shift register.
A couple of points:
1) Pull the OE (output enable) pin to ground either in code or in hardware.
2) Multiplex needs to be called regularly - ideally use an interrupt - as per demo. However it could be called in a loop (with a delay). Something like 240Hz is ideal. Setting up a timer interrupt for each MCU is slightly tricky - so left to the user here.
3) Multiplex bit-bangs the data to the shift register. I tested on an Arduino (16MHz) - there is a a chance that some MCUs might be too fast - add some 1uS delays (in the code but disabled here) I've not tested this - it might cause issues on some MCUs (esp32) depending on how the delay is implemented in FC.
4) The display needs to be connected to the shift register segment A to Qa - B to Qb etc with dp to Qh. Assuming standard segment layout. For common cathode the component inverts the data - not tested (I don't have any displays like this) - polarity can be set in properties.
The Display macro takes a decimal point position - and attempts to 'pad' with 0s rather than have leading spaces (so 0.001 not "0. 1" or " . 1")
Negative numbers are not handled (nor the possible 7 seg character set (A, B, C, E, H, L etc)))
It simulates (sort of) - the 2d panel component just displays the value...
Martin
SN74HC595 Multiplexed 7 seg LED display
-
mnfisher
- Valued Contributor
- Posts: 1866
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 884 times
SN74HC595 Multiplexed 7 seg LED display
- Attachments
-
- SN74Display.fcpx
- (2.94 KiB) Downloaded 63 times
-
- SN74_Test.fcfx
- (10 KiB) Downloaded 62 times
-
- ShiftReg.fcfx
- (22.23 KiB) Downloaded 71 times
-
andeug
- Posts: 71
- Joined: Thu Jan 07, 2021 1:42 pm
- Location: Stockholm (SE)
- Has thanked: 24 times
- Been thanked: 2 times
Re: SN74HC595 Multiplexed 7 seg LED display
Martin, thank you very much for the time invested in creating this component - I know it came due to the challenges I have experienced with the multiplexed display from my digital clock project. At the moment, I am experiencing some troubleshooting with my project and a lack of time, so please accept my apologies if I don't respond as often to the topic(s).
One question - how do you deal with SN74HC595 (your component) vs. TPIC6595 (the component from my clock project)?
The two chips do not use an inverted LUT, but they do differ in how their outputs behave electrically, and that’s what often creates the impression of “inverted logic”. The SN74HC595 is a logic-level shift register with push‑pull outputs, while the TPIC6595 is a power shift register with low‑side DMOS switches. Because the TPIC6595 sinks current instead of sourcing it, the effective logic at the load can appear inverted even though the internal storage bits are not.
Core functional difference
SN74HC595
• 8‑bit shift register + latch
• Push‑pull CMOS outputs
• Output pin goes HIGH = +V, LOW = 0V
• Drives LEDs or logic directly in the “normal” way
• No inversion in the output stage
TPIC6595
• 8‑bit shift register + latch
• Low‑side DMOS drivers (open‑drain style)
• Output pin goes LOW = conducts to ground, HIGH = off
• Designed to sink current from loads connected to +V
• Loads turn ON when output = LOW, OFF when output = HIGH
---
🎛 Why it feels like the logic is inverted
The internal bit stored in both chips is interpreted the same way (1 = “on”, 0 = “off”), but:
• On the SN74HC595, “1” drives the output pin high, turning on a load connected to ground.
• On the TPIC6595, “1” turns the DMOS transistor off, so the output pin floats high and the load turns off.
• A “0” on the TPIC6595 turns the transistor on, pulling the output low and turning the load on.
So the load behavior is inverted, even though the logic inside the shift register is not.
---
Practical implications
• If you migrate code from SN74HC595 → TPIC6595, your LEDs or loads will turn on/off in the opposite way unless you invert the bits in software.
• The TPIC6595 is ideal for high‑current sinking (relays, LEDs, motors), while the SN74HC595 is for logic‑level or low‑current loads.
• Electrically, the TPIC6595 behaves like eight N‑MOSFET low‑side switches controlled by a shift register.
One question - how do you deal with SN74HC595 (your component) vs. TPIC6595 (the component from my clock project)?
The two chips do not use an inverted LUT, but they do differ in how their outputs behave electrically, and that’s what often creates the impression of “inverted logic”. The SN74HC595 is a logic-level shift register with push‑pull outputs, while the TPIC6595 is a power shift register with low‑side DMOS switches. Because the TPIC6595 sinks current instead of sourcing it, the effective logic at the load can appear inverted even though the internal storage bits are not.
SN74HC595
• 8‑bit shift register + latch
• Push‑pull CMOS outputs
• Output pin goes HIGH = +V, LOW = 0V
• Drives LEDs or logic directly in the “normal” way
• No inversion in the output stage
TPIC6595
• 8‑bit shift register + latch
• Low‑side DMOS drivers (open‑drain style)
• Output pin goes LOW = conducts to ground, HIGH = off
• Designed to sink current from loads connected to +V
• Loads turn ON when output = LOW, OFF when output = HIGH
---
🎛 Why it feels like the logic is inverted
The internal bit stored in both chips is interpreted the same way (1 = “on”, 0 = “off”), but:
• On the SN74HC595, “1” drives the output pin high, turning on a load connected to ground.
• On the TPIC6595, “1” turns the DMOS transistor off, so the output pin floats high and the load turns off.
• A “0” on the TPIC6595 turns the transistor on, pulling the output low and turning the load on.
So the load behavior is inverted, even though the logic inside the shift register is not.
---
• If you migrate code from SN74HC595 → TPIC6595, your LEDs or loads will turn on/off in the opposite way unless you invert the bits in software.
• The TPIC6595 is ideal for high‑current sinking (relays, LEDs, motors), while the SN74HC595 is for logic‑level or low‑current loads.
• Electrically, the TPIC6595 behaves like eight N‑MOSFET low‑side switches controlled by a shift register.
FC11 Professional + ARD + ARM license + Matrix TSL E-blocks2 boards
Mikroe Click boards + Click Shield for ST Nucleo-32 + Clicker 4 for ST STM32F407VG
Mikroe Click boards + Click Shield for ST Nucleo-32 + Clicker 4 for ST STM32F407VG
-
mnfisher
- Valued Contributor
- Posts: 1866
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 884 times
Re: SN74HC595 Multiplexed 7 seg LED display
Hi Andreas,
You'd mentioned both shift registers and I had some of the SN74 chips....
The modifications should be fairly trivial - Multiplex handles all the output details - so there a few options:
1) Alter the lookup table
2) Invert the data - I attempted to do this if enable pin active was high rather than low - but .data = ~.data inverts a value.
3) Invert the value using an electronic component (a transisitor?) - I'm very much an electronics newbie....
However, do you need to invert at all if on is gnd and off is 1?
Martin
You'd mentioned both shift registers and I had some of the SN74 chips....
The modifications should be fairly trivial - Multiplex handles all the output details - so there a few options:
1) Alter the lookup table
2) Invert the data - I attempted to do this if enable pin active was high rather than low - but .data = ~.data inverts a value.
3) Invert the value using an electronic component (a transisitor?) - I'm very much an electronics newbie....
However, do you need to invert at all if on is gnd and off is 1?
Martin