Hello,
Have a look at the HPWM command in the manual. It does what RFEFX suggested, without having to setup the CCP1 registers. The minimum frequency for HPWM, depends on your mcu clock.
Something like this should work, Regards
Duty var Byte
Freq var Byte
Freq = 325
Duty = 127 '50%
Main:
HPWM 1, Duty, Freq 'Output 325hz, 50% duty on pin 5 pic12f683
If X happens then Duty = 0 'Pwm off - pin5 low
If y happens then Duty = 127' Pwm on 50% duty
If Z happens then Duty = 255, Pwm off - pin 5 high
goto Main
Bookmarks