Hi guys,
I want to turn on a RGB LED, but i want to to give 3 pwm for change the brightness of it to get different colours. But in 16F877A has only two pwm pins. What can i do? Some said me use multiplexing to generate 3rd one(code wise) but i don't know how to do that?
1st check the code library here... there's a few RGB LED programs
2nd LEDs aren't fuzzy about speed, so a software PWM will work fine.
3rd if nothing in the code library , just search 'PWM LED' on this forum...you aren't the first to use a 20 year old PIC for RGB LEDs !
Jay
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
Posted: Wed Dec 07, 2016 12:07 pm
I once wrote a little piece of code that did some operation, i believe XOR on both hardware PWMs and the resulting value was output as the 3rd PWM line...
the 2 hardware PWM were set as oposites... and by controling these 2 lines you could get any color desired from the RGB
I lost said code and never tried it again... but this is hardly a problem that cant be solved with Software PWM or a little operations on the 2 hardware lines.
G. _________________ CCS PCM 5.078 & CCS PCH 5.093
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
Posted: Thu Dec 08, 2016 2:55 am
A simple search on this forum yielded several links including this 10 year old one.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum