This example demonstrates use of the Digital to Analog Converter (DAC) for dual-channel output with automatic refresh.
The DAC driver API can be found here.
All AVR XMEGA devices with a DAC can be used.
This example sets up the configured DAC (OUTPUT_DAC) to perform DA conversions on both channels, with output to their respective pins, every time it receives events in event channel 0. Timer/counter 0 on port C is used to generate the events on overflow. This setup gives a constant conversion rate.
The main loop in the example waits for the DAC channels to get ready for new data, then alternately feeds them with values that are 10% and 90% of maximum to demonstrate settling and hold time of the DAC.
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.