To operate the DAC, the following steps are required:

  1. 1.Select the DAC reference voltage in the Voltage Reference (VREF) peripheral by writing the DAC and AC Reference Selection (DACnREFSEL) bit field in the Control x (VREF.CTRLx) register.
  2. 2.The conversion range is between GND and the selected reference voltage in the Voltage Reference (VREF) peripheral.
  3. 3.Configure the further usage of the DAC output:
    1. 3.1.Configure an internal peripheral (e.g., AC, ADC) to use the DAC output. Refer to the documentation of the respective peripherals.
    2. 3.2.Enable the output to a pin by writing a ‘1’ to the Output Enable (OUTEN) bit in the Control A (DACn.CTRLA) register. This requires a configuration of the Port peripheral.
    For DAC0, either one or both options are valid. Other instances of the DAC only support internal signaling.
  4. 4.Write an initial digital value to the Data (DACn.DATA) register.
  5. 5.Enable the DAC by writing a ‘1’ to the ENABLE bit in the DACn.CTRLA register.