Pages: [1] 2   Go Down
Author Topic: Max72XX scrolling text code  (Read 5993 times)
0 Members and 1 Guest are viewing this topic.
Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that Nick
Logged


Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.32 KB - downloaded 123 times.)
* MAX7219.zip (4.98 KB - downloaded 93 times.)
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.81 KB - downloaded 54 times.)
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Riva,

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

Pedro
Logged


Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

http://www.gammon.com.au/forum/?id=11516

 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  smiley-mr-green one two char sketch is displaying correctly but others are still reacting as initially described ?
« Last Edit: September 29, 2012, 09:22:36 pm by Pedro147 » Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Show your code please.
Logged

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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  smiley )
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: September 29, 2012, 10:01:02 pm by Nick Gammon » Logged

Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 514
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Pages: [1] 2   Go Up
Jump to: