2-Digit 7-Segment LED with switch registers

I'm working on a project that will entail at least 5 2-digit 7-segment LED displays. The units are common cathode. There are 8 pins (1-4 and 6-9) for each of the digits and dec. place, and two pins (5 & 10) to pick which digit to turn on. Basically you connect the 5 or 10 pins to ground. I've gotten the basics on using output switch registers to control multiple leds (74HC595), so I'm going to use that for the LED segments, but I'm not sure if I can use the same one to handle essentially closing the ground/cathode side, or do I need to use an input switch register, such as the 74HC165?

No. You really are making life difficult for yourself, and the result will be a least a little dissapointing even if you did make it work. You need an ht16k33 module, or at least a couple of max7219 chips.

MAX7219 with a 10K resistor, 0.1uF cap, 10uFcap; or 5 of 74HC595, five 0.1uF caps, and 35 (to 40 if using decimal points) current limit resistors.

Don't forget wirewrap sockets if building up on perfboard.

MAX7219 will make like very easy. Wire all the A lines together, all the Bs, etc. to the MAX7219 Segment pins. Then each cathode to a Digit pin. Couple of SPI.transfer()s to set up the 5 command registers in setup(), then two more each time to update an output:

digitalWrite (ssPin, LOW); // D10 usually
SPI.transfer (registerAddress); // 1 to 5 for 5 digits
SPI.transfer(dataToDisplay); // using the built in font map
digitalWrite (ssPin, HIGH); // selected register gets updated

Or do the same for each 74HC595, with a unique ssPin for each chip.

digitalWrite (ssPin, LOW); // D10 usually
SPI.transfer(fontMap[dataToDisplay]);
digitalWrite (ssPin, HIGH); // selected register gets updated

with fontMap containing the bits to segment mapping

byte fontMap[] = {
0b00111111, // 0 DP-g-f-e-d-c-b-a
0b00000110, // 1
// etc
};

Segment layout:
a
f b
g
e c
d DP

Ordered a couple of MAX7219. Documentation looks pretty straight forward. Thanks for the pointers.

First, thanks for pointing me to the MAX7219. I have that working. I have 4 3-digit displays, so I'm putting 2 displays on 2 processors. This leaves me with two unused DIG per MAX7219, I want to use them to drive 4 LEDs on the buttons. Can I just connect the LED circuit to them? And from what I'm reading, the typical resistor you'd need for an LED isn't necessary because the ISET controls the output voltage, right?

mc2software:
First, thanks for pointing me to the MAX7219. I have that working. I have 4 3-digit displays, so I'm putting 2 displays on 2 processors.

When you say "2 processors", I trust you mean two MAX7219. We would call them LED drivers, not processors. :grinning:

mc2software:
This leaves me with two unused DIG per MAX7219, I want to use them to drive 4 LEDs on the buttons. Can I just connect the LED circuit to them? And from what I'm reading, the typical resistor you'd need for an LED isn't necessary because the ISET controls the output voltage, right?

Given that the LED connections on the buttons are entirely separate from the button contacts, incorporating them into the LED matrix is a very sensible approach. They will be driven exactly as the LEDs in the digits with their current controlled in the same manner, they are just part of the matrix.

Although the data sheet refers to them as drivers, the LedControl library refers to them as controllers, and since I've been following their library convention throughout my programming, I'll stick with that for now.

Since the controller is designed to work with common cathodes, I'll going to connect the two led cathodes to DIG3 and use the SEG G and SEG DP for anodes, since there are library functions to illuminate those single segments.

mc2software:
Since the controller is designed to work with common cathodes, I'll going to connect the two led cathodes to DIG3 and use the SEG G and SEG DP for anodes, since there are library functions to illuminate those single segments.

Well that is of course just how you connect extra LEDs as the "digit" drivers are cathode drivers and the "segment" drivers are anode drivers.

It is not entirely accurate to say that "the controller is designed to work with common cathodes". It works perfectly with common anode displays. The only two advantages are that it provides a limited optional decoding function for driving common-cathode 7-segment displays with binary byte values, and that you need differently structured code to drive common-anode 7-segment displays.

"This leaves me with two unused DIG per MAX7219, I want to use them to drive 4 LEDs on the buttons. "

Yes, just connect them up as if they were 4 segments of a 7-segment digit.
Anodes to A,B,C, D, and then a common cathode to one of the unused Digit pins. Then one register address can be used to address all 4, and you still have room to expand to two more digits in the future.

Or, if you are not using Decimal point on other digits, you can use those to drive an LED instead.

Paul__B:
It is not entirely accurate to say that "the controller is designed to work with common cathodes". It works perfectly with common anode displays. The only two advantages are that it provides a limited optional decoding function for driving common-cathode 7-segment displays with binary byte values, and that you need differently structured code to drive common-anode 7-segment displays.

That's good to know that it works with common anode displays. I was going by what the data sheet said in the General Description, which says that the MAX72XX is a common-cathode display driver.

I first tested with just one controller and one display. After if worked, I went to two processors and 4 display. It didn't work. I then went back to one controller, one display. Now nothing is working. I noticed a wiring problem and fixed it, but I'm wondering if there's a way to test the MAX7219 to make sure I didn't fry it.

if there's a way to test the MAX7219 to make sure I didn't fry it.

print
"8.8.8.8.8.8.8.8."

that should switch on every LED.

You can also write to the Display Test register.

"The display-test register operates in two modes: normal
and display test. Display-test mode turns all LEDs on
by overriding, but not altering, all controls and digit registers
(including the shutdown register). In display-test
mode, 8 digits are scanned and the duty cycle is 31/32
(15/16 for MAX7221). Table 10 lists the display-test register
format."

Writing 0x00 to register 0x0F puts the MAX7219 in Normal mode, and 0x01 puts in in Display Test mode.

digitalWrite (ssPin, LOW); // latch signal
SPI.transfer (0x0F); // display test register
SPI.transfer (0x01); // 1 = test on, 0 = normal mode
digitalWrite (ssPin, HIGH);

That worked. Didn't fry it. I think I'll add a component one-at-a-time, first a second LED, then a second MAX7219.