I have a Pic18f27J53 were I am using PWM to drive some analog meters.
The project is normally powered by a wallwart. I am detecting a power failure. When I detect a power failure I set the duty cycle of the PWM to zero and put the pic to sleep to wait for when normal power returns.
All works fine except that sometimes the output of the PWM pin remains high. No PWM out just at a high level.
Besides setting duty cycle to zero, what else should I be doing so the battery is not powering the meter while the pic is sleeping? Should I be setting the PWM outputs as inputs? What is the best way to shutdown output pins before sleep?
The project is normally powered by a wallwart. I am detecting a power failure. When I detect a power failure I set the duty cycle of the PWM to zero and put the pic to sleep to wait for when normal power returns.
All works fine except that sometimes the output of the PWM pin remains high. No PWM out just at a high level.
Besides setting duty cycle to zero, what else should I be doing so the battery is not powering the meter while the pic is sleeping? Should I be setting the PWM outputs as inputs? What is the best way to shutdown output pins before sleep?
