Go Down

Topic: Scrolling text on LED matrices using SPI and arduino Mega2560 (Read 8 times) previous topic - next topic

Aaron_dyer

Ya in my previous posts, I realize the SPI pinouts just need to be changed since I am using the Mega 2560.. (No worries on that, I know the pinouts for SPI)

When I said cascaded, I just meant   Arduino -> data in Max7219   data out  ->  data in Max7219   data out  ->   

and so fourth like in this playground site:

http://www.arduino.cc/playground/Main/MAX72XXHardware#Wiring

I have an enclosure with the 8 x 32 display, a 40 x 2 LCD, a reset and an up down button for "volume control" I wanted to make it like a speaker type box with lots of lights / displays...I will take a video and show it to you soon....

all thats left is getting this SPI integration right....I am working on the PCB layout of the Max7219s right now....

Aaron_dyer

Ok with your code...you have:

byte ss0 = 10; //MSB
byte ss1 = 9;
byte ss2 = 8;
byte ss3 = 7; // LSB


now on the mega2560   SS is pin 53     so what does the above mean?

Aaron_dyer

Crossroads,

Man I would love to know what you mean by

byte ss0 = 10; //MSB
byte ss1 = 9;
byte ss2 = 8;
byte ss3 = 7; // LSB


I realize on the Uno board you have SS is pin 10  but pins 9, 8, and 7 aren't SPI pinouts...

I know the MSB and LSB = Most and least significant Bits.....

so heres a guess I'll throw out there....so for the Mega 2560  SS is pin 53.  so we know this:

SPI pin outs used for this on the Mega 2560 are: SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS)   



so if i were to wire it up and define the pinMode as:

ss0 = 53 // MSB     
ss1 = 49     
ss2 = 48   
ss3 = 47  // LSB          (because 52 -50) are the other SPI pinouts needed....

would that work?

Aaron_dyer

One more thing Crossroads,

I watched your display on the youtube video...

The  "Howdy do boys? This ones for you"

where was that in your code?

CrossRoads

This part in the pre-setup tab

byte ssOutput = 10;
byte ss0 = 7; //MSB -> easy to plug a header into Arduino
byte ss1 = 6;
byte ss2 = 5;
byte ss3 = 4; // LSB

You need the SS pin of the SPI group to be an output. I starte with 10-9-8-7, but then realized a header didn't fit across the gap, so I left 10 alone and moved the 4 non-cascaded SS pins to 4-5-6-7 instead.
Mine aren't cascaded - so connect the SS pin 53 to the first chip & go from there. SCK, MOSI, MISO are 13-12-11, but SPI library takes care of those so no pinMode is needed for them, only for the SS pin. The SS pin needs to be an output for the device to be SPI master, even if you are not using it for SPI.
You could use any 4 pins you wanted on the Mega, so 47-48-49-53 would be fine if you uncascade them.

The message - it's not in the code!  I enter it from the Serial monitor.
You can then enter SSS and it will save it to EEPROM along with the message size. After a power loss, or a reset, it checks for a saved message, if one exists it loads it from EEPROM into the displayArray and then starts displaying it. If  you then enter PPP it wipes the size stored in EEPROM and you enter a new message.

I think the one I posted will also let you add to the end of a saved message, and then saves the whole array to EEPROM again.
Or maybe not, and that was something I was fixing still.  No complicated math here, just playing with pointers into an array.

I am thinking now how to save the message as just the hex value of the character, and store that in EEPROM instead of the message itself, will let the message be 1021 characters long instead of just 170 characters.
If not storing in EEPROM, you can change arraySize to 1500  and store about 240 characters but the message is lost on power loss or reset.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up