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 bits
(DAC0REFSEL) in the Control A register of the Voltage Reference (VREF.CTRLA) for DAC0. For
DAC1, use DAC1REFSEL in VREF.CTRLC. For
DAC2, use DAC2REFSEL in VREF.CTRLD.
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. See the according peripheral's documentation.
Enable the output to a pin by
writing a '1' to the Output Enable bit (OUTEN) in the Control A register
(DAC.CTRLA). This requires configuration of the Port peripheral.
For DAC0,
either one or both options are valid. Other instances of the DAC only support
internal signaling.
Write an initial digital value to the
Data register (DAC.DATA).
Enable the DAC by writing a '1' to the
ENABLE bit in the Control A register (DAC.CTRLA).