41.3.2 Initialization

The following steps are recommended to initialize and run the ADC in the basic operation:
  1. Configure the timebase by writing to the TIMEBASE bit field in the Main Clock Timebase (MCLKTIMEBASE) register in the Clock Controller (CLKCTRL).
  2. Configure the Prescaler (PRESC) bit field in the Control B (ADCn.CTRLB) register.
  3. Configure the Reference Select (REFSEL) bit field in the Control C (ADCn.CTRLC) register.
  4. Configure the Sample Duration (SAMPDUR) bit field in the Control E (ADCn.CTRLE) register.
  5. 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.
  6. Optional: Enable the Free-Running mode by writing a ‘1’ to the Free-Running (FREERUN) bit in the Control F (ADCn.CTRLF) register.
  7. Configure a positive input by writing to the MUXPOS bit field in the Positive Input Multiplexer (ADCn.MUXPOS) register.
  8. Configure the mode of operation for the ADC by writing to the MODE bit field in the Command (ADCn.COMMAND) register.
  9. Configure how an ADC conversion will start by writing to the START bit field in the Command (ADCn.COMMAND) register.
  10. Enable the ADC by writing a ‘1’ to the ENABLE bit in the Control A (ADCn.CTRLA) register.