Hello Thomas

Welcome to Jallib!

On 19-10-12 15:51, ryckmans_t wrote:

I have some puzzling results with PWM -again...
if I have this:

pwm_max_resolution(1)
pwm1_on()
pwm1_set_dutycycle_highres(500)
I get a nice 8kHz square wave.

If I add
pwm_set_frequency(12_000)

I get a rectangle wave (duty about 70%) at 12KHz...

If I increase the pwm_set_frequency further, I get same 12KHz but higher
duty...

If I do
pwm_set_frequency(5_000)... I get no signal!


1. I could reproduce your observations!

2. PWM has limitations with respect to the setting of (the combination of) frequency, dutycycle and resolution (see the datasheet) and your settings seem to go outside the supported ranges. Unfortunately the PWM library currently don't warn you!
This omission can probably solved.

Between now and a fix you might experiment with the procedure pwm1_set_percent_dutycycle() in stead of the procedures for 'absolute' settings. With pwm1_set_percent_dutycycle(50) I get nice square waves with different frequencies (I tried several in the range 100 to 50000 Hz). Beware that this procedure implies a resolution of 100 (which is no problem with square waves of course)!

Regards, Rob.


--
R. Hamerling, Netherlands --- http://www.robh.nl

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to