PDA

View Full Version : Turn off HPWM?



cstack
- 10th March 2011, 00:05
Once you turn on HPWM, can you turn it off?

Example: (Melanie's LCD Contast?Backlight tips)

Kamikaze47
- 10th March 2011, 03:25
It may differ from PIC to PIC so check the data sheet, but taking the 18F1320 as an example, the following would turn off HPWM:

CCP1CON=0

Mike, K8LH
- 12th March 2011, 02:59
Depends on what you consider "off". If you set the duty cycle to 0% and leave it there your output pin will be '0' (low). If you set the duty cycle to 100% and leave it there your output pin will be a '1' (high). You might also put the CCP1 pin into the hi-z input state.

Regards, Mike

Acetronics2
- 12th March 2011, 10:33
Hi,

The one and only question is :

1) do you want to stop the PWM output ( set it to 0% )

2) or turn HPWM Module really off ... which is not compulsory, but some kind of " double security ". ;)
you then can use Timer2 for other purposes ...

Alain

cstack
- 14th March 2011, 02:39
Thanks for the replies:

I wondered about turning off the HPWM in software, i.e. save battery, use Timer2 for other purposes, etc.

I was thinking about using the HPWM to drive an LCD backlight. I wanted to turn on the backlight ,i.e. start HPWM, with a button push and somehow turn it back off again when no longer needed.

Charlie