Datasheet
Figure 34-9. Input Swapping for Offset Compensation
MUXPOS
MUXNEG
+
-
COMPx
SWAP
ENABLE
HYSTERESIS
SWAP
CMPx
COMPCTRLx
34.6.12 Interrupts
The AC has the following interrupt sources:
• Comparator (COMP0, COMP1, COMP2, COMP3): Indicates a change in comparator status.
• Window (WIN0, WIN1): Indicates a change in the window status.
Comparator interrupts are generated based on the conditions selected by the Interrupt Selection bit group
in the Comparator Control registers (COMPCTRLx.INTSEL). Window interrupts are generated based on
the conditions selected by the Window Interrupt Selection bit group in the Window Control register
(WINCTRL.WINTSELx[1:0]).
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status
and Clear (INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be
individually enabled by writing a one to the corresponding bit in the Interrupt Enable Set (INTENSET)
register, and disabled by writing a one to the corresponding bit in the Interrupt Enable Clear (INTENCLR)
register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is
enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or
the AC is reset. See INFLAG register for details on how to clear interrupt flags. All interrupt requests from
the peripheral are ORed together on system level to generate one combined interrupt request to the
NVIC. The user must read the INTFLAG register to determine which interrupt condition is present.
Note that interrupts must be globally enabled for interrupt requests to be generated.
Related Links
11.2 Nested Vector Interrupt Controller
34.6.13 Events
The AC can generate the following output events:
• Comparator (COMP0, COMP1, COMP2, COMP3): Generated as a copy of the comparator status
• Window (WIN0, WIN1): Generated as a copy of the window inside/outside status
Output events must be enabled to be generated. Writing a one to an Event Output bit in the Event Control
register (EVCTRL.COMPEOx) enables the corresponding output event. Writing a zero to this bit disables
the corresponding output event. The events must be correctly routed in the Event System.
The AC can take the following action on an input event:
• Single-shot measurement
• Single-shot measurement in window mode
SAM D21 Family
AC – Analog Comparators
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40001882D-page 940