Atmel Xplained Pro Evaluation Kit ATSAMD20-XPRO ATSAMD20-XPRO Data Sheet

Product codes
ATSAMD20-XPRO
Page of 660
522
Atmel | SMART SAM D20 [DATASHEET]
Atmel-42129K–SAM-D20_datasheet–06/2014
29.7
Additional Features
29.7.1 Interrupts
The peripheral has the following interrupt sources:
z
Comparator: COMP0, COMP1(INTENCLR, INTSET, INTFLAG)
z
Window: WIN0(INTENCLR, INTSET, INTFLAG)
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.WINTSEL[1:0]).
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear 
register (INTFLAG) 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 register (INTENSET), and disabled by writing a one to the 
corresponding bit in the Interrupt Enable Clear register (INTENCLR). 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 peripheral is reset. An interrupt flag is cleared by writing a one to the 
corresponding bit in the INTFLAG register. 
Each peripheral can have one interrupt request line per interrupt source or one common interrupt request line for all the 
interrupt sources. If the peripheral has one common interrupt request line for all the interrupt sources, the user must read 
the INTFLAG register to determine which interrupt condition is present.
For details on clearing interrupt flags, refer to the INTFLAG register description.
Note that interrupts must be globally enabled for interrupt requests to be generated. Refer to 
29.7.2 Events
The peripheral can generate the following output events:
z
Comparator: COMPEO0, COMPEO1(EVCTRL)
z
Window: WINEO0(EVCTRL)
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. Refer to 
for details.
The peripheral can take the following actions on an input event:
z
Single-shot measurement
z
Single-shot measurement in window mode
Input events must be enabled for the corresponding action to be taken on any input event. Writing a one to an Event 
Input bit in the Event Control register (EVCTRL.COMPEIx) enables the corresponding action on input event. Writing a 
zero to a bit disables the corresponding action on input event. Note that if several events are connected to the peripheral, 
the enabled action will be taken on any of the incoming events. The events must be correctly routed in the Event System. 
Refer to 
 for details.
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.
29.7.3 Sleep Mode Operation
The Run in Standby bit in the Control A register (CTRLA.RUNSTDBY) controls the behavior of the AC during standby 
sleep mode.  When the bit is zero, the comparator pair is disabled during sleep, but maintains its current configuration. 
When the bit is one, the comparator pair continues to operate during sleep. Note that when RUNSTDBY is zero, the