View previous topic :: View next topic |
Author |
Message |
frierray
Joined: 11 Nov 2008 Posts: 29
|
Over ride the PWM and set the output bit high? |
Posted: Sat May 16, 2009 8:12 am |
|
|
Hi All,
I am using a 18f2520 with compiler version 4.073 and need to set the PWM output pin high at the end of the PWM code. When I set the PWM duty to 0, pin C2 is in a low state. I need to set it high to have the braking function work in a LMD18200. I tried output_bit(PIN_C2, 1); however it does not set C2 high. Is there someway to over ride the PWM and set the output bit high?
Ray |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat May 16, 2009 9:43 am |
|
|
Just set the duty to the maximum.....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
frierray
Joined: 11 Nov 2008 Posts: 29
|
|
Posted: Sat May 16, 2009 3:39 pm |
|
|
Thanks, that did just what I needed. So the output_bit(PIN_C2, 1); cannot override the PWM state for the pin. |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun May 17, 2009 2:42 am |
|
|
As the hardware manual clarifies, second output functions of I/O ports take priority over the port function. You have to disable the respective function, e.g. PWM, UART output, SPI to reenable port operation. |
|
![](templates/subSilver/images/spacer.gif) |
|