PDA

View Full Version : HPWM command and oscillator frequency



RussMartin
- 8th March 2009, 09:34
My PBP manual (p. 74 or 76, depending on version) gives a nice table showing the minimum frequency that can be generated with HPWM, depending on oscillator frequency.

But the lowest oscillator frequency (OSC) shown in that table is 4 MHz.

What happens to the minimum HPWM frequency if a lower oscillator frequency is programmed?

For example, what happens if I use (no matter why) 1 MHz? Is the minimum frequency still 245 Hz? Or is it scaled by 1/4 to 61.25 Hz?

(Has anyone actually played with this? Or should I ask the folks at ME Labs? Maybe I should just do a jiffy program and put the PWM pin on the oscilloscope . . . )

Acetronics2
- 8th March 2009, 11:22
Hi, Russ

[quote]
What happens to the minimum HPWM frequency if a lower oscillator frequency is programmed?
[quote]

PBP calculations are based upon the Define OSC you've entered. ( default is 4 )
HPWM module drive is based upon the Main OSC Period.

so, the real HPWM frequency at output will raise ... in the inverse ratio ...



NOW, if your XTAL has a lower frequency than declared ...

HPWM frequency will be lower ... in the same ratio.


I saw you've got the patent for the " Wine Oscillator " ... Great !!! Congratulations ( ROFL )

Regards
Alain

mat janssen
- 8th March 2009, 11:24
Because HPWM is taken from the internal timers and the internal timers are clocked from the xtal oscillator. The min. and max freq is depended of that.
If you take a very low xtal, you min. freq is than very low and you max. freq. is than also not so high.
Make a test and measure it thaan with an oscilloscope is alway good idea.

RussMartin
- 8th March 2009, 22:41
I put a scope on CLKOUT and looked at it and the PWM output pin.

Everything seems proportionate.

At the lowest oscillator setting (OSCON set for 125 kHz, so CLKOUT is 31.25 kHz),

HPWM 1,127,8000

gives a nice 250 Hz square wave.

Since the ratio of 4000/125 = 32, 8000/32 should (and does) equal 250.

I haven't determined maxima and minima yet, but I'll play with that next.