Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
I wanna buid a pic to control the led dimmer with RGB colors, is there any PIC have this feature(3 pwm channel), or is there any way to achieve this task?
Thanks, but what i need to do is changing the color of LED smmothly. For example, change red to green smoothly (RGB 100 to RGB 010), means red color has to diminish while Green color is raising. Any idea?
There are PICs with 3 PWM, but not in a user-friendly DIP package.
Use a faster PIC18 (40MHz) and just do it the hard way. As the speed gets above 100 hz, the flicker will only be apparent if it's moving across your field of view.
"Hard way" being that you:
unsigned int ctr;
RED_PIN=red_limit>0;
BLUE_PIN=blue_limit>0;
GREEN_PIN=green_limit>0;
for(ctr=0;ctr<1024;ctr++){
if(ctr>red_limit)
RED_PIN=0;
... green...
... blue ...
}
But when do you get to recalculate the color limits? There are several ways- interrupting this routine would occassionally cause color "glitches", but it probably wouldn't be noticed. This loop could also be a timer interrupt itself, but you'd either decrease the available resolution for each color or have to decrease the frequency you're doing the PWM at.
Just generate you PWM signal manually( by switching a pin off and on simulatiously by code). If you do find a PIC with 3 PWM outputs, you'll be wasting like 35 output pins for nothing.
Even a small 8-pin PIC would pull it off easy.
I find that in/decrements in 2% to 5% show up as smooth transitions.
EDIT: PICBasic has been known to be quite notorious at cooperating with the PWM registers, doing it manually would work quite easily with PICBasic.
2nd EDIT: Verified by me, so make your switch to ASM already.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.