AT32F421
Series Reference Manual
2022.11.11
Page 323
Rev 2.02
19
Comparator (COMP)
19.1 COMP introduction
AT32F421 embeds an ultra-low-power comparator (CMP). They can be used for various purposes, such
as, external analog signal monitor/control and wakeup from low-power mode, and working with other
timers for pulse width measurement and PWM signal control.
Figure 19-1 Block Diagram of Comparator
GNDA
P A0
P A1
P A5
P A2
P A0
P A5
P A4
V RE FI NT44
V RE FI NT34
V RE FI NT24
V RE FI NT14
CMP IS
1=Clos e
0=Open
OUT
8 TO
1
MUX
4 TO
1
MUX
OUT
CMP _INV
CMP _NINV
111
110
101
100
011
010
001
000
11
10
01
00
+
-
COMP
CMP EN
CMP SS E L_LV1
CMP SS E L_LV0
CMP HYS T_LV1
CMP HYS T_LV0
CMP _OUT_LV
P A0/P A6/P A11
CMP i nt errupt reques t
(to EX TI)
CMP _OUT
TM R1_B RK 1
TM R1_CH_CLR
TM R1_CH1
TM R3_CH1
TM R3_CH_CLR
Analog
Digital
Digit al
De-bounc e
Fil ter
P olari ty
s elect ion
B lanki ng
Func ti on
CMP INV SE L
CMP NINV SE L
V2V
V RE FI NT
S CA LEN
B RG EN
V RE FI NT44
V RE FI NT34
V RE FI NT24
V RE FI NT14
B lanki ng
S ourc e
S elect
TM R1_OC4
TM R3_OC3
TM R15_OC2
TM R15_OC1
19.2 Main features
Programmable hysteresis level
Timer output as comparator blanking source
Programmable output polarity
Programmable output speed
Selectable positive/negative input sources
―
I/O pins
―
Internal reference voltage and three divider values (1/4, 1/2, 3/4)
Output redirectioning
―
General-purpose I/O
―
Timer brake input TMRx_BRK
―
Timer input capture TMR_CH
―
Timer output compare reference value clear TMR_CH_CLR
Wakeup device from low-power mode through EXINT interrupts
19.3 Interrupt management
The output of the analog comparator, which is filtered by a digital filter and whose polarity is selected, is
input to the EXINT_21 line to generate an external interrupt or event, which can be used to wake up the
system from low-power mode.
For more detailed information, please refer to the section of interrupts and events.