BAT32G1x9 user manual | Chapter 17 Comparator
555 / 1149
Rev.1.02
17.4.13
The output of comparator i (i=0, 1).
The comparison results of the comparator can be output to an external pin, and the output polarity
(positive or inverting output) can be set through the CiOP and CiOE bits of the COMLOCR register and
whether the output is allowed. For register settings and comparator output correspondence, refer to "17.3.4
Comparator Output Control Register (COMPOCR)".
To output the comparison result of the comparator to the output pin of the VCOUTi, you must follow the
steps below to set the port (after reset, the port is in the input state):
①
Set the mode of the comparator (Steps 2 to 5 of "Setting Registers Related to Table 17-3
Comparators").
②
Sets the VCOUTi output of the comparator (sets the COMCCR register, selects the polarity
and enable the output).
③
Place the VCOUTi's output pin corresponding to the port mode control register position
"0".
④
Place the output pin of the VCOUTi at the position "0" of the port register corresponding
to it.
⑤
Set the port direction register corresponding to the output pin of the VCOUTi to the output
(starting with the pin output).
17.4.14
Stop and provision of the comparator clock
In the case of stopping the comparator clock by setting the peripheral enable register 1 (PER1), it must
be set as follows:
①
Place the CiENB position of the COMMDR register "0" (stop the comparisonr from running).
②
Place the interrupt request flag register at IF position "0" (clear the unneeded interrupt before the
comparator stops).
③
Place the PGACMPEN position of the PER1 register "0".
If the clock is stopped by setting the PER1 register, the internal registers of the comparator are all
initialized, so to use the comparator again, the registers must be set according to the steps in Table 17-3.
Note 1
If you set the comparator
n
reference voltage selection bit
(
CnVRF) of the comparator
mode setting register
(
COMPMDR) to
"1"
(the comparator
n
reference voltage is the internal reference voltage
(1.45V)), the
output of
the temperature sensor
cannot be
A/D
converted by
an A/D
converter.
2. If DMA startup is allowed in one of the following states, the
DMA
transfer starts and an interruption occurs after
the transfer ends. Therefore, it is necessary to
enable
DMA
to start after the monitor flag (
CnMON) of the
acknowledging comparator
.
•Set to generate an interrupt request (CnEDG=0
) through the single edge detection of the comparator and
an interrupt request (
CnEPO=0)
through the rising edge of the comparator
and
VCIN
>
VREF
(or internal
reference
voltage).
1.45V)
。
•Set to produce an interrupt request through the comparator's one-edge detection (CnEDG=0) and an interrupt request
is generated through the falling edge of the comparator (CnEPO=1) AndVCIN
<
VREF(Or internal reference
voltage.)1.45V)
。
(n=0, 1)