CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

3 PWM for 16F877A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
suchinthaka



Joined: 07 Dec 2016
Posts: 1

View user's profile Send private message

3 PWM for 16F877A
PostPosted: Wed Dec 07, 2016 9:38 am     Reply with quote

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? Sad Sad
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 07, 2016 9:44 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 07, 2016 12:07 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 08, 2016 2:55 am     Reply with quote

A simple search on this forum yielded several links including this 10 year old one.

http://www.ccsinfo.com/forum/viewtopic.php?t=27913&start=0&postdays=0&postorder=asc&highlight=pwm+877

Should give you a start.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group