Datasheet

2010 Microchip Technology Inc. DS41303G-page 285
PIC18F2XK20/4XK20
REGISTER 20-2: CM2CON0: COMPARATOR 2 CONTROL REGISTER 0
R/W-0 R-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
C2ON C2OUT C2OE C2POL C2SP C2R C2CH1 C2CH0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7 C2ON: Comparator C2 Enable bit
1 = Comparator C2 is enabled
0 = Comparator C2 is disabled
bit 6 C2OUT: Comparator C2 Output bit
If C2POL =
1 (inverted polarity):
C2OUT = 0 when C2VIN+ > C2VIN-
C2OUT = 1 when C2V
IN+ < C2VIN-
If C2POL =
0 (non-inverted polarity):
C2OUT = 1 when C2VIN+ > C2VIN-
C2OUT = 0 when C2V
IN+ < C2VIN-
bit 5 C2OE: Comparator C2 Output Enable bit
1 = C2OUT is present on C2OUT pin
(1)
0 = C2OUT is internal only
bit 4 C2POL: Comparator C2 Output Polarity Select bit
1 = C2OUT logic is inverted
0 = C2OUT logic is not inverted
bit 3 C2SP: Comparator C2 Speed/Power Select bit
1 = C2 operates in normal power, higher speed mode
0 = C2 operates in low-power, low-speed mode
bit 2 C2R: Comparator C2 Reference Select bits (non-inverting input)
1 = C2V
IN+ connects to C2VREF
0 = C2VIN+ connects to C2IN+ pin
bit 1-0 C2CH<1:0>: Comparator C2 Channel Select bits
00 = C12IN0- pin of C2 connects to C2V
IN-
01 = C12IN1- pin of C2 connects to C2V
IN-
10 = C12IN2- pin of C2 connects to C2V
IN-
11 = C12IN3- pin of C2 connects to C2V
IN-
Note 1: Comparator output requires the following three conditions: C2OE = 1, C2ON = 1 and corresponding port
TRIS bit = 0.