ADC Event Triggered

An ADC conversion can be triggered by an event. This is enabled by writing a ‘1’ to the Start Event Input bit (STARTEI) in the Event Control register (ADCn.EVCTRL).
Figure 1. ADC0.EVTRL - enable STARTEI bit
ADC0.EVCTRL |= ADC_STARTEI_bm;

Any incoming event routed to the ADC through the Event System (EVSYS) will trigger an ADC conversion. The event trigger input is edge sensitive. When an event occurs, STCONV in ADCn.COMMAND is set. STCONV will be cleared when the conversion is complete.

For example, to start the ADC conversion on RTC overflow, the following settings must be made:
  1. 1.The RTC overflow event must be linked to channel 0 of the Event System
  2. 2.The Event User ADC0 must be configured to take its input from channel 0
  3. 3.The STARTEI bit in the EVCTRL register of the ADC must be set to enable the ADC conversion to be triggered by events
EVSYS.CHANNEL0 = EVSYS_GENERATOR_RTC_OVF_gc; /* Real Time Counter overflow */
EVSYS.USERADC0 = EVSYS_CHANNEL_CHANNEL0_gc; /* Connect user to event channel 0 */
ADC0.EVCTRL |= ADC_STARTEI_bm; /* Enable event triggered conversion */
Tip: The full code example is also available in the Appendix section.