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

12F1840 PWM

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



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

12F1840 PWM
PostPosted: Sat Mar 23, 2019 9:54 am     Reply with quote

Hi, I am trying to use PWM for the first time and am getting bogged down in the formulae and can't see the wood for the trees!
I am using the internal oscillator at 4MHz - #use delay(internal=4M)
I want a 100kHz signal with duty cycle variable from 0 - 100%
I don't understand the calculation to get the right values for setup_timer_2.
Also, the datasheet has an equation for pulse width and for duty cycle ratio, which I don't follow either!

Can anyone please offer a SIMPLE explanation I can follow?

Thanks

Brian
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 23, 2019 9:56 am     Reply with quote

Links to forum articles on pwm:
http://www.ccsinfo.com/forum/viewtopic.php?t=45968&start=1
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