Re: PIC18F13K22 comparator problem
As crazy as it seems, you want to disable the ADC on these specific pin, but enable the comparator. it also seems you miss a bit in your CM1CON0 register? 
Give this a shot
Code:
C1OUT VAR CM1CON0.6
PORTA = 0
PORTB = 0
PORTC = 0
TRISA = %00000011 'PORTA<1:0> = Input
TRISC = 0
TRISB = 0
ANSEL = 0 ' Disable
ANSELH = 0 ' All ADCs
CM1CON0 = %10001000
' -1-------- C1ON: Enable comparator 1
' --x------- C1OUT: Read only
' ---0------ C1OE: C1OUT set to internal
' ----0----- C1POL: C1OUT Logic not inverted
' -----1---- C1SP: Operate in normal power mode
' ------0--- C1R: C1Vin+ Connected to C1IN+ (A.0)
' -------00- C1CH<1:0>: C1Vin- connected to C12IN0- (A.1)
MainLoop:
LATB.6 = C1OUT
PAUSE 200
GOTO MainLoop
END
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks