I have got my single 7x5 matrix going OK using Crossroads example from last year.
Unfortunately when I laid out my PCB, I have my rows in the wrong order for the MD_MAX or other libraries.
( I havn't connected to the 14, 16, and 21 pins of the MAX )
As you can see from the sketch below, I have made a start on the array for my characters - I have made the pattern for "G" to display on my arrays.
I am having trouble getting my head around the daisychaining for the next matrix.
It would appear I could just take the CS low, send out the setup data twice, and take the CS high again.
To send the character pattern would appear to be the same, but I just can't seem to get it to the second matrix ( which has all the LEDs lit at the moment.)
I dont want to use a separate CS line for each matrix, as there will be quite a lot of matrices matrii ?.
Can anyone suggest what to do as per the test sketch below ? ( I have removed all my useless attempts - this just displays one "G" )
#include <SPI.h>
byte ss0 = 10;
byte x;
// define variables
// bytes to send to MAX7219s, with some initial data
byte displayArrayG[] = { 0x13,0x88,0x80,0x80,0x99,0x88,0x13 };
// char letter[] = {'A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S'
// ,'T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','.','-',' ','t' };
// define 7219 register addresses for setup
byte NOOP = 0x0;
byte decode_mode = 0x09; // 0x00 = No decode for digits 7-0
byte intensity_level = 0x0A; // 0x08 = mid level. Range is 0x00 to 0x0F
byte scan_limit = 0x0B; // 0x07 for all columns
byte shutdown_normal = 0x0C; // 0x00 - shutdown, 0x01 = normal
byte display_test = 0x0F; // 0x00 = normal, 0x01 = display test mode all on full
// ************************************ //
void setup(){
pinMode (ss0, OUTPUT);
digitalWrite (ss0, HIGH);
Serial.begin(9600);
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV8);
/* set up MAX7219 registers */
// decode to No decode mode
digitalWrite (ss0, LOW);
SPI.transfer (decode_mode);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
Serial.println("No decode mode");
// intensity to mid level
digitalWrite (ss0, LOW);
SPI.transfer (intensity_level);
SPI.transfer (0x0f);
digitalWrite (ss0, HIGH);
Serial.println("Intensity");
// scan limit to all 7 columns
digitalWrite (ss0, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x06);
digitalWrite (ss0, HIGH);
Serial.println("Scan Limit");
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
delay(200);
Serial.println("Display test on");
// dispay test to normal
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
delay(200);
Serial.println("Display test off");
// shutdown to Normal mode
digitalWrite (ss0, LOW);
SPI.transfer (shutdown_normal);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
Serial.println("Normal mode");
delay(250);
Serial.println("setup done");
}
void loop(){
delay(1000);
for (x = 1; x<9; x=x+1){ // clear display
digitalWrite (ss0, LOW);
SPI.transfer (x); // row
SPI.transfer(0x00);// array 0 to 7
digitalWrite (ss0, HIGH);
}
for (x = 1; x<8; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (x);
SPI.transfer(displayArrayG [x-1]);// array 0 to 7
digitalWrite (ss0, HIGH);
}
} // end loop