Datasheet

other configuration registers must be stable during the conversion. The source for GCLK_ADC is selected
and enabled in the System Controller (SYSCTRL). Refer to SYSCTRL – System Controller for more
details.
When GCLK_ADC is enabled, the ADC can be enabled by writing a one to the Enable bit in the Control
Register A (CTRLA.ENABLE).
Related Links
17. SYSCTRL – System Controller
33.6.2.2 Enabling, Disabling and Reset
The ADC is enabled by writing a '1' to the Enable bit in the Control A register (CTRLA.ENABLE). The
ADC is disabled by writing CTRLA.ENABLE=0. The ADC is reset by writing a '1' to the Software Reset bit
in the Control A register (CTRLA.SWRST). All registers in the ADC, except DBGCTRL, will be reset to
their initial state, and the ADC will be disabled.
The ADC must be disabled before it is reset.
33.6.2.3 Operation
In the most basic configuration, the ADC samples values from the configured internal or external sources
(INPUTCTRL register). The rate of the conversion depends on the combination of the GCLK_ADCx
frequency and the clock prescaler.
To convert analog values to digital values, the ADC needs to be initialized first, as described in 33.6.2.1
Initialization. Data conversion can be started either manually by setting the Start bit in the Software
Trigger register (SWTRIG.START=1), or automatically by configuring an automatic trigger to initiate the
conversions. A free-running mode can be used to continuously convert an input channel. When using
free-running mode the first conversion must be started, while subsequent conversions will start
automatically at the end of previous conversions.
The automatic trigger can be configured to trigger on many different conditions.
The result of the conversion is stored in the Result register (RESULT) overwriting the result from the
previous conversion.
To avoid data loss if more than one channel is enabled, the conversion result must be read as soon as it
is available (INTFLAG.RESRDY). Failing to do so will result in an overrun error condition, indicated by the
OVERRUN bit in the Interrupt Flag Status and Clear register (INTFLAG.OVERRUN). When the RESRDY
interrupt flag is set, the new result has been synchronized to the RESULT register.
To enable one of the available interrupts sources, the corresponding bit in the Interrupt Enable Set
register (INTENSET) must be written to '1'.
33.6.3 Prescaler
The ADC is clocked by GCLK_ADC. There is also a prescaler in the ADC to enable conversion at lower
clock rates.
Refer to CTRLB for details on prescaler settings.
SAM D21 Family
ADC – Analog-to-Digital Converter
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40001882D-page 895