Max72XX scrolling text code

I came across this code on the forum for Max 7221 for scrolling text.

http://arduino.cc/forum/index.php/topic,22305.0.html

I believe that the 7221 and 7219 are very similair and I only currently have the 7219 so if this code works with the 7221 is it conceivable that it would also work with 7219.
In the link to Youtube the uploader says that "It currently does not work with Arduino 1.0 only 0023." Obviously I am currently using Arduino 1.0 but I would like to try the code out. My question is can I have two different versions of the Arduino IDE installed on my computer at once and just use the version applicable to the code that I wish to run. The only other thought that I had was that I think that I read that previous versions of the IDE used .pde rather than .ino files If this is indead the case, and version 023 requires .pde files, do I just copy and paste the code into the Processing text editor which will and save it as .pde and then copy and paste that into the Arduino IDE.

Thanks for reading Pedro.

Yes, I have both versions installed, in different folders.

Thanks for that Nick

A quick look and only thing I can see that would make it not work on v1.0+ is the LedControl library and AFAIK it has since been updated to be 1.0+ compatible. Attached is a demo code I did for 2x MAX7219 chips arranged as a 16x8 matrix. I have since updated it to kern the fonts but don't have the code here with me at work.

ScrollTest2.ino (13.3 KB)

MAX7219.zip (4.98 KB)

Thanks Riva iI would like to try your latest code for 2x MAX7219 chips arranged as a 16x8 matrix and would it be possible to give me a copy of the schematic,
thank you Pedro

Pedro147:
Thanks Riva iI would like to try your latest code for 2x MAX7219 chips arranged as a 16x8 matrix and would it be possible to give me a copy of the schematic,
thank you Pedro

I had attached the test code and it's library to the previous post but the final code that also does kerning and all other relevant files/info including schematics are in this thread http://arduino.cc/forum/index.php/topic,118338.0.html
Due to the layout of the 16x8 matrix I have, the font was doubled in width from a 5x7 to 10x7. I have attached the kerning test code using the 5x7 font but it's output was written to drive a Rainbowduino but should be relativity easy to adapt to the MAX7219.

ScrollTest3.ino (13.8 KB)

Thanks Riva,

I have seen your impressive clock before and I forgot about it and the code so thanks again,

Pedro

Hello Riva,

I just got around to trying your ScrollTest2 code for the Max7219. Very impressive work and thank you so much for sharing all your hard work,

Pedro.

Pedro147:
I just got around to trying your ScrollTest2 code for the Max7219. Very impressive work and thank you so much for sharing all your hard work

No problem. Community is about sharing and helping.

I am having a little trouble with a Max 7219 controlling an 8 x 8 LED matrix. I have previously constructed one as a hardwired cicuit so I know that the code and circuit schematic (Nick Gammons) are good.

I am now trying to cascade two 7219's and have built a second circuit on a breadboard to connect up to the aforementioned hardwired circuit but the problem that I am having is that when I upload a sketch to the breadboard circuit (which at this stage is a standalone circuit) it displays the first character perfectly (so the matrix is correctly wired) and then nothing unless I press reset or upload the code again. I have checked my wiring ,and that the one polarised 10 mf cap is correct etc but cannot find a problem. Any clues would be appreciated,

Pedro.
Update - now the problem gets more Gremlinesque :grin: one two char sketch is displaying correctly but others are still reacting as initially described ?

Show your code please.

It is your code from the link I posted in the question Nick -

#include <SPI.h>
#include <avr/pgmspace.h>
#include "font.h"



 // define max7219 registers
const byte MAX7219_REG_NOOP        = 0x0;
const byte MAX7219_REG_DIGIT0      = 0x1;
const byte MAX7219_REG_DIGIT1      = 0x2;
const byte MAX7219_REG_DIGIT2      = 0x3;
const byte MAX7219_REG_DIGIT3      = 0x4;
const byte MAX7219_REG_DIGIT4      = 0x5;
const byte MAX7219_REG_DIGIT5      = 0x6;
const byte MAX7219_REG_DIGIT6      = 0x7;
const byte MAX7219_REG_DIGIT7      = 0x8;
const byte MAX7219_REG_DECODEMODE  = 0x9;
const byte MAX7219_REG_INTENSITY   = 0xA;
const byte MAX7219_REG_SCANLIMIT   = 0xB;
const byte MAX7219_REG_SHUTDOWN    = 0xC;
const byte MAX7219_REG_DISPLAYTEST = 0xF;
 

void sendByte (const byte reg, const byte data)
  {    
  digitalWrite (SS, LOW);
  SPI.transfer (reg);
  SPI.transfer (data);
  digitalWrite (SS, HIGH); 
  }  // end of sendByte
 
 
void letter (const byte c)
 {
  for (byte col = 0; col < 8; col++)
    sendByte (col + 1, pgm_read_byte (&cp437_font [c] [col]));
 }  // end of letter
 
void showString (const char * s, const unsigned long time)
{
  char c;
  while (c = *s++)
    {
    letter (c); 
    delay (time);
    letter (' ');  // brief gap between letters
    delay (10);      
    }
}  // end of showString

void setup () {
 
  SPI.begin ();
    
  sendByte (MAX7219_REG_SCANLIMIT, 7);   // show all 8 digits
  sendByte (MAX7219_REG_DECODEMODE, 0);  // using an led matrix (not digits)
  sendByte (MAX7219_REG_DISPLAYTEST, 0); // no display test
  
  // clear display
  for (byte col = 0; col < 8; col++)
    sendByte (col + 1, 0);

  sendByte (MAX7219_REG_INTENSITY, 7);  // character intensity: range: 0 to 15
  sendByte (MAX7219_REG_SHUTDOWN, 1);   // not in shutdown mode (ie. start it up)
                                        
}   // end of setup
 
void loop () 
 {
 showString ("PEDRO ", 600);
 }  // end of loop

There seems to be no pattern to this problem, some code displays ok and some doesn't. It is definitely a hardware or Arduino sofware issue IMHO (extremely humble :slight_smile: )

Can you describe the problem in more detail? You have two LED matrices, right? One connected to one 7219 and the other to the other 7219? And how have you connected to the two 7219s together?

When you say "some code displays ok" can you be more explicit?

Your code displays "PEDRO" so do you see "P" on one and "E" on the other? Or what, exactly?

I do have one circuit hardwired that works perfectly ok. I am now constructing exactly the same circuit on a breadboard so I can eventually daisy chain the two together to scroll text effectively as a 16 x 8 matrix. The circuit on the breadboard is the problem one in so far as it works with one ( two character) code example (using your code with what I want displayed in showString) but another block of exactly the same code but with different characters in showString, briefly displays the first character of showString and the the display remains blank.

I am having a little trouble with a Max 7219 controlling an 8 x 8 LED matrix. I have previously constructed one as a hardwired cicuit so I know that the code and circuit schematic (Nick Gammons) are good.

If you have the 2x MAX7219 chips wired as per my clock schematic then the ScrollTest2.ino posted above is configured for a pair of MAX7219 chips and should work okay.

Thanks Riva,

yes as soon as I get the second circuit working I will be trying your code with the two matrices connected together, but until then I still have this hardware problem,

Pedro.

Pedro147:
yes as soon as I get the second circuit working I will be trying your code with the two matrices connected together, but until then I still have this hardware problem,

Is it a hardware problem? you say it displays a couple of characters okay using one piece of code but with a different bit of code it displays just one character then nothing. The ScrollTest2 code should also work fine with a single MAX7219 chip, how does that look if you upload it to the arduino connected to the breadboard matrix.
Do you have both capacitors on the MAX7219 chip and a suitable IREF resistor value for your particular type of LED's

MAX7219demo1.ino (2.97 KB)

Hi Riva,

Yes I have the two caps, 10 ?f and 0.1 ?f on pin 19 of the 7219 and my LED matrix has Rset resistor value of 28k ohms 2.01 v forward voltage and although there is no reference to the DC forward current in the datasheet (Chinese Ebay matrices) I am settling on a conservative 20 mA.

I have exactly the same circuit built up on veroboard and have no problems with it. As stated this is an intermittent problem where one piece of code will display ok and then if I upload a different code example I then have this problem of it only displaying the first character and then nothing. I have swapped the 7219 for another new one that I have but the problem remains. It certainly is a mystery.

Maybe your getting crosstalk between the breadboard wires. Keep the DIN, LOAD & CLK short and if possible away from the SEG & DIG wires.
It could also be power related. Ensure your PSU can deliver the power needed. Maybe setting LED intensity to 1 lc.setIntensity(address,ledIntensity) or increasing IREF value will allow the sketch to run and you would then know problem it's power related.

Thank you for those diagnostic tips Riva, I will try all your suggestions tommorow and see if that helps [damn electrical Gremlins at it again :slight_smile: ]