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 support@ccsinfo.com

12f675

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



Joined: 19 Oct 2008
Posts: 6

View user's profile Send private message

12f675
PostPosted: Fri Oct 26, 2012 11:06 am     Reply with quote

How can I make with 12f675 three software pwm? I want to use on rgb. Thanks for your interest.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Oct 26, 2012 11:16 am     Reply with quote

With time, learning, the right tools and perseverance?
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 26, 2012 11:33 am     Reply with quote

There is sample code in the Code Library forum for software PWM of 3 LEDs:
http://www.ccsinfo.com/forum/viewtopic.php?t=30139&highlight=red+green+blue
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri Oct 26, 2012 3:08 pm     Reply with quote

Start from from (say) a 4MHz clock that's 1us per instruction cycle.
Generate interrupts with one of the timers (probably timer0) at 10kHz.
In the ISR turn LEDs on and off as needed at 100Hz.

That will give you 1% resolution, and ~100 instruction cycles for the code to control the LEDs.

If you need either better resolution or more code you'll need a faster clock.

Best of luck.

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