
Rev. 1.00
216 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
13 Comparator (CMP) (HT32F54243/HT32F54253 only)
Interrupts and Wakeup
The comparator can generate an interrupt when its output waveform generates a rising or falling
edge and its corresponding interrupt enable control bit is also set.
For example, when a comparator output rising edge occurs, the comparator rising edge flag bit
CMPRF in the Comparator Transition Flag Register CMPTFRn will be set. If the comparator
output rising edge interrupt enable control bit CMPRIEN in the Comparator Interrupt Enable
Register CMPIERn is enabled, an interrupt will then be generated and sent to the NVIC unit.
Writing “1” into the comparator rising edge flag bit CMPRF in the Comparator Transition Flag
Register CMPTFRn will clear the CMPRF bit. The comparator output falling edge interrupt also
has the same corresponding interrupt setting. A block diagram of interrupt signals for comparators
is shown in the following figure.
CMPRIEN
CMPRF
CMPFF
CMPFIEN
NVIC CMP Interrupt
CMP0
CMPRIEN
CMPRF
CMPFF
CMPFIEN
CMP1
Figure 37. Comparator Interrupt Signals
The comparator outputs are also internally connected to the EXTI Wakeup Event Management unit.
The comparator output rising transition is used to wake up the MCU from the Sleep, Deep-Sleep1
or Deep-Sleep2
mode when the comparator wakeup enable bit CMPWPEN is set in the Comparator
Control Register CMPCR
n. A block diagram of wakeup signals for comparators is shown in the
following figure.
CMPOUT
CMPWPEN
EXTI
CMP_WAKEUP
CMP0
CMPOUT
CMPWPEN
CMP1
Figure 38. Comparator Wakeup Signals