max7219 with 8x8 matrix

Hello.

Could anyone please help me?
I am trying to create an animation on 8x8 led matrix (NFM-12882BEG-11).
I have wired everything and now led matrix is lighten but it creates a strange pattern... seems that I am not wiring correctly. What I am confused is that my 8x8 led matrix has 12 pins, not 8 pins. So I am not sure to where the rest of pins should be connected?

I have referenced the example on the wiring site:
http://wiring.org.co/learning/examples/hello_matrix.html

Here is photos of how I wired so far:


Also, here is the coding for the arduino:

// pin numbers from a board to a max7219
int dataIn = 2; //datain(pin1 on max) and 2 in arduino
int load = 3;
int clock = 4;

int maxInUse = 1; //here you have to change this varialbe to how many max 7219 you want to use

int e = 0; // just a varialble

// define max7219 registers
byte max7219_reg_noop = 0x00;
byte max7219_reg_digit0 = 0x01;
byte max7219_reg_digit1 = 0x02;
byte max7219_reg_digit2 = 0x03;
byte max7219_reg_digit3 = 0x04;
byte max7219_reg_digit4 = 0x05;
byte max7219_reg_digit5 = 0x06;
byte max7219_reg_digit6 = 0x08;
byte max7219_reg_digit7 = 0x01;
byte max7219_reg_decodeMode = 0x09;
byte max7219_reg_intensity = 0x0a;
byte max7219_reg_scanLimit = 0x0b;
byte max7219_reg_shutdown = 0x0c;
byte max7219_reg_displayTest = 0x0f;

void putByte(byte data) {

byte i = 8;
byte mask;
while(i > 0) {
mask = 0x01 << (i - 1); // get bitmask
digitalWrite( clock, LOW); // tick
if (data & mask){ // choose bit
digitalWrite(dataIn, HIGH); // send 1
}else{
digitalWrite(dataIn, LOW); // send 0
}
digitalWrite(clock, HIGH); // tock
--i; // move to lesser bit
}
}

void maxPut (byte reg, byte col) {

//data = ((data & 0x01) * 256) + data1 >> 1;
//data = (data << 1) + ((data >> 7) & 0x01);
putByte(reg); // specify register
putByte(col); //((data & 0x01) * 256) + data >> 1); // put data
}

void maxSingle( byte reg, byte col) { //maxSingle is the more easy way while just useing one max7219

digitalWrite(load,HIGH); // this funktion will take care of uploading the data
putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data
digitalWrite(load, LOW); // and load da nuts

digitalWrite(load,HIGH);

}

void maxAll (byte reg, byte col) { // put the reg/col information to all the max 7219 in the system

int c = 0;
digitalWrite(load, HIGH);
for ( c =1; c<= maxInUse; c++) {
maxPut(reg, col); // use all 8 columns
}
digitalWrite(load, LOW);
digitalWrite(load,HIGH);
}

void maxOne(byte maxNr, byte reg, byte col) { //maxOne for controling one max7219 of the bulk

int c = 0;
digitalWrite(load, HIGH);

for ( c = maxInUse; c > maxNr; c--) {
putByte(0); // means no opperation
putByte(0); // means no opperation
}

putByte(reg); // specify register
putByte(col);//((data & 0x01) * 256) + data >> 1); // put data

for ( c =maxNr-1; c >= 1; c--) {
putByte(0); // means no opperation
putByte(0); // means no opperation
}

digitalWrite(load, LOW); // and load da nuts

digitalWrite(load,HIGH);
}

void setup () {

pinMode(dataIn, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(load, OUTPUT);

beginSerial(9600);
digitalWrite(13, HIGH);
//////////////////////////////////////////////initiation of the max 7219

maxAll(max7219_reg_scanLimit, 0x07);
maxAll(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits)
maxAll(max7219_reg_shutdown, 0x01); // not in shutdown mode
maxAll(max7219_reg_displayTest, 0x00); // no display test

for (e=1; e<=8; e++) { // empty registers, turn all LEDs off
maxAll(e,0);
}
maxAll(max7219_reg_intensity, 0x0f & 0x0f); // the first 0x0f is the value you can set
// range: 0x00 to 0x0f
}

void loop () {

//------------------------------------ if you use just one max7219 he should look like this

maxSingle(1,1); // + - - - - - - -
delay(1000);
maxSingle(2,2); // - + - - - - - -
delay(1000);
maxSingle(3,4); // - - + - - - - -
delay(1000);
maxSingle(4,8); // - - - + - - - -
delay(1000);
maxSingle(5,16); // - - - - + - - -
delay(1000);
maxSingle(6,32); // - - - - - + - -
delay(1000);
maxSingle(7,64); // - - - - - - + -
delay(1000);
maxSingle(8,128); // - - - - - - - +

delay(1000);

maxSingle(1,1); // + - - - - - - -
delay(1000);
maxSingle(2,2); // - + - - - - - -
delay(1000);
maxSingle(3,4); // - - + - - - - -
delay(1000);
maxSingle(4,8); // - - - + - - - -
delay(1000);
maxSingle(5,16); // - - - - + - - -
delay(1000);
maxSingle(6,32); // - - - - - + - -
delay(1000);
maxSingle(7,64); // - - - - - - + -
delay(1000);
maxSingle(8,128); // - - - - - - - +

delay(1000);

}

Thank you!
wrighy95
[timestamp=1178918543]

Hi

my suggestion would be to rewire it using different-coloured wires. With only two colours, it is very difficult and very time-consuming to find the error.

D

Your numbers confuse me.

...my 8x8 led matrix has 12 pins, not 8 pins...

You will not be directly addressing a matrix of 64 LEDs with 12 pins. I googled your part number and found a picture purporting to be it, with 24 pins. 24 I could believe if it has two colors of LEDs at each matrix position. http://www.nb-flying.com/pdf/LED-dot-matrix.pdf.

Another possibility is that you have a serial interfaced module or some sort of latched interface. That could plausibly have 12 pins. I counted 14 on the SparkFun serial matrix backpack.

There should be 24 pins on the LED matrix.

The pinout for this device is:

PIN FUNCTION
01 Col. 5 Green Cathode (-)
02 Col. 5 Orange Cathode (-)
03 Row. 5 Anode (+)
04 Col. 6 Green Cathode
05 Col. 6 Orange Cathode
06 Row 6 Anode
07 Col. 7 Green Cathode
08 Col. 7 Orange Cathode
09 Row 7 Anode
10 Col. 8 Green Cathode
11 Col. 8 Orange Cathode
12 Row 8 Anode
13 Row 4 Anode
14 Col. 4 Orange Cathode
15 Col. 4 Green Cathode
16 Row 3 Anode
17 Col. 3 Orange Cathode
18 Col. 3 Green Cathode
19 Row 2 Anode
20 Col. 2 Orange Cathode
21 Col. 2 Green Cathode
22 Row 1 Anode
23 Col. 1 Orange Cathode
24 Col. 1 Green Cathode

If I understand what you are trying to do you need to connect the Anodes (pins 3, 6, 9, 12, 13, 16, 19, & 22 -- NOT in this order go by Row #) to pins 14-17 and 20-23 of the MAX 7219.

Then choose either the orange or green cathodes (8 pins) and connect them to 2,3,5-8,10 & 11 of the MAX 7219

If you still have problems generate a manual netlist (pin to pin connection numbers between chips) and post that. It would help identify your problem.