33.3.2 Basic Operation

The following steps are recommended to initialize and run the ADC in basic operation:
  1. Configure the timebase by writing to the TIMEBASE bit field in the TIMEBASE (CLKCTRL.TIMEBASE) register of the Clock Controller.
  2. Enable the ADC by writing a ‘1’ to the ENABLE bit in the Control A (ADCn.CTRLA) register.
  3. Configure the Prescaler (PRESC) bit field in the Control B (ADCn.CTRLB) register.
  4. Configure the Reference Select (REFSEL) bit fields in the Control C (ADCn.CTRLC) register.
  5. Configure the Sample Duration (SAMPDUR) bit field in the Control E (ADCn.CTRLE) register.
  6. Optional: Configure the number of samples to be accumulated by writing the Sample Accumulation Number Select (SAMPNUM) bit field in the Control F (ADCn.CTRLF) register.
  7. Optional: Enable the Free-Running mode by writing a ‘1’ to the Free-Running (FREERUN) bit in the Control F register.
  8. Configure a positive input by writing to the MUXPOS bit field in the Positive Input Multiplexer (ADCn.MUXPOS) register.
  9. Optional: Configure a negative input by writing to the MUXNEG bit field in the Negative Input Multiplexer (ADCn.MUXNEG) register.
  10. Optional: Select Differential ADC conversion by writing a ‘1’ to the Differential (DIFF) bit in the Command (ADCn.COMMAND) register.
  11. Configure the mode of operation for the ADC by writing to the MODE bit field in the Command register.
  12. Configure how an ADC conversion will start by writing to the START bit field in the Command register. If the IMMEDIATE command is written, a conversion will start immediately.
  13. Wait until the Result Ready (RESRDY) bit in the Interrupt Flags (ADCn.INTFLAGS) register is ‘1’ before reading the updated Result (ADCn.RESULT) register.