0% found this document useful (0 votes)
20 views10 pages

DAC Interfacing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views10 pages

DAC Interfacing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

DAC Interfacing

Digital to Analog (DAC) converter


• It is a device widely used to convert digital pulses to analog signals.
• Two methods of creating a DAC: binary weighted and R/2R ladder.
• R/2R method is used to achieve a much higher degree of precision.
• The first criterion for judging a DAC is its resolution, which is the function of
binary inputs.
• The common ones are 8,10 and 12 bits.
• The number of data bit inputs decides the resolution of the DAC , since the
number of analog output levels is equal to 2n, where n is the number of data bit
inputs.
• An 8-bit DAC such as the DAC0808 provides 256 discrete voltage (or current)
levels of output.
• The 12-bit DAC provides 4096 discrete voltage levels.
MC1408 DAC (or DAC 0808)
• The digital inputs are converted to current (Iout), and by connecting a resistor to the
Iout pin, convert the result to voltage.
• The total current provided by the Iout pin is a function of the binary numbers at the
D0-D7 inputs of the DAC0808 and the reference current (Iref), and is as follows,
• Iout = Iref(D7/2+D6/4+D5/8+D4/16+D3/32 +D2/64 +D1/128 +D0/256)
• D0=LSB, D7=MSB for the inputs, Iref= input current that must be applied to pin14.
The Iref current is generally set to 2.0mA.
8051 connection to DAC0808

• The generation of current reference (setting Iref=2mA) by using the standard 5-V
power supply and 1K and 1.5K ohm standard resistors.
• Zener diode (LM336) overcomes any fluctuation with the power supply voltage.
• Assuming that Iref=2mA, if all the inputs to the DAC are high, the maximum
output current is 1.99mA.
Converting Iout to voltage in DAC0808
• Ideally, the output pin Iout to a resistor is connected, convert this
current to voltage and monitor the output on the scope.
• In real life, however this can cause inaccuracy since the input
resistance of the load where it is connected will also affect the output
voltage.
• For this reason, the Iref current output is isolated by connecting it to an
op-amp such as 741 with Rf=5K ohms for the feedback resistor.
• Assuming that R=5K ohms, by changing the binary input, the output
voltage changes.
Generating a sine wave
• To generate a sine wave, a table shown below is required whose value represents the magnitude of
the sine of angles between 0 and 360 degrees.
• The values for the sine function vary from -1.0 to +1.0 for 0 to 360 degree angles.
• The table values are integer numbers representing the voltage magnitude for the sine of theta.
• Table shows the angles, the sine values, the voltage magnitudes, and
the integer values representing the voltage magnitude for each angle
(with 30 degree increment).
• It is assumed that the full-scale voltages of 10V for DAC output is
designed.
• To achieve the full-scale 10V output, the following equation is used
• Vout = 5V+(5x sin )
• Verify the values given for the following angles: (a) 300 (b) 600
• (a) Vout = 5V + (5Vx sin )= 5V+5 x sin300= 5V+5 x 0.5 =7.5V
DAC input values = 7.5v X 25.6= 192 (decimal)
• (b) Vout = 5V + (5Vx sin ) = 5V+5x sin600= 5V+5x0.866= 9.33V
DAC input values = 9.33Vx 25.6 = 238 (decimal)
• To find the value sent to the DAC for various angles, multiply the Vout
by 25.6 because there are 256 steps and full-scale Vout is 10 volts.
• Therefore 256 steps/10V=25.6 steps per volt.
Programming DAC in C
#include <reg51.h>
sfr DACDATA = P1;
void main ()
{
unsigned char WAVEVALUE [12]= (128,192,238,255,238,192,128,64,17,0,17,64);
unsigned char x;
while (1)
{
for (x=0;x<12;x++)
{
DACDATA = WAVEVALUE [x];
}
}
}
Angle vs. Voltage Magnitude for Sine Wave

You might also like