Datasheet

Writing a one to an Event Input bit into the Event Control register (EVCTRL.COMPEIx) enables the
corresponding action on input event. Writing a zero to this bit disables the corresponding action on input
event. Note that if several events are connected to the AC, the enabled action will be taken on any of the
incoming events. Refer to the Event System chapter for details on configuring the event system.
When EVCTRL.COMPEIx is one, the event will start a comparison on COMPx after the start-up time
delay. In normal mode, each comparator responds to its corresponding input event independently. For a
pair of comparators in window mode, either comparator event will trigger a comparison on both
comparators simultaneously.
34.6.14 Sleep Mode Operation
The Run in Standby bits in the Comparator x Control registers (COMPCTRLx.RUNSTDBY) control the
behavior of the AC during standby sleep mode. Each RUNSTDBY bit controls one comparator. When the
bit is zero, the comparator is disabled during sleep, but maintains its current configuration. When the bit is
one, the comparator continues to operate during sleep. Note that when RUNSTDBY is zero, the analog
blocks are powered off for the lowest power consumption. This necessitates a start-up time delay when
the system returns from sleep.
When RUNSTDBY is one, any enabled AC interrupt source can wake up the CPU. While the CPU is
sleeping, single-shot comparisons are only triggerable by events. The AC can also be used during sleep
modes where the clock used by the AC is disabled, provided that the AC is still powered (not in
shutdown). In this case, the behavior is slightly different and depends on the measurement mode.
Table 34-1. Sleep Mode Operation
COMPCTRLx.MODE RUNSTDBY=0 RUNSTDBY=1
0 (Continuous) COMPx disabled GCLK_AC_DIG stopped, COMPx enabled
1 (Single-shot) COMPx disabled GCLK_AC_DIG stopped, COMPx enabled only when triggered
by an input event
34.6.14.1 Continuous Measurement during Sleep
When a comparator is enabled in Continuous Measurement mode and GCLK_AC_DIG is disabled during
sleep, the comparator will remain continuously enabled and will function asynchronously. The current
state of the comparator is asynchronously monitored for changes. If an edge matching the interrupt
condition is found, GCLK_AC_DIG is started to register the interrupt condition and generate events. If the
interrupt is enabled in the Interrupt Enable registers (INTENCLR/SET), the AC can wake up the device;
otherwise GCLK_AC_DIG is disabled until the next edge detection. Filtering is not possible with this
configuration.
Figure 34-10. Continuous Mode SleepWalking
GCLK_AC
Comparator
Output or Event
Comparator State
34.6.14.2 Single-Shot Measurement during Sleep
For low-power operation, event-triggered measurements can be performed during sleep modes. When
the event occurs, the Power Manager will start GCLK_AC_DIG. The comparator is enabled, and after the
start-up time has passed, a comparison is done, with filtering if desired, and the appropriate peripheral
events and interrupts are also generated, as the figure below. The comparator and GCLK_AC_DIG are
SAM D21 Family
AC – Analog Comparators
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40001882D-page 941