How to clear CCP1 RC2 PIN PIC 18F4431 Oshonsoft

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Hi,
I'm using the CCP1 Compare, in a program, which goes HIGH at compare.
I've tried all of these to reset it LOW, but none work (for me!)
--------------------------
LATC.2 = 0
PORTC.2 = 0
PIR1 = 0
PIE1 = 0
PIR1.CCP1IF = 0 'clear interrupt flag
CCP1CON = %00001000 'Compare mode; initialize CCPx pin low; ON COMPARE MATCH-force CCPx pin high (CCPxIF bit is set)
CCP1CON = %00001001 'Compare mode; initialize CCPx pin high; on compare match, force CCPx pin low (CCPxIF bit is set)
---------------------------
Any ideas please?
Camerart
 

sagor

Joined Mar 10, 2019
914
I think you need to clear the entire CCP1CON register (=0) in order to drop the bit. The CCP module has its own output on the I/O pin, independent of the regular PORT registers.
That does turn off the CCP mode, until you re-enable it by setting the CCP1CON register again.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
I think you need to clear the entire CCP1CON register (=0) in order to drop the bit. The CCP module has its own output on the I/O pin, independent of the regular PORT registers.
That does turn off the CCP mode, until you re-enable it by setting the CCP1CON register again.
Hi S,
That works, thanks.
C
 
Top