2.7 Events
The ADC can be connected to the event system. The event system lets peripherals communicate without CPU intervention, enabling the CPU to perform other tasks or stay in a sleep mode. The ADC can be connected either as an event generator, providing signals to another peripheral, or an event user, performing tasks based on the signals from another peripheral.
The following table shows the different available event generators from the ADC.
Generator Name | Description | Event Type | Generating Clock Domain | Length of Event | |
---|---|---|---|---|---|
Peripheral | Event | ||||
ADCn | RESRDY | Result ready | Pulse | CLK_PER | One CLK_PER period |
ADCn | SAMPRDY | Sample ready | Pulse | CLK_PER | One CLK_PER period |
ADCn | WCMP | Window compare match | Pulse | CLK_PER | One CLK_PER period |
- Event Generator: ADC0 RESRDY
- Event USER: EVOUT (PB2)
EVSYS.CHANNEL1 = EVSYS_CHANNEL1_ADC0_RES_gc; /* ADC Result Ready */ EVSYS.USEREVSYSEVOUTB = EVSYS_USER_CHANNEL1_gc; /* Asynchronous Event Channel 1 */
The ADC has one event user for detecting and acting upon input events. The table below describes the event user and the associated functionality.
User Name | Description | Input Detection | Async/Sync | |
---|---|---|---|---|
Peripheral | Event | |||
ADCn | START | ADC start on event | Edge | Async |
The START event action can be triggered if the EVENT_TRIGGER setting is written to the START bit field in the Command (ADCn.COMMAND) register as shown in the code snippet below.
ADC0.COMMAND = ADC_START_EVENT_TRIGGER_gc;
EVSYS.CHANNEL0 = EVSYS_CHANNEL0_RTC_OVF_gc; /* Real Time Counter overflow */ EVSYS.USERADC0START = EVSYS_USER_CHANNEL0_gc; /* Asynchronous Event Channel 0 */