70 www.ubicom.com IP2022 Data Sheet 5.8 Comparator The  IP2022  has  an  on-chip  analog  comparator  which
uses alternate functions of the RG0, RG1, and RG2 port
pins. The RG1 and RG2 pins are the comparator negative
and positive inputs, respectively, while the RG0 pin is the
comparator output pin. To use the comparator, software
must program the port direction register (RGDIR) so that
RG1  and  RG2  are  inputs.  RG0  may  be  set  up  as  a
comparator output pin.
Figure 5-17  Analog Comparator The comparator enable bits are cleared on reset, which
disables  the  comparator.  To  avoid  drawing  additional
current during power-down mode, the comparator should
be disabled before entering power-down mode. A 50 mV
hysteresis   is   applied   between   the   inputs,   when   the
CMPHYS bit is set in the CMPCFG register.
5.8.1 CMPCFG Register The CMPCFG register is used to enable the comparator,
to read the output of the comparator internally, to enable
the output of the comparator to the comparator output pin,
and to enable the hysteresis. Section 7.1.3 shows the bits
in this register.
515-017.eps + -  CMPEN,
CMPHYS    CMPRES    CMPOE
RG2 RG0 RG1