View previous topic :: View next topic |
Author |
Message |
Guest
|
Stopping a PWM? |
Posted: Wed Nov 26, 2008 8:20 am |
|
|
Hi
Is this the same as the CCP1 pin will be "L"?
set_pwm1_duty(0);
Ask because it dont? |
|
|
Ttelmah Guest
|
|
Posted: Wed Nov 26, 2008 8:41 am |
|
|
You need:
set_pwm1_duty(0L);
Note the 'L'.
The PWM, has a ten bit resolution. The 'set_pwm_duty' function, needs to receive a 'long' value, to access all ten bits. If you only give it a 'short' value (the '0' in your original command), then only the upper 8bits of the PWM, will be accessed. _If_ the two low bits have been set to a non zero number (as will have happened if you have output any 'long' value to the PWM), then these will still be set, and you will get a tiny pulse of 1,2, or 3 PWM clocks.
Best Wishes |
|
|
Guest
|
|
Posted: Wed Nov 26, 2008 10:53 am |
|
|
|
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Nov 26, 2008 4:44 pm |
|
|
And 2 more cents - if you are using variables to do your PWM work - just remember to use a LONG for calling setPWM |
|
|
|