A question about PWM

General discussion on mikroPascal.
Post Reply
Author
Message
alm7100
Posts: 85
Joined: 09 Oct 2008 11:58
Location: Denmark

A question about PWM

#1 Post by alm7100 » 18 Jun 2009 20:33

Hi

I Have a question about PWM (I dont understand PWM total)

procedure PWM1_Init(freq : longint);

If i have a Pic at 40MHz.

Can that pic then have a PWM freq between 0 and 40MHz ??

//
Allan
//
Allan (Sorry for my English.)

alm7100
Posts: 85
Joined: 09 Oct 2008 11:58
Location: Denmark

#2 Post by alm7100 » 25 Jun 2009 21:44

Thanks for all the answerer. :-)
//
Allan (Sorry for my English.)

piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

#3 Post by piort » 26 Jun 2009 14:41

hi allan,

you dont tell us wich pic you use ... but basically you can find that information in the datasheet of the Pic you are using. section ccp/pwm.

exemple for a 18f2510 the formula is :
PWM Period = [(PR2) + 1] • 4 • TOSC • (TMR2 Prescale Value)

PWM frequency is defined as 1/[PWM period].

hth a bit ;-)

Post Reply

Return to “mikroPascal General”