Digital-to-analog converter

Digital-to-analog converter (DAC) converts a digital signal into an analog voltage. The AVR xmega DAC output voltage can range from 0 to the reference voltage. The DAC digital input resolution is 12-bit and the throughput is up to 1 million conversions per second (MSPS) per channel.

The input value can be provided as 12-bit or 8-bit, similarly to the ADC. The ATxmega128A1U controller has 2 DAC modules, each with 2 channels, for a total of 4 DAC outputs. The reference voltage can be AVcc, the internal 1.00 V, or the analog reference inputs AREFA or AREFB.

Example

The example shows configuring one DACA channel and setting its value. DACA CH0 is connected to pin PA2 on the ATxmega128A1U controller.

// Enable DACA and channel CH0
DACA.CTRLA = (DAC_CH0EN_bm|DAC_ENABLE_bm);
// Set DACA channel CH0 to single-channel mode
DACA.CTRLB = (DAC_CHSEL_SINGLE_gc);
// Set DACA reference voltage to AVcc
DACA.CTRLC = (DAC_REFSEL_AVCC_gc);
 
// Wait until the previous conversion is finished
while((DACA.STATUS & DAC_CH0DRE_bm) == 0);
// Set DACA CH0 output to ~2V
DACA.CH0DATA = 2000;
en/avr/dac.txt · Last modified: by 127.0.0.1
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0