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