Synchronization of scrolling text not working on multiple DMDS

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
a.rehman85
Posts: 2
Joined: Thu Apr 28, 2016 9:25 am

Synchronization of scrolling text not working on multiple DMDS

Post by a.rehman85 » Thu Apr 28, 2016 9:46 am

Hello all .

I have interface two P10 (32 BY 16) DMD;S together . Issue is with the synchronization of scrolling text from 1ST DMD to the 2nd DMD . Scrolling message ends on 1st DMD and than start from mid of the other DMD . Synchronization is missing . Below mention is my code .Please help


#include <SPI.h> //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include "SystemFont5x7.h"
#include "Arial_black_16.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 2
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
//number max of characters in your message
#define max_char 100
char message[max_char]; // stores you message
char r_char; // reads each character
byte index = 0; // defines the position into your array
int i;

/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}

void setup(void)
{

//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 5000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()

//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
Serial.begin(9600);
}
void loop(void)
{
//check if serial is avaible an before reading a new message delete's the old message
if(Serial.available()){
for(i=0; i<99; i++){
message = '\0';
}
//resests the index
index=0;
}
//while is reading the message
while(Serial.available() > 0){
//the message can have up to 100 characters
if(index < (max_char-1))
{
r_char = Serial.read(); // Reads a character
message[index] = r_char; // Stores the character in message array
index++; // Increment position
message[index] = '\0'; // Delete the last position
}
}
//prepares the display to print our message
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16);
//displays the message
dmd.drawMarquee(message, max_char,(32*DISPLAYS_ACROSS)-1 ,0);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
}

User avatar
stryker
Posts: 282
Joined: Sat Jan 14, 2012 2:44 pm

Re: Synchronization of scrolling text not working on multiple DMDS

Post by stryker » Thu Apr 28, 2016 11:35 am

Hi,

I'm not sure what you mean by "synchronisation" in this context?

The marquee certainly looks like it should run across the full width of the two panels though. I've not tested this,but I'd try to swap

Code: Select all

dmd.drawMarquee(message, max_char,(32*DISPLAYS_ACROSS)-1 ,0);
with

Code: Select all

dmd.drawMarquee(message, index,(32*DISPLAYS_ACROSS)-1 ,0);
That should pass the marquee the length of the string to display, rather than the full 100 length of the character array, much of which will be either be uninitialised, and any previously entered text in longer strings (along with an unprintable null character).

Cheers ! Geoff

a.rehman85
Posts: 2
Joined: Thu Apr 28, 2016 9:25 am

Re: Synchronization of scrolling text not working on multiple DMDS

Post by a.rehman85 » Thu Apr 28, 2016 11:44 am

Geoff

Thanks for the quick response .
Synchronization means the text does not scroll on the whole set (2 DMD'S) together . For eg if i enter text of " Geoff is a good boy" than this text starts scrolling on the 1st DMD only and vanishes off and than the word "boy" starts from mid of the second DMD and scrolls till the end.

User avatar
stryker
Posts: 282
Joined: Sat Jan 14, 2012 2:44 pm

Re: Synchronization of scrolling text not working on multiple DMDS

Post by stryker » Thu Apr 28, 2016 1:56 pm

I won't have a chance the next few days but if you're still stuck Sunday night shout out and I'll get to test this Monday. Loving the long weekends! Geoff

Post Reply