AN202
V1.0 | Page 57/73
www.cmostek.com
11 Comparator
The chip is integrated with 2 analog comparators. Since the function pins of the comparator2 are used for the
RF serial control bus at the same time, the 2 comparators can not be used.
It should be noted that when reading a port register, the value that the software read is 0 if the pin is
configured as an analog signal pin.When the pin is set to the digital input pin, the comparator will still think that
the pin will input an analog signal and output the corresponding result.If a pin is set to the digital input, and the
actual voltage on this pin is still an analog voltage, it may cause the input buffer circuit to consume more
current than that in the specifications.
The analog comparator has 8 configuration modes. They are selected by the CM<2:0> bit of the CMCON0
register. Because the functional pins are used in the RF serial control bus, there are only two statuses as
follows:
Comparator Reset (After POR)
CM<2:0> = 0b000
+
-
+
-
Off
Off
C1IN+
C1IN-
C2IN+
C2IN-
A
A
A
A
Comparator Off (Lowest Power)
CM<2:0> = 0b111
+
-
+
-
C1IN+
C1IN-
C2IN+
C2IN-
Off
Off
I/O
I/O
I/O
I/O
Analog function (A): The digital input cache is masked.
Digital function (D): The comparator digital output will cover the other functions in the pin.
Normal port function (I/O): Be independent of the comparator.
When the word "A" is marked on the port, the status of the current pin or the statusof the TRIS bit of the I/O
control register will return to 0 when reading.The user should set the TRIS bit corresponding to the the analog
input pin to 1 to close its digital output drive circuit.
When the word "D" is marked on the port, the user should set the corresponding TRIS bit to 0 to open the
digital output driver circuit.
In addition, the comparator configuration switching should mask the comparator interrupt to avoid
unnecessary mistrigger events.
Содержание CMT2189C
Страница 32: ...AN202 V1 0 Page 32 73 www cmostek com...