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

20ms Period on PWM using 10MHz clock

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







20ms Period on PWM using 10MHz clock
PostPosted: Sat Mar 14, 2009 10:34 pm     Reply with quote

Is there any way to produce a 20ms period for the PWM output of a PIC 16f877a using an input clock of anywhere between 2MHz - 20MHz? I can use hardware to move the oscillator clock to anywhere in this range so the lowest I can go is 2MHz.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 14, 2009 11:07 pm     Reply with quote

This post has the pwm frequency formula:
http://www.ccsinfo.com/forum/viewtopic.php?t=17993&start=1
For a 2 MHz oscillator, the lowest you can go is 122 Hz.

To get a 50 Hz pwm frequency, you need to do software PWM.
See the sample code I posted in this thread, and also the links.
http://www.ccsinfo.com/forum/viewtopic.php?t=37807
thurmanc
Guest







PostPosted: Sat Mar 14, 2009 11:49 pm     Reply with quote

Thanks so much for your help. I see I may have a resolution problem using your code but it is much better than not having it work at all Smile
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