<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.