8051 Lab Dac
8051 Lab Dac
E &TC SUBJECT: MC
EXPT. NO.: 4 DATE:
TITLE: Interfacing DAC with 89C51
PROBLEM STATEMENT:
A. Draw the interfacing diagram of DAC 808 and explain all the pin connections in the figure.
B. Write a program to interface DAC 808 to 8051. Apply the digital input to obtain a square wave.
C. Write a program to interface DAC 808 to 8051. Apply the digital input to obtain a triangular wave.
D. Write a program to interface DAC 808 to 8051. Apply the digital input to obtain a sine wave.
OBJECTIVE:
a. To understand the Keil IDE.
b. To study interfacing of DAC0808 with 8051
c. To study DAC 0808 working
d. To study generation of triangular, square, sine wave generation using DAC0808
S/W PACKAGES USED:
Keil IDE, Windows 7
1. THEORY
1.1 Digital-to-analog (DAC) converter
• The digital-to-analog converter (DAC) is a device widely used to convert digital pulses to analog
signals.
• two methods of creating a DAC: binary weighted and R/2R ladder.
• (DAC0808) uses the R/2R method
• The number of data bit inputs decides the resolution of the DAC since the number of analog output
levels is equal to 2^n, where n is the number of data bit inputs
• 8-input DAC such as the DAC0808 provides 256 discrete voltage (or current) levels of output.
Square wave is wave in which the amplitude alternates at a steady frequency between fixed
minimum and maximum values, with the same duration at minimum and maximum. The ratio of the high
period to the total period of any rectangular wave is called the duty cycle. A true square wave has a 50%
duty cycle (equal high and low periods). To generate a square wave, we first need a send high value
(0FFh or 255) to port on which DAC is connected and hold the high status for some time and for same
time send value low (00h)to port.
Triangular wave is wave in which the amplitude increases from low logic value to high logic value
forming positive-going ramp or slope (rise) and then amplitude decreases from high value logic to low
value logic forming negative-going ramp (decay). To generate a Triangular wave, we first need a send
incrementing value from 00h (0) to 0FFh (255) to port on which DAC is connected and then
decrementing value from 0FFh (255) to 00h (00).
2. Algorithm:
1. Start
2. Send high logic data (0FFh) on port pins.
3. Call delay subroutine
4. Send low logic data (00h) on port pins.
5. Call delay subroutine
6. Repeat step 2 – 5 to generate continuous wave
7. Stop
1. Start
2. Send the value incrementing from 00h to 0FFh on port pins.
3. Send the value decrementing from 0FFh to 00h on port pins.
4. Repeat step 2- 4 to generate continuous wave
5. Stop
1. Start
2. Set the counter register value to number of entries in DB
3. Use MOVC instruction to read value from DB
4. Send the value on port pins.
5. Decrement counter register value and jump to step 2 if not zero
6. Repeat step 2- 4 to generate continuous wave
7. Stop
4. References:
____________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________