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

pic 18f4520 PWM modulation

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



Joined: 10 Apr 2013
Posts: 1

View user's profile Send private message

pic 18f4520 PWM modulation
PostPosted: Wed Apr 10, 2013 11:54 pm     Reply with quote

I'm kind of new to C compiler, I'm required to make a 40 kHz pwm modulation using timer2 with a 4 Mhz oscillator on a pic 18f4520.
I tried calculating PR2 and got PR2=24 (not sure about it though).
Any help is greatly appreciated.
Thanks in advance.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 11, 2013 12:46 am     Reply with quote

Search the forum archives. Here's the search page:
http://www.ccsinfo.com/forum/search.php
There's also a link for it at the top of the forum.

Search for this:
Quote:
pwm 40*KHz

The reason for the asterisk is that some people might write 40KHz
and some might write 40 KHz.

Make sure you set it to search for: "Search for all terms"
Mike Walne



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

View user's profile Send private message

PostPosted: Thu Apr 11, 2013 8:52 am     Reply with quote

Microchip data sheet shows exactly how to do the calculation.

CCS manual shows same thing as setup_timer_2(x,y,z) in CCS format.

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