3
\$\begingroup\$

I'm trying to hookup a common anode 4-digit 7-segment LED array to my Arduino via a Max7221 IC.

Here's a hard-to-see (sorry!) pinout for my LED array (my LED array is the bottom common anode one, LFC0566XXX)

Here's the datasheet for the Max7221 IC that I'm using.

I was following a tutorial on the Arduino Wiki and it said that the Max7221 will not work with common anode LED arrays like the one I have. However, the comments on the Max7221 Sparkfun product page say that it is possible to use it:

You can drive common anode displays with this chip just fine. It has 8 cathode outputs and 8 anode outputs. The only thing you lose is the BCD-7 segment decoder, which would work strangely hooked up to a common anode 7 segment display. But if you’re just telling the chip which segments to light directly, it’ll work just fine either way.

How can I connect my LED array to the Max7221?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

I do not believe you can reasonably run your display (or any multi-digit common anode display) using this chip. You may be able to finagle it to drive a single digit display through some creativity by hard-wiring the common anode to VCC and not connecting any of the DIG pins of the chip.

The way the chip works is that the SEG* pins "source current to the display" and the DIG* pins "sink current from the display common cathode". The way it's meant to be wired is that the common cathode of each digit on the 7SD is wired to a corresponding DIG pin and the SEG pins are wired to the corresponding anode segment pins of the 7SD. You serially load up "what should be displayed" into the memory of the chip and some configuration settings and it takes it from there.

The chip "scans" the 7-segment display for you and does this by, for each digit N:

  • switching the DIG N pin to GND (and all other DIG pins to high-impedance).
  • setting all the SEG pins to what is stored in its memory (optionally decoding the stored value as BCD first)
  • then moving on to digit N+1 modulo the number of digits its scanning...

There's just no way you are going to be able to take advantage of the chip's multiplexing algorithm because it relies on the DIG pins driving the common cathode to GND to "enable" each digit in turn.

You could insert an inverting buffer between all the SEG and DIG pins of the chip and the display and then you would communicate with the chip and wire it up "normally" as though it was a common cathode display. Not worth it if you ask me...

\$\endgroup\$
2
  • \$\begingroup\$ Hmm... good point. I guess I'll just give in and get a common cathode display! :D \$\endgroup\$
    – Michael
    Commented Dec 25, 2011 at 2:48
  • \$\begingroup\$ I had a good look at the datasheet and this is also the conclusion I came to - not sure what they were on about on Sparkfun, though one guy does say he got it to work (not sure how well though ;-) ) If you could drive any combination of the DIG pins it would be possible, but the datasheet only mentions selecting one at a time for each segment enable.. \$\endgroup\$
    – Oli Glaser
    Commented Dec 25, 2011 at 7:14
1
\$\begingroup\$

Note that a 8 digit display is symmetric - all the digit pins connect to eight LEDs each, and all the segment pins connect to eight LEDs each. On a four digit display, the four digit pins connect to eight LEDs and the eight segment pins (including decimal point or colon) connect to four LEDs each. The difference between 'common anode' and 'common cathode' is whether the digit pins connect to the anode or cathode.

So as far as the chip is concerned, in individual segment mode, there isn't a difference between common anode and common cathode eight digit displays or 8x8 grid displays - it would drive 8 banks of 8 LEDs with each source pin and sink pin combination. Four digit displays either have half the digits missing, or the segments missing if you wire them up the other way round. The chip is also used with 8x8 LED grids, which again are 8 pins going to one side of 8 LEDs and 8 other pins going to the other side of 8 LEDs.

For the common anode, you reverse the roles of the pins and registers, so the chip's seg outputs connect to the display's digit pins and visa-versa. Writing 0xff to the first d' igit register instead of turning on all segments in the first digit, turns the first segment on in all digits. You can't use BCD and have to set scanning as 8 digits as you have 8 segments spread across the registers, so it's more like driving half an 8x8 grid display than a digit based display.

It's easier to buy common cathode instead given the relative prices of the chip and LED displays.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.