Multiple 8-digit led displays

As I'm still getting to grips with the hardware side of things please would some kind person advise me before I buy.

I would like to attach 3 of these 5V MAX7219 8-Digit Red LED Display Module 7 Segment Digital Tube For Arduino MCU (see Amazon http://www.amazon.co.uk/MAX7219-8-Digit-Display-Segment-Digital/dp/B00IHSE6V6/ref=sr_1_2?ie=UTF8&qid=1402251745&sr=8-2&keywords=max7219) to my Mega 256. Is this possible, and if so how would they be connected (I'm already using pins 2, 3, 18, 19, 20, 21)? Is there a library available which I could use to display both chars and digits (I want to display 3 chars 2 digits point and 3 digits) on each module.

Thanks for any advice.

Those displays don't give easy access to the Dout pin so you can't daisy-chain the displays. You need a separate CS for each but can tie the CLK and DIN pins together.

So to use 3 of these display units with my Arduino Mega 256 I need to use 5 digital outputs - 1 for DIN to all the displays, 1 for CLK to all the displays and 3 for a seperate CS to each display - yes? Can I use any spare digital output pins or do they need to be connected to specified pins?

How would I actually cause them to display the data I want in my program? Are there libraries I can download and use please?

2kaud: So to use 3 of these display units with my Arduino Mega 256 I need to use 5 digital outputs - 1 for DIN to all the displays, 1 for CLK to all the displays and 3 for a seperate CS to each display - yes? Can I use any spare digital output pins or do they need to be connected to specified pins?

Yes, any 5 pins should work

2kaud: How would I actually cause them to display the data I want in my program? Are there libraries I can download and use please?

My guess is that you pull CS low and shift the data out using shiftOut(). http://arduino.cc/en/Reference/ShiftOut Each display will take 8 bytes, each byte representing the pattern of segments to light (7 segments and a decimal point). It may take some experiments to determine what pattern of bits to use to display digits.

johnwasser: Those displays don't give easy access to the Dout pin so you can't daisy-chain the displays.

Oh! So what is the five pin header on the other end with the pin labelled "DOUT" for then?

johnwasser: My guess is that you pull CS low and shift the data out using shiftOut(). http://arduino.cc/en/Reference/ShiftOut Each display will take 8 bytes, each byte representing the pattern of segments to light (7 segments and a decimal point). It may take some experiments to determine what pattern of bits to use to display digits.

It helps to read the datasheet.

You shift in a 16 bit big-endian command at a time, which consists of a "don't care" nibble, a register address nibble and 8-bit data.

Personally, I find it much easier not to use a library.

If you only want decimal digits (and the characters "-", "H", "E", "L", "P" and blank), then you use the built-in decoder.

They chain by sending multiple 16-bit commands within the one strobe, there is a "NOP" command which can be rippled through to modules which you do not want to alter.

Dead easy really. Can supply some code if needed.

Thank you for your helpful answer. I need to display letters other than h, e, l, p (g, n, i [might get away with using l instead]).

I would be most grateful if you would supply some code as kindly offered to get me started. The displays are coming from China so will be a couple of weeks before I'm able to experiment with them.

You can make your own fontArray and use the part in NoDecode mode.
    a
f       b
    g
e       c
    d
[code]
byte fontArray[]={
0b00111111, // 0  bit 7 = not used,  6 = g, 5 = f, 4 = e, 3 = d, 2 = c, 1 = b, 0 = a
0b01110111, // A
}; // etc

These characters would display well:

0,1,2,3,4,5,6,7,8,9 (use upper ‘tail’ on 6, no lower’tail’ on 9)
A,b,C,c,d,E,F,g, H, h, I, i, J, L, n, O (0), o, P, S (5), U, u, -, _

? maybe with f,a,b,c,e segmemts
, maybe with c,d segments

T? maybe with a,b,c segments

M, N, Q, R, V, W, X, Y, Z - hard to do as anything recognizable.

To display:
in setup, write to registers 9-15 with the needed info for:

of characters, No decode mode, normal mode (vs shutdown), # of segments, brightness

Then write a character to address 1 to 8 for the digits. I use SPI for all of this:

// top of sketch need this:
#include <SPI.h>

// in setup you need:
SPI.begin();

// In loop, you do this:
digitalWrite (ssPin, LOW); // D10
SPI.transfer (registerAddress); // 1 to 8 for digits, 9-15 for control setup
SPI.transfer(fontArray[number_to_display]); // index into the array,
// such as 0 for '0' and 1 for 'A' above
digitalWrite (ssPin, HIGH); // output updates after this edge

can also use double lookup:

// write bank1 digits to display
for (x=1; x<9; x=x+1){
digitalWrite (ssPin1, LOW); // D10 -can be any pin, D10 must be an output, thp
SPI.transfer (x); // 1 to 8; SCK from D13, MOSI from D11
SPI.transfer(fontArray[bank1digits[x-1]]); // array index from 0 to 7
digitalWrite (ssPin1, HIGH); // output updates after this edge
}

// write bank 2 digits to display 2
for (x=1; x<9; x=x+1){
digitalWrite (ssPin2, LOW); // D10
SPI.transfer (x); // 1 to 8
SPI.transfer(fontArray[bank2digits[x-1]]); // array index from 0 to 7
digitalWrite (ssPin2, HIGH); // output updates after this edge
}

If have the IO pins available go with discrete ssPins, no messing with NOPs , no wasted time.[/code]

johnwasser: Those displays don't give easy access to the Dout pin so you can't daisy-chain the displays. You need a separate CS for each but can tie the CLK and DIN pins together.

That's true. I analyzed the reasons for this, and here are my results:

There is a bug on the printed circuit layout. Pin #19 of the MAX7218 (Vcc) is connected to a hole, and an the other side of the board this is connected to Vcc. And there is a track from MAX7218 Pin #24 (DOUT) to the DOUT header on the side of the board. Unfortunately, this track has contact to the hole which connects to Vcc. So, DOUT of MAX7218 and the DPUT header are always connected to Vcc. You can fix it like this: Cut the track from Pin #24 twice, at the right and the left side of the hoe near Pin #19. Then solder a wire between Pin #24 and the DOUT header. Voila, now daisy chaining is working like expected.

Another point: when I first used the boarch without the change, it worked (without daisy chaining) but the MAX7218 became quite hot. After the fix (which eliminated the shortcut between DOUT and Vcc), it only became moderately warm. So, even if you don't like to solder, it is highly recommended to cut the track. I suppose with the shortcut, the MAX7218 will not live a long time ...

Still another point: the board uses a diode between the Vcc header on the left side and the inernal Vcc lines. The Vcc on the right header taken from the internal Vcc, so it is lower than Vcc on the left side. So if you do daisy chaining, (a) shortcut the diode on the board or (b) take the Vcc for the next boards from a common supply source.