
Rev. 1.00
217 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
13 Comparator (CMP) (HT32F54243/HT32F54253 only)
13 Comparator (CMP) (HT32F54243/HT32F54253 only)
Power Mode and Hysteresis
The comparator response time can be programmed to meet the trade-off between the power
consumption and application speed requirements. The bit CMPSM in the CMPCRn register can
be programmed as “0” to make the comparator operate in the low speed mode with low power
consumption.
The comparator also has four hysteresis levels to avoid spurious output transitions in case of noisy
signals. The bits CMPHM[1:0] in the CMPCRn register can be configured to obtain different
hysteresis levels for the comparator.
Comparator Write-Protected Mechanism
As the comparator can be used for safety purposes, it is necessary to ensure that the comparator
configurations will not be altered due to spurious register access or program counter corruption.
For this purpose, the write protection is provided by writing a specific value into the PROTECT
field in the Comparator Control Register CMPCRn. The write protection function is enabled
by default. Before configuring the bits [15:0] in the Comparator Control Register CMPCRn, the
pattern, 0x9C3A, must first be written into the register protection bits [31:16] in the CMPCRn
register. Then the write protection will be disabled and the bits [15:0] can be configured by
application program. For the same reason, the comparator input and output can also be locked using
the corresponding configuration lock bit in the Port n Lock Register PnLOCKR (n = A ~ D) in the
GPIO unit.
Register Map
The following table shows the CMP registers and reset values.
Table 30. CMP Register Map
Register
Offset
Description
Reset Value
CMPCR0
0x000
Comparator Control Register 0
0x0001_0000
CVRVALR0
0x004
Comparator Voltage Reference Value Register 0
0x0000_0000
CMPIER0
0x008
Comparator Interrupt Enable Register 0
0x0000_0000
CMPTFR0
0x00C
Comparator Transition Flag Register 0
0x0000_0000
CMPCR1
0x100
Comparator Control Register 1
0x0001_0000
CVRVALR1
0x104
Comparator Voltage Reference Value Register 1
0x0000_0000
CMPIER1
0x108
Comparator Interrupt Enable Register 1
0x0000_0000
CMPTFR1
0x10C
Comparator Transition Flag Register 1
0x0000_0000