Thursday, March 31, 2016

8051 DAC Interfacing

Digital-to-Analog Converter (DAC) is a device widely used to convert digital pulses to analog signals. The number of data bit inputs decides the resolution of the DAC since the number of analog output levels is equal to 2”, where n is the number of data bit inputs. Therefore, an 8-input DAC provides 256 discrete voltage (or current) levels of output.

8051 DAC Interfacing

Let’s assume a 8-bit input DAC with reference voltage +5V and full scale output of 10V. Full-scale output of the DAC is achieved when all the data inputs of the DAC are high. The following equation is used to achieve full scale output. Vout = 5V + (5 * sin θ). To find the value sent to the DAC for various angles, we simply multiply the Vout voltage by 25.60 because there are 256 steps and full-scale Vout is 10 volts. Therefore, 256 steps /10 V = 25.6 steps per volt.

To generate sine wave, the following table is used to calculate DAC input.
Angle Magnitude Vout DAC Input
0 5 128
30° 0.5 7.5 192
60° 0.866 9.33 238
90° 1.0 10 255
120° 0.866 9.33 238
150° 0.5 7.5 192
180° 0 5 128
210° -0.5 2.5 64
240° -0.866 0.669 17
270° -1.0 0 0
300° -0.866 0.669 17
330° -0.5 2.5 64
360° 0 5 128

ORG 0H
COUNT EQU 13
AGAIN: MOV DPTR, #TABLE
MOV R2, #COUNT
BACK: CLR A
MOVC A, @A+DPTR
MOV P1, A
INC DPTR
DJNZ R2, BACK
SJMP AGAIN
ORG 300H
TABLE: DB 128, 192, 238, 255, 238, 192
DB 128, 64, 17, 0, 17, 64, 128
END



Related topics:
8051 External Program Memory Interfacing   |   8051 External Data Memory Interfacing   |   8051 Memory Mapped IO   |   8051 LED Interfacing   |   8051 Switch Interfacing   |   8051 Keyboard Interfacing   |   8051 7-Segment Display Interfacing   |   8051 LCD Interfacing   |   8051 ADC Interfacing   |   8051 Relay Interfacing   |   8051 Sensor Interfacing   |   8051 Stepper Motor Interfacing   |   8051 DC Motor Interfacing

List of topics: 8051

No comments:

Post a Comment