Hi guys! I'm new to Arduino and I have trouble understanding the correct wiring of 4 digit 7-segment display (common anode or common cathode) with or without 74hc595 8-bit shift register.
These are the diagrams of common cathode and commom anode 4 digit 7-segment display.
This is the 74hc595 pin diagram.
I want to use multiplexing. Please advise me if what I say is correct:
- When using 4 digit 7-segment display (common cathode): I wire the 4 common cathode pins to output pins, set them all HIGH initially and set a specific one LOW to enable a specific digit. Then I wire the 8 anode pins to 74hc595 and light the leds of a single digit simultaneously (as long as I use small current for each digit led, to account for the fact that 74hc595 has maximum total current 70ma, ideally 6ma for each digit led).
- When using 4 digit 7-segment display (common anode): I've read many tutorials that claim that I can use the reverse procedure from above: use output pins for the 4 common anode pins and then use 74hc595 to sink the 8 cathode pins. However, I can't understand how this can possibly work! Can an output pin provide power for as many as 8 digit leds???
For this I believe I have 2 options:
a) Use output pins for the 4 common anode pins (set them LOW initially) and output pins for the 8 cathode pins (set them HIGH initially), set HIGH an anode pin of a specific digit and then cycle through the 8 digit leds, having only one set LOW at any time, so that only one led is powered each time. In that way, I have to cycle through 4x8=32 leds.
b) Use 5v pin together with 4 PNP transistors to connect them to the 4 common anode pins (so that I have enough power for all 8 leds of a digit to light them simultaneously) and use 74hc595 for the 8 cathode pins.
Do I have any error in my logic?
EDIT: Perhaps I can't even do the common cathode with outpins too and need NPN transistors? How can an output pin set to LOW sink the current of all 8 digit leds?