ADuC - DAC

ADCs and DACs are main features of ADuC7000 series microcontrollers. Converters in those are 12-bit. DACs are very easy to handle therefore they are described first on this page. In ADuC microcontrollers there may be 2, 3 or 4 12-bit DACs with integrated Rail-To-Rail buffer and with 2.5V reference source.

It is possible to use on of 3 reference voltage sources:

  • DACREF - (internal reference source)
  • VREF - (2.5V internal reference source)
  • AVDD - analog power suppy

Integrated buffer ensures proper work with load 5 kOHM/ 100pF

Memory Mapped Registers (MMR) are explained below:

Register Function
DACxCON DAC's configuration (update; clearing register; selection of reference voltage or setting high-impedance on the output
DACxDAT data register of DAC converter.

It is only required to set DACxCON (x - number of DAC) register with appropriate value to ensure proper work of DAC converter. DACxCON allows selecting source used for updating samples (value of 1 = samples on the output will be updated by Timer 1 - refer to chapter about Timers; for value of 0 = sample on the output will be updated with HCLK clock signal - refer to chapter about PLL)

The register DACxCON also allows zeroing data register value. To do that a value of 1 must be written to 4th bit of register DACCLR). Setting two LSBs[1:0] - selects a source of reference voltage
or switching converter into sleep mode (00b). After setting correct value of register DACxCON - data can be written to DACxDAT register. This will cause DAC to output requested analog value.



Nonlinearities

Nonlinearities of DAC can be noticeable while moving close to 0mV (nonlinearity can be start at around <100mV; and can be also noticeable when outputting voltages that are close to >AVDD supply voltage - 100mV).


Examples

Simple examples shows DAC connected to LED diode, connected to DAC1 converter.

#include <ADuC7024.H><br />
/* need to set switch on the eval board to correct position */
 
<strong>int</strong> main(<strong>void</strong>)
{
<strong>int</strong> dac_out = 0;
<strong>int</strong> i;
DAC1CON = 0x13;
 
<strong>while</strong>(1)
{
	DAC1DAT = dac_out << 20;
 
	<strong>if</strong> (dac_out == 192)
		dac_out = 0;
	  <strong>else</strong>
		dac_out++;
 
	<strong>for</strong> (i=0; i<5000; i++);
 
}
 
}<br />