Page 1 of 1

PWM in output. not working correct. (fixed (my fault))

Posted: Sat Dec 01, 2018 5:04 am
by chad
The timing is off but I knew to expect that, but the SetDutyCycle(either) doesn't function correctly.

thanks,
Chad
PWM test.fcfx
(7.42 KiB) Downloaded 236 times

Re: PWM in output. not working correct.

Posted: Mon Dec 03, 2018 10:39 am
by LeighM
Hi Chad,
The SetDutyCycle() parameter is limited to 8 bits, so best to use the SetDuty10Bit() for ARM
SetDuty10Bit() actually takes a 16 bit parameter
(The naming is historic, as 32 bit processors are more recent)
Using the numbers in your attached program I would expect the duty ratio to be 128/6400 and 512/6400
Is that not what you get?
Leigh

Re: PWM in output. not working correct.

Posted: Mon Dec 03, 2018 7:05 pm
by chad
Ok, I get it now. I was trying to use a 16 bit number (in the 10 bit). I thought it was expecting a 16 bit number whole not the #/6400.

If I use 3200/6400 I get the expected 50% duty.. My goal was to make a ~10khz base freq then change the duty to modulate a led...

My error thanks!

chad