Here's a simple test to show the effects of disabling the hardware PWM module, or using a zero duty-cycle or freq with HPWM.
Hook an LED up to your CCP out pin.
CCP output pin ---|>|----/\/\/\/\----GND
Code:
SYMBOL PIN = PORTC.2 ' Define whatever pin on your PIC is CCP out here
HPWM 1,127,2000
PAUSE 8000
CCP1CON = 0 ' Test once with this, then comment it out
'HPWM 1,0,0 ' Now test with this un-commented
WAITUP:
HIGH PIN
PAUSE 500
LOW PIN
PAUSE 500
GOTO WAITUP
On a 16F876A, the LED never toggles with HPWM 1,0,0. It does once the hardware PWM module is disabled with CCP1CON = 0. I'm curious if it works either way on other PIC's.
Bookmarks