How to Set DMD Brightness

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
42n8
Posts: 46
Joined: Wed Dec 26, 2012 8:10 pm
Location: Auckland, NZ

Re: How to Set DMD Brightness

Post by 42n8 » Tue Jun 04, 2013 1:01 pm

Hi Geoff,
A small update to my last post.
The only thing that nOE is used for by the PIC library is blanking.
I had to rewrite the un/blanking functions and am now running without any reference to nOE in the code. It's all controlled by the PWM system.

Code: Select all

DMD.h

/*********************************************************************
void blank(void);
void unblank(void);
Sets the PWM on or off as blanking to replace the nOE function.
CCPR1L_copy is the old value of the CCPR1L register.
*********************************************************************/
static byte CCPR1L_copy;
void blank(void);
void unblank(void);
/********************************************************************/
DMD.c
/********************************************************************/
void blank() {
	CCPR1L_copy = CCPR1L;
	CCPR1L = 0;
}

void unblank() {
	CCPR1L = CCPR1L_copy;
}
/********************************************************************/
It has also meant that I have now done away with the wired gate and freed up a port in the process

I am now of the opinion that the library author missed the point of using the PWM pin for nOE.
This in turn means that when, not if, you get your code modified that you might submit it as a patch to the standard code so that it is available from the outset to everyone.

Regards

42n8

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

Re: How to Set DMD Brightness

Post by 42n8 » Wed Jun 05, 2013 7:52 am

Hi Geoff,
Just a couple more things to do and I think we can put this one to bed.

The PWM system is about 5 times faster than standard port addressing on the PIC, which means
a longer "ON" time is possible. The consequence of the improved scan speed and higher duty cycle is higher power; more heat; no significant increase in maximum brightness and a reduction in the life of the 4953 Quad MosFETs. Therefore the library should set a maximum brightness value to limit the ON period. Additionally, defaulting it to the ON state at a safe level will avoid problems for new users.
  • The maximum brightness (PWM) value assigned to the CCPR1L Register during the the setup process is 0x10.
  • The default brightness (PWM) value assigned to the CCPR1L Register during the the setup process is 0x04.
These settings work well for the PIC library; arduino values may differ but it seems like a good place to start. Then the user can override the values to suit the application.

The solution wasn't obvious because it really is a library issue and we seldom suspect them.
The moral of the story... "Just because it's in the library, doesn't mean it's right".
Happily, the fix turns out to be as trivial as it gets but it's been a long time getting there.

Regards

42n8

kitbots
Posts: 11
Joined: Tue Oct 30, 2012 2:39 am

Re: How to Set DMD Brightness

Post by kitbots » Tue Sep 24, 2013 12:50 pm

42n8 wrote:Hi Geoff,
Just a couple more things to do and I think we can put this one to bed.

The PWM system is about 5 times faster than standard port addressing on the PIC, which means
a longer "ON" time is possible. The consequence of the improved scan speed and higher duty cycle is higher power; more heat; no significant increase in maximum brightness and a reduction in the life of the 4953 Quad MosFETs. Therefore the library should set a maximum brightness value to limit the ON period. Additionally, defaulting it to the ON state at a safe level will avoid problems for new users.
  • The maximum brightness (PWM) value assigned to the CCPR1L Register during the the setup process is 0x10.
  • The default brightness (PWM) value assigned to the CCPR1L Register during the the setup process is 0x04.
These settings work well for the PIC library; arduino values may differ but it seems like a good place to start. Then the user can override the values to suit the application.

The solution wasn't obvious because it really is a library issue and we seldom suspect them.
The moral of the story... "Just because it's in the library, doesn't mean it's right".
Happily, the fix turns out to be as trivial as it gets but it's been a long time getting there.

Regards

42n8

Sorry but its still not clear to me what the solution is...........could you post a sample program which varies the brightness of the display?

Post Reply