You are on page 1of 3

EXPERIMENT #5

Interfacing A/D and D/A with the Microcontrollers


5.1 OBJECTIVE

The purpose of this experiment is to learn how analog to digital converters


facilitate communication between real life signals and the digital world, and
consequently to interface the A/D and D/A converters with AVR ATMega128.

5.2 PRELIMINARY WORK

5.2.1 Read through Chapter 14 of the textbook, DAC0808 datasheet, and A/D
converter portion of ATMega128 datasheet.

5.2.2 Give two factors that affect the A/D converter step size calculation.

5.2.3 The following figure is a block diagram of a successive approximation A/D


converter. Explain the purpose of each part of the block diagram shown
below.

Figure 5.1. Successive Approximation ADC

5.2.4 A 10-bit A/D converter uses successive approximation, and it is driven by an


800-kHz clock. Each step requires four clock cycles. Estimate the conversion
time.

5.2.5 Write a program in both Assembly and C that uses the A/D Converter of the
Atmega128 to perform A/D conversions on an analog signal applied through
a port F pin. The conversions will use 10 MHz clock. Display the conversion
result with the LEDs on the UNI-DS6 board. Do not forget the necessary
initialization and configuration for the ADC within the Atmega128. Assume the
input analog signal varies between 0 - 5 V. Simulate your design and code
using Proteus and submit sample results across the operating range
with your code in the prework.
5.2.6 The following is the formula provided in the DAC0808 datasheet for
calculating the output voltage for this particular DAC:
𝐴1 𝐴2 𝐴8
𝑉0 = 𝑉𝑅𝐸𝐹 ( 2 + + ⋯ + 256) (6.1)
4
where VREF is the reference voltage connected to the resistor at Pin 14.
Calculate the following parameters you expect to measure in the lab for the
configuration in Figure 5.2:
a) Vo Span
b) Vo Resolution
c) The value of Vo when the digital inputs are configured as
A[1:8]=10000000

5.2.7 Design a D/A converter using DAC0808, as depicted in Figure 5.2. Your
design should drive the digital inputs of DAC0808 through the output of the
Atmega128 microcontroller. The OP-AMP V+ supply pin is connected to 5V
and V- to -5V. Write an assembly program that generates a sawtooth
waveform at the output of the operational amplifier stage by using the
highest possible resolution. Simulate your design and code using Proteus,
and submit as part of the prework.

Figure 5.2. A typical D/A conversion configuration using DAC0808

5.3 EXPERIMENTAL WORK

5.3.1 Construct the circuit from preliminary work 5.2.5 and create an analog input
with the help of 5 V analog DC signal source from CADET (do not use higher
voltages). Increment or decrement level of DC signal from CADET step by
step and show the digital output coming from the Atmega128 by using the
LEDs on the development board. Compare your expectation with the LED
output, by also measuring the input analog DC signal using a multimeter or
oscilloscope. Demonstrate to your lab instructor once your design
convincingly works, also identifying saturation point(s) of the ADC.
5.3.2 Construct the circuit from preliminary work 5.2.7 without connecting to the
Atmega128. Hardwire your required DAC address bits to Vcc or GND as
needed. Use the 8 switches on your CADET in place of the MCU data bus.
Any other control signals you need should come from the push button.
Demonstrate to your lab instructor once your design convincingly
works.

5.3.3 Repeat the same experiment demonstrated in the section 5.3.1, but instead
create a sawtooth signal by driving the digital inputs to the DAC from the
MCU Demonstrate the result to your lab instructor using an
oscilloscope, and also indicate the saturation point(s) of the DAC.

REFERENCES:

Atmega128 Data Sheet


DAC0808 Datasheet
LM741 Datasheet

APPENDIX:

DAC0808 (8-bit D/A Converter):

LM741 (Operational Amplifier):

You might also like