the photo
I have tried the code (cleaned up) with 20 modules (all that I have) and it seems to work ok both forward and backwards. Code is attached below for reference.
The only things I can think of at this stage is that the length of the SPI CLK signal wire creates a marginal signal that fails. This can happen and requires that a conditioning buffer be placed on the signal lines at various intervals (in your case I would say half way). One way to verify this is to look at the signal with an oscilloscope and see what shape it is in at the end of the line.
There is also a way of making the LD signal more reliable using a pull up resistor.
All this you can find through Google.
// MD_MAX72XX_Message_Serial library example to scroll text on the display
#include <MD_MAX72xx.h>
#include <SPI.h>
#define DEBUG 0
#define MOVE_FORWARD 1 // select if moving forward or backward
#if DEBUG
#define PRINTS(s) { Serial.print(s); }
#define PRINT(s,v) { Serial.print(s); Serial.print(v); }
#else
#define PRINTS(s)
#define PRINT(s,v)
#endif
//--------------------------------------------------------------------
// I PUT MY NUMBERS IN THE FONT
// wheel numbers from 0 to the right (mirrored) starting at font position 200
const char CHAR_RouRECHTS[] = "\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC";
// wheel numbers from 0 to the left starting at font position 160
const char CHAR_RouLINKS[] = "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4";
//--------------------------------------------------------------------
#define MAX_DEVICES 20
#define CLK_PIN 13 // or SCK
#define DATA_PIN 11 // or MOSI
#define CS_PIN 10 // or SS
MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);
#define SCROLL_DELAY 75 // in milliseconds
#define CHAR_SPACING 1 // pixels between characters
char *curMessage; // current message being printed
uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
// Callback function for data that is required for scrolling into the display
{
static char *p = curMessage;
static uint8_t state = 0;
static uint8_t curLen, showLen;
static uint8_t cBuf[8];
uint8_t colData;
// finite state machine to control what we do on the callback
switch (state)
{
case 0: // Load the next character from the font table
PRINTS("\nSTATE 0");
showLen = mx.getChar(*p++, sizeof(cBuf) / sizeof(cBuf[0]), cBuf);
curLen = 0;
state++;
// if we reached end of message, reset the message pointer
if (*p == '\0')
p = curMessage;
// !! deliberately fall through to next state to start displaying
case 1: // display the next part of the character
PRINTS("\nSTATE 1");
colData = cBuf[curLen++];
if (curLen == showLen)
{
showLen = CHAR_SPACING;
curLen = 0;
state = 2;
}
break;
case 2: // display inter-character spacing (blank column)
PRINTS("\nSTATE 2");
colData = 0;
curLen++;
if (curLen == showLen)
state = 0;
break;
default:
state = 0;
}
return (colData);
}
void scrollText(void)
{
static uint32_t prevTime = 0;
// Is it time to scroll the text?
if (millis() - prevTime >= SCROLL_DELAY)
{
#if MOVE_FORWARD
mx.transform(MD_MAX72XX::TSL);
#else
mx.transform(MD_MAX72XX::TSR); // HERE I CHANGE IN ......TSR // TSL works fine !!!
#endif
prevTime = millis(); // starting point for next time
}
}
void setup()
{
#if DEBUG
Serial.begin(57600);
#endif
PRINTS("\n[Roulette Debug]");
mx.begin();
mx.setShiftDataInCallback(scrollDataSource);
#if MOVE_FORWARD
curMessage = CHAR_RouLINKS;
#else
curMessage = CHAR_RouRECHTS;
#endif
}
void loop()
{
scrollText();
}
Oh Marco - if I may say so - that code just looks wonderful !!
Thank you for testing, I will try later this day
IF (its not working with the 37) { I will try the pull up resistor . } // (pull up or pull down ??)
ELSE
{ I will get my 40 years old HAMEG Osziillloskop from the attic and look at the signals}
but there is no "end" of the clk-signal here , all clk pins in the circle are simply wired together,
CS too, and all "37" working just fine in case of TSL.
But that's just thinking and first I have to try your code. I will give you the news.
But that reminds me :
Is there a place somewhere in the code where I can place a counter so that I new the
last position of the numbers ??
Thanks again.
Should be pull up on the CS/LD line.
CLK and CS should be ok wired in to the modules in parallel, but you may also want to try not in parallel. DI/DO is only between individual modules.
The other thing you can also try is fewer modules and build up the numbers to see if there is a point when’re it starts to fail.
As for the counter, i am not sure what you mean. If you stop shifting it will remember where it was before you stopped and start from there when you start again.
Hi Marco, thanks for your answer
Your sketch is working fine but just TSL, TSR is the same as before,
maybe there a mystical border above 32 ...
and I made a mistake with that in not paying enough attention to the following
of the numbers on the 37 displays with TSL. Somehow the show was not correct
last to first number, after the 0 the 28 were coming up instead of the 26,
(see photo and font.cpp if you like), 4 numbers missing ...
spacing was 1 ; setting it to 0 was bringing just one number to the circle pro round ...
After some hours with try and error I found out that if I set state to 0 in case 1
all the numbers coming correct to the displays (see Photo). I' am glad ....
because at stop point all displays must show one number in full (readable).
case 1: // display the next part of the character
PRINTS("\nSTATE 1");
colData = cBuf[curLen++];
if (curLen == showLen)
{
showLen = CHAR_SPACING;
curLen = 0;
state = 2; XXXXX HERE I HAVE PUT state=0 with char_spacing on 0
Then I tried with TSR and various resistors for termination, tried breaking the CS and or the clk Line
between last and first display, tried parallel and not parallel but all to no avail, it was always the same .... TSL working fine - just now since three hours without leaving one dot ...
TSR working fine too but only on the five last displays 33,34,35,36,37 starting on 33.
Trying with fewer modules would be "dangerous" because it was really difficult to place the 37 Modules
so exactly on the plexi pane (1,5 mmm), behind the white paper sheet and behind the print of the cover and the glass pane 3 mm and GLUE and solder it all together ...
So that leaves to build in a bus driver in the middle of the circle.
I will take some Oszilloskop measures before I try this,I have a 74HC541 driver here,
that will do the work I think ... but I'am a little bit scared because the circle
now works really fine with TSL ... may be I should be satisfied as it is ...
Now the counter :
When the last LED in the circle of the 220 LEDS stops lighting I know exactly on what position
this LED has stopped. Its just a number between 0 and 219, but I don't know what number on the display
at this position was shown at exactly this moment, but the two I have to compare to light the correct
play fields, red, blue, pair, impair and so on ... may be I cannot solve this problem but I thougt
with a counter from every start (push button) I could count up the moves of the first (zero or 0),
number to know what number is on this position afterwards...
Well I don't understand this myself, so excuse my poor english.
But thanks a lot for your "taking share of the load"
MD_MAX72xx_font_CHANGED.cpp (21.8 KB)
I look from the wrong side
TSR is working fine from display 5 to 1 down and showing all the numbers
Hi,
I found this sketch, works with my 37 displays, starting at the last display (37)
and going down to the first, just turning all leds on and off in a loop.
Have a nice sunday.
MAX72xx_DaisyChain-37-MAX_ON-OFF-LOOP.ino (734 Bytes)
marco_c:
Should be pull up on the CS/LD line.CLK and CS should be ok wired in to the modules in parallel, but you may also want to try not in parallel. DI/DO is only between individual modules.
The other thing you can also try is fewer modules and build up the numbers to see if there is a point when’re it starts to fail.
As for the counter, i am not sure what you mean. If you stop shifting it will remember where it was before you stopped and start from there when you start again.
Hello Marco, sorry to bother you again but in the last days
I have fixed some mechanical problems with the construction.
Put the 37 displays between two iron ribbons for stability (see photo).
That was not too difficult - but while doing this I have checked once again
with the displays and all the connections and the signals and so on,
and all seems to be OK.
I think otherwise the TSL would not be working, but it's working fine.
Also the test-program I mentioned (see #1247) works fine, starting at display
37 down to display 1
So why does TSR not work with 37 displays in MAX_DEVICES ?
TSR only works works with 37 display if I set MAX_DEVICES to 32 ,
but naturally than the following of the numbers are not correct.
Has this something to do with the so called "wrap around" Mode
I read in one of the sketches ?
And As You say you don't understand it, I cannot understand it either.
With MAX_DEVICES set to 37 the TSR lights only the FIRST 5 displays
but in these 5 displays all the numbers are coming up in the correct order.
May be you have some other idea how I can solve the problem.
Thanks for you patience.
As I don't have more that 20 modules, I can't see the problem here.
The only thing I can suggest is to write a short test program to simplify the testing to just one column of LEDs that you place at the first/last column of the display and then shift from one end to the other. Minimise the amount of code that is working to isolate the problem (ie, eliminate the font handling, numbers, other LEDs, etc).
marco_c:
As I don't have more that 20 modules, I can't see the problem here.The only thing I can suggest is to write a short test program to simplify the testing to just one column of LEDs that you place at the first/last column of the display and then shift from one end to the other. Minimise the amount of code that is working to isolate the problem (ie, eliminate the font handling, numbers, other LEDs, etc).
good Idea , I will try
thank you
The problem with 32 modules being 'the limit' for number of modules has been fixed. Version 2.10.1 is on the repository web site, link in signature block below.
How do I made a string of text scroll but then stop with the last bit of text still on the screen ?
Don’t specify an exit text effect. Read the documentation if you don’t know what I am talking about.
Hello, today I have tried on several sketches with Parola. (Orginal from the Parola examples) All ran on the Arduino Nano …. unfortunately, the font and the characters were all mirrored. What am I doing wrong ?
Thanks in advance for the answers Greetings from Berlin Ralf
Dear marco, can you help me for parola bluetooth control with double height code together. i am not getting any clue to complete this.
@Lora
Between the blog and this forum, this is the third time you have asked the same question.
The answer remains the same:
- Have your read the documentation for the MD_MAX72xx library, especially the section about adapting for different hardware.
- I assume you read the blog article at Parola A to Z – Adapting for Different Hardware – Arduino++ like I alsready asked you to do.
Please confirm that you have at least read the documentation.
Have you edited the MD_MAX72xx.h file as the instructions tell you to?
If you have done all this and it still does not work, please post a link to the LED matrix hardware so that I can see what you are trying to use.
@arijous
There are examples for both of the things you want to do. I don't give individual help for projects or I would never have time to do what I want.
If you feel you don't have the skills to do what you need, then there is a 'Gigs and Collaboration' section in the Arduino forum where you can ask for someone to help with your project.
Akorede:
Hello guys, pls I have one problem with the way my scrolling display with parola is behaving. I used 15 modules of the 3mm 8*8 display and I followed the circuit diagram supplied by the max7219. When it first switched on, everything will work fine. After a while problems will start coming up. Examples of the problem is: one of the modules may off completely and never come up again until I restart the display. One or two columns of a module may be permanently on. Pls what can I do to solve these problems. Thanks.
just found your entry and can report that I am facing the same issue.
Is the problem identified and have you found a solution ?
Also for me it would be fine to use a command to my display to clear its glitch.