DMD_Demo slows when set to more than 4 dmd's

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
Aussie_Wombat
Posts: 51
Joined: Tue May 22, 2012 12:52 pm
Location: Adelaide, South Australia

DMD_Demo slows when set to more than 4 dmd's

Post by Aussie_Wombat » Thu Jan 31, 2013 11:05 am

Hi all,

I am using a freetronics Etherten to run the dmd_demo sketch, connected to 9 (3x3) dmd panels. Because the dmd's are daisy chained, the display on the un-configured dmd's are 1 pixel line out, because of the A and B settings, but they still display ok.
DMD's powered by computer psu...

If I set the panels to wide x down of 1 x n where 1<= n <= 4 all is good.

If I set the panels to wide x down of n x 1 where 1<= n <= 4 all is good.

If I set the panels to wide x down of n x n where 1<= n <= 2 all is good.

If I set n >4 then the display updates 1 led per second...veeeerrrrrryyyyy slowly, but only after drawing the digits 2345 quickly, then everything else goes slow...

Any ideas???

Regards Baffled...
aka Aussie_Wombat , Dennis

If I use my Pic32 Maximite to display all 9 panels, all is ok..

42n8
Posts: 46
Joined: Wed Dec 26, 2012 8:10 pm
Location: Auckland, NZ

Re: DMD_Demo slows when set to more than 4 dmd's

Post by 42n8 » Fri Feb 01, 2013 3:12 am

This sounds a bit like a buffer overflow causing a race condition.

Could be caused by too little RAM or not enough clock cycles available to complete an update.

Try backing off the frame rate a bit and see what happens.

Regards

Aussie_Wombat
Posts: 51
Joined: Tue May 22, 2012 12:52 pm
Location: Adelaide, South Australia

Re: DMD_Demo slows when set to more than 4 dmd's

Post by Aussie_Wombat » Fri Feb 01, 2013 8:33 am

Hi,
As this is the generic demo, I would have to ask where can I set the framerate. Do you mean the timerone interupt. If I try and upload a large sketch of around 28k ,I get an upload error as well.

Thanks for the info. I will have a look later . Probably tomorrow..

Regards Dennis

42n8
Posts: 46
Joined: Wed Dec 26, 2012 8:10 pm
Location: Auckland, NZ

Re: DMD_Demo slows when set to more than 4 dmd's

Post by 42n8 » Fri Feb 01, 2013 11:43 am

You can easily slow down any function within an interrupt by doing something like this...

The code below works on the PIC directly, the syntax will be different for languages other than C/C++ and varies between compilers but you'll probably get the idea.

Code: Select all

// Global Variables - could use int if the value is larger than char
volatile unsigned char SlowFrameRate=1;
volatile unsigned char SlowDim=50;


// High-priority ISR handling function
#pragma interrupt highPriorityISRCode
void highPriorityISRCode(void) {
	// Interupt Content
	if (INTCONbits.TMR0IF) {
		SlowFrameRate--;
		if (!SlowFrameRate)  {
			dmd_scan();
		SlowFrameRate = 1;
		}
		INTCONbits.TMR0IF = 0;
	}
	// dimmer
	if(PORTBbits.RB4 == 0) {
		SlowDim--;
		if (SlowDim == 0) {
			SlowDim = 40;
			if (CCPR1L > 0x00) {
				CCPR1L--;
			}			
		}
	}
	// brighter
	if(PORTBbits.RB5 == 0) {
		SlowDim++;
		if (SlowDim == 30) {
			SlowDim = 0;
			if (CCPR1L < 0xFF) {
				CCPR1L++;
			}
		}
	}
}
Since I copied the actual routine I use, I may as well explain it now as well.

The code that controls the display brightness is included. I don't know if you can do this with the rigid format of the arduino but it works with the PIC very smoothly.

I can set the registers remotely also but needed local control as well. Connect two "press to make" switches to ground and the other two lines to two ports that have been tied high using 2K2 - 4K7 resistors with a 104n cap to ground. This sets a small RC delay, helping to eliminate spiking. If either input port goes low the register (CCPR1L) is adjusted accordingly but only when the brightness variable reaches zero.

Since CCPR1L is a PWM output, when totally configured, (not shown here) the pulse width varies according to the set value. Wire .AND. the PWM port with the OE port using two common anode diodes (cathode to port) the anodes feed the OE line directly, pull up resistors are needed to implement the .AND. function.

Using this method in code you could, theoretically, create a grey scale with up to 255 levels simply by writing a new value to the CCPR1L register from data for each pixel stored in a table.

Regards

Post Reply