Datasheet
2010-2012 Microchip Technology Inc. DS41412F-page 317
PIC18(L)F2X/4XK22
18.9 Register Definitions: Comparator Control
REGISTER 18-1: CMxCON0: COMPARATOR x CONTROL REGISTER
R/W-0 R-0 R/W-0 R/W-0 R/W-1 R/W-0 R/W-0 R/W-0
CxON CxOUT CxOE CxPOL CxSP CxR CxCH<1:0>
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 CxON: Comparator Cx Enable bit
1 = Comparator Cx is enabled
0 = Comparator Cx is disabled
bit 6 CxOUT: Comparator Cx Output bit
If CxPOL =
1 (inverted polarity):
CxOUT = 0 when CxVIN+ > CxVIN-
CxOUT = 1 when CxV
IN+ < CxVIN-
If CxPOL =
0 (non-inverted polarity):
CxOUT = 1 when CxVIN+ > CxVIN-
CxOUT = 0 when CxV
IN+ < CxVIN-
bit 5 CxOE: Comparator Cx Output Enable bit
1 = CxOUT is present on the CxOUT pin
(1)
0 = CxOUT is internal only
bit 4 CxPOL: Comparator Cx Output Polarity Select bit
1 = CxOUT logic is inverted
0 = CxOUT logic is not inverted
bit 3 CxSP: Comparator Cx Speed/Power Select bit
1 = Cx operates in Normal-Power, Higher Speed mode
0 = Cx operates in Low-Power, Low-Speed mode
bit 2 CxR: Comparator Cx Reference Select bit (non-inverting input)
1 = CxVIN+ connects to CXVREF output
0 = CxV
IN+ connects to C12IN+ pin
bit 1-0 CxCH<1:0>: Comparator Cx Channel Select bit
00 = C12IN0- pin of Cx connects to CxV
IN-
01 = C12IN1- pin of Cx connects to C
XVIN-
10 = C12IN2- pin of Cx connects to CxV
IN-
11 = C12IN3- pin of Cx connects to CxV
IN-
Note 1: Comparator output requires the following three conditions: CxOE = 1, CxON = 1 and corresponding port
TRIS bit = 0.