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

Setup_timer_2 pwm for low frequencies

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



Joined: 09 Mar 2008
Posts: 1

View user's profile Send private message

Setup_timer_2 pwm for low frequencies
PostPosted: Sun Mar 09, 2008 2:21 pm     Reply with quote

Hi

Could anyone help me find the values for setting the timer 2 for PIC16F877A so that i can generate the pwm with the following characteristics:

Period: 15.95ms
Frequency: 62.7Hz
Duty Cycle: 10.7%

I am using a clock of 20MHz

Thanks in advance!
sid
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 09, 2008 2:41 pm     Reply with quote

This post tells you how to calculate the lowest PWM frequency
that you can get with a 20 MHz oscillator:
http://www.ccsinfo.com/forum/viewtopic.php?t=31625
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Sun Mar 09, 2008 6:19 pm     Reply with quote

Maybe it would be better just to generate two time intervals in turn, using time interrupts. First 10.7% of 15.95ms, then 89.3%, and repeat.

Of course, it depends on what else the processor has to do. If you have other things happening which absolutely must generate interrupts, this method won't work. But often there can be alternative approaches which rely on polling rather than interrupts.
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