32.3.1 Initialization
To operate the DAC, the following steps are required:
- Select the DAC reference voltage in the Voltage Reference (VREF) peripheral by writing the DAC and AC Reference Selection (DACnREFSEL) bits in the Control x (VREF.CTRLx) register.
- The conversion range is between GND and the selected reference voltage.
- Configure the further usage of the DAC output:
- Configure an internal peripheral (e.g., AC, ADC) to use the DAC output. Refer to the according peripheral’s documentation.
- Enable the output to a pin by
writing a ‘
1
’ to the Output Enable (OUTEN) bit in the Control A (DAC.CTRLA) register. This requires a configuration of the Port peripheral.
- Write an initial digital value to the Data (DAC.DATA) register.
- Enable the DAC by writing a
‘
1
’ to the ENABLE bit in the DAC.CTRLA register.