The following steps are required to operate the DAC:

  1. 1.Select the DAC reference voltage in the Voltage Reference (VREF) peripheral by writing the appropriate Reference Selection bits.
  2. 2.Configure the further usage of the DAC output:
    • Configure an internal peripheral to use the DAC output. Refer to the documentation of the respective peripherals.
    • Enable the output to a pin by writing a ‘1’ to the Output Buffer Enable (OUTEN) bit. The input for the DAC pin must be disabled in the Port peripheral (ISC = INPUT_DISABLE in PORTx.PINCTRLn).
  3. 3.Write an initial digital value to the Data (DACn.DATA) register.
  4. 4.Enable the DAC by writing a ‘1’ to the ENABLE bit in the Control A (DACn.CTRLA) register.