0% found this document useful (0 votes)
2K views6 pages

8051 Lab Dac

This document describes interfacing a DAC0808 digital-to-analog converter with an 8051 microcontroller to generate different analog waveforms. It includes: 1) An explanation of the DAC0808 pin connections and functionality for converting digital inputs to analog current or voltage outputs. 2) Algorithms for programming the 8051 to send input values to the DAC0808 to generate square, triangular, and sine wave outputs. 3) The document serves as an experiment on understanding the Keil IDE, DAC0808 interfacing, and generating different waves using the DAC0808's analog output. Source code and results are provided in separate attachments.

Uploaded by

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

8051 Lab Dac

This document describes interfacing a DAC0808 digital-to-analog converter with an 8051 microcontroller to generate different analog waveforms. It includes: 1) An explanation of the DAC0808 pin connections and functionality for converting digital inputs to analog current or voltage outputs. 2) Algorithms for programming the 8051 to send input values to the DAC0808 to generate square, triangular, and sine wave outputs. 3) The document serves as an experiment on understanding the Keil IDE, DAC0808 interfacing, and generating different waves using the DAC0808's analog output. Source code and results are provided in separate attachments.

Uploaded by

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

CLASS: T.E.

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.

Fig.: Block Diagram of DAC0808

Microcontrollers (T.E.E &TC) 2017_2018


4.1
Fig.: Pin Diagram of DAC0808
• the digital inputs are converted to current (I out), and by connecting a resistor to the I out pin, we convert
the result to voltage.
• The total current provided by the I out pin is a function of the binary numbers at the DO - D7 inputs of
the DAC0808 and the reference current (I ref), and is as follows
• where DO is the LSB, D7 is the MSB for the inputs
• The Iref current is generally set to 2.0 mA
Converting Iout to voltage in DAC0808, Ideally we connect the output pin Iout to a resistor, 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 Iout current output is isolated by connecting it to an op-amp such as the
741.

1.2 Interfacing of DAC0808 with 8051:

Explanation of pin connections:


(+Vref, -Vref, Comp, D0-D7, OUT )

Microcontrollers (T.E.E &TC) 2017_2018


4.2
1.3 To generate square wave:

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.

Fig. Square wave

1.4 To generate triangular wave:

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).

Microcontrollers (T.E.E &TC) 2017_2018


4.3
Fig. Triangular wave
1.2 To generate sine wave:
To generate a sine wave, we first need a table whose values represent 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. Therefore, the table values are integer numbers representing the voltage magnitude for the
sine of theta. This method ensures that only integer numbers are output to the DAC by the 8051
microcontroller.

Microcontrollers (T.E.E &TC) 2017_2018


4.4
Fig. Sine wave

2. Algorithm:

2.1 To generate square wave

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

2.2 To generate triangular wave

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

2.3 To generate sine wave

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

Microcontrollers (T.E.E &TC) 2017_2018


4.5
3. Source code (Attach separate Sheet)

4. References:

a. Mazidi, 8051 microcontroller & embedded system 3rd Edition ,Pearson

b. Datasheet of 8051 microcontroller

5. Result & Conclusion

____________________________________________________________

____________________________________________________________

____________________________________________________________

____________________________________________________________

Microcontrollers (T.E.E &TC) 2017_2018


4.6

You might also like