multi-color pic programming for led

B@rt

Flashaholic
Joined
Nov 21, 2001
Messages
10,467
Location
Land of Tulips and Philips
Have you ever seen a led doing a color-wash ? I've seen analog schemes to accomplish that, but I know there is a way of programming a pic to do the same.
Anybody out there who has done that and wants to share it, or at least give me some clues ?
Thanks ,
Bart
 
Hello,

I had built a microprocessor controlled
led driver for a two color led a while back.
It used the famous Z80 Zilog microprocessor
chip mainly because they are so cheap.
Of course you need supporting chips and
a pc board. The programming consists of
pulsing the two colors using a PWM scheme.
Three colors would be the same just with
one more output channel. The program runs
in an endless timed loop.

What exactly did you want to do yourself?

--Al
 
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by BlackBart:
Have you ever seen a led doing a color-wash ? I've seen analog schemes to accomplish that, but I know there is a way of programming a pic to do the same.
Anybody out there who has done that and wants to share it, or at least give me some clues ?
Thanks ,
Bart
<HR></BLOCKQUOTE>

The PIC is nice because its output ports can sink quite a bit of current. If you parallel a couple of them, you should be able to drive >30mA easily (they're rated at 25mA).

If you use a PWM technique, you can drive the pins fast enough (>100Hz) that the eye won't see the flicker.

Figuring (say) 100Hz, if you want 7 bits (>1%) resolution on your brightness steps, you can use one of the internal timers to interrupt at a 100*128 Hz (12.8Khz) rate. This still gives a 78 usec period. Especially if you use a clock faster than 4MHz (1 instruction/usec), this should give plenty of time to get into and out of the interrupt, increment timers, and change I/O pin states if necessary.

Or, alternatively, the PWM could be your main loop (saving the interrupt entry/exit time).

The timer could fire the color-changing routine in an interrupt handler. If this routine takes too long, though, you'll see an unevenness in the lamp brightness.
 
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>What exactly did you want to do yourself? <HR></BLOCKQUOTE>
Nothing much yet, just was curious about the way it works, but it seems I'll need to do some more reading to be able to fully understand it...
rolleyes.gif
 

Latest posts

Top