PWM frequency cakculation

Thread Starter

Irmutis

Joined May 24, 2009
17
Hi,


I want to ask how I can calculate PWM frequency if I have 32bit timer and Fosc=70MHz? How to calculate maximum and minimum PWM signal frequency?
 

thatoneguy

Joined Feb 19, 2009
6,359
ErnieM maybe you can tell how to calculate PWM frequency for your device?
I believe he was asking "What will the PWM be driving", such as a motor, LED, piezo, etc.

The frequency for those is pretty much platform independent. Most here use PIC microcontrollers, but there are some familiar with ARM Cortex. I don't recall everything, and they've added a lot.
 

ErnieM

Joined Apr 24, 2011
8,377
ErnieM maybe you can tell how to calculate PWM frequency for your device?
My device here is a PIC12HV615, and the PWM frequency is set by the Timer2 compare feature: when timer 2 meets a value set in the PR2 register the period is complete, and the timer is reset.

My instruction clock is 1MHz, I use a 16:1 prescaler on the timer, and the max in PR2 (0xFF). This yields the lowest PWM frequency one can obtain this way of:

1MHz / 16 / 256 = 244.140625

And I am sure that is of no help to your needs. :D
 
Top