Procedure - 5 | Experiment No. 6: Analog-to-Digital (A/D) and Digital-to-Analog (D/A) Conversion Interfacing | Microcontroller Lab
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

Introduction to D/A Conversion

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Today, we will explore Digital-to-Analog Conversion using the DAC0808. Can anyone tell me what a DAC actually does?

Student 1
Student 1

A DAC converts digital signals into analog signals.

Teacher
Teacher

Great! Now, remember the acronym 'RAV'—Resolution, Accuracy, and Voltage. What do you think these mean in the context of a DAC?

Student 2
Student 2

Resolution is how fine the output levels can be, right?

Teacher
Teacher

Exactly! For an N-bit DAC, the resolution will be determined by how many discrete steps can be produced, which is 2^N. This is essential for our calculations. Let’s discuss how to wire the DAC to the microprocessor.

Student 3
Student 3

So, how do we connect everything?

Teacher
Teacher

We start by connecting the data bus lines D0-D7 to the DAC0808. The next key point is providing a steady reference voltage for accuracy. Who can tell me why a stable reference is crucial?

Student 4
Student 4

It ensures consistent output, right?

Teacher
Teacher

Exactly! Consistency in output translates to higher accuracy. Now, let’s summarize: a DAC converts digital values to analog, and we must ensure proper connections and stable references.

Implementing DAC with Assembly Language

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now that we’ve wired our DAC, let’s look at the assembly code necessary for generating a staircase waveform. Can someone read the first line of our code?

Student 1
Student 1

'ORG 0000H' - it sets the starting address in memory.

Teacher
Teacher

Right! This establishes where the program begins. Moving down, what does 'MVI A, 00H' do?

Student 2
Student 2

It initializes the accumulator to zero.

Teacher
Teacher

Correct! We’ll loop through incrementing values and output them to the DAC. What happens when using 'INR A'?

Student 3
Student 3

We add one to the accumulator, increasing the digital output!

Teacher
Teacher

Exactly right! This will create a staircase effect as we keep sending values. What do we do when A overflows?

Student 4
Student 4

'JNZ LOOP' continues the loop until we get back to zero.

Teacher
Teacher

Yes! It's the essential mechanism to repeat the staircase waveform. Recapping, we set up our memory, initialize values, and create a looping function to generate our wave.

Interfacing with ADC0804

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Next, let's shift our focus to interfacing the ADC0804. What do you think is the primary function of an ADC?

Student 1
Student 1

It converts analog signals into digital data.

Teacher
Teacher

Exactly! Now, how do we connect this ADC to our microprocessor?

Student 2
Student 2

We connect the input pins VIN+ and VIN- to the analog signal source and ground.

Teacher
Teacher

Correct! And what's the role of the V_REF/2 connection?

Student 3
Student 3

It sets the reference point for the analog input range.

Teacher
Teacher

Perfect! Now, let’s talk about the control signals. Can someone explain what 'overlineWR' does?

Student 4
Student 4

It initiates a conversion when the microprocessor sends a low signal.

Teacher
Teacher

Exactly! And when do we read the output data?

Student 1
Student 1

After the conversion is complete and 'INTR' goes low.

Teacher
Teacher

Correct! Summarizing, we have to wire the ADC properly, utilize the correct control signals, and check for the conversion completion before reading the data.

Programmatic Approach for ADC

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now, let’s analyze the assembly code for reading values from the ADC. How do we start the conversion process in our code?

Student 2
Student 2

By using 'OUT 41H' to send a dummy value to the ADC.

Teacher
Teacher

Exactly! This indicates to the ADC to begin the process. Next, what do we check for while waiting for the conversion?

Student 3
Student 3

We check the INTR signal to see when the conversion is complete.

Teacher
Teacher

Great! How do we read the converted digital data?

Student 4
Student 4

We use the instruction 'IN 41H' to read the output from the ADC.

Teacher
Teacher

Correct! This process enables us to interpret the analog signal we've fed into our ADC. Remember that validating the input against the expected output is key. Recap: we start conversion, wait for completion, and then read the data.

Observations and Analysis

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

After conducting our experiments, how do we record our observations from the DAC? What shapes are we looking for?

Student 1
Student 1

A staircase waveform that shows a gradual increase!

Teacher
Teacher

Correct! And what are some key measurements we should take?

Student 2
Student 2

Peak voltage and the size of each step.

Teacher
Teacher

Excellent! For the ADC, what are the parameters to focus on during analysis?

Student 3
Student 3

Comparing the digital output values with the corresponding analog input values.

Teacher
Teacher

Exactly! This helps verify the performance of the ADC and confirms its accuracy and resolution. In summary, focus on waveform shape and voltage steps for the DAC, and on the proportional relationship between analog and digital values for the ADC.

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

Quick Overview

This section outlines the procedure for interfacing Analog-to-Digital (A/D) and Digital-to-Analog (D/A) converters with microprocessors, detailing step-by-step processes for DAC and ADC operations.

Standard

In this section, the procedures for the practical implementation of Analog-to-Digital and Digital-to-Analog conversion interfacing are described. It includes a thorough explanation of connections, assembly code examples for waveform generation and digital output display, and the subsequent analysis of results through practical observations.

Detailed

Detailed Summary

This section provides a systematic guide to the procedure for interfacing Digital-to-Analog (D/A) and Analog-to-Digital (A/D) converters with microprocessors, specifically using DAC0808 and ADC0804 ICs. The first part describes how to set up the DAC0808 to generate a staircase waveform by properly connecting it to the microprocessor. Key steps include wiring the DAC to the data bus, setting reference voltage connections, and implementing a simple I/O address decoding scheme to interact with the microprocessor using assembly language programming. The assembly code shows how to incrementally provide digital inputs to the DAC, allowing observation of the output waveform using an oscilloscope. The second part details the interfacing of the ADC0804, explaining wiring configurations, setting up control signals, and implementing a program to read an analog voltage from a potentiometer, convert it to a digital value, and display the result. Recordings from these exercises provide insights into the implications of conversion resolution and accuracy, enhancing understanding of how microprocessors can interact with analog signals.

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Part A: DAC0808 Interfacing and Waveform Generation

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Interfacing Schematic for DAC0808:
  2. Connect DAC0808 D0-D7 to the microprocessor's D0-D7 data bus.
  3. Connect the V_REF+ pin to +5V (or desired reference voltage).
  4. Connect the V_REF- pin to ground.
  5. Connect the Power Supply pins: VCC to +5V, VEE to -5V (or ground if using single supply mode).
  6. Connect I_OUT to an external current-to-voltage converter circuit using an op-amp (e.g., LM741) and a feedback resistor. A common configuration uses a 5k Ohm feedback resistor with V_REF = +5V.

Output Voltage (V_OUT_OPAMP) = -I_OUT * R_F (where I_OUT is the DAC current output and R_F is the feedback resistor).

  • I_OUT = I_REF * (Digital Input / 256) where I_REF = V_REF / R_REF (R_REF is often an internal resistor or an external resistor on V_REF pin). For DAC0808, I_REF = V_REF / 10k Ohm.
  • So, V_OUT_OPAMP = - (V_REF / 10k Ohm) * (Digital Input / 256) * R_F.

If V_REF = 5V and R_F = 5k Ohm, V_OUT_OPAMP = - (5V / 10k) * (Digital Input / 256) * 5k = - (0.5mA) * (Digital Input / 256) * 5k = - (2.5 * Digital Input / 256).

  • To get positive voltage, either invert the op-amp output or use I_OUT (complementary output) with an op-amp. Most trainers have internal op-amps for DAC.
  • I/O Address Decoding: Design a simple I/O address decoder to generate a Chip Select (overlineCS) for the DAC. For example, assign DAC to I/O address 40H.
  • Connect A6 of 8085/8086 to a gate, and combine with IO/overlineM (high) and overlineRD (high, as it's a write operation) to create overlineCS.
    For 8085: Use A6 and IO/overlineM (inverted) through a NAND gate, and then connect this to the DAC's CS. For a fixed port, say 40H, use A6=1, A5=0, A4=0, A3=0, A2=0, A1=0, A0=0. A simple decode could be A6 ORed with inverters of lower address lines. For simplicity, many trainers connect a DAC to a fixed port, say 40H, without complex external decoding. We'll assume a port address.

Detailed Explanation

This section outlines how to interface the DAC0808 digital-to-analog converter with a microprocessor. It explains how to connect the DAC's digital input pins to the microprocessor's data bus, set up the reference voltage pins, and attach a current-to-voltage converter circuit. The calculations provided explain how the DAC converts a digital number into a proportional analog voltage, using the feedback resistor in the op-amp circuit to determine the final output voltage. The section also describes how to create a chip select signal for the DAC, allowing the microprocessor to communicate with the DAC.

Examples & Analogies

Imagine a light dimmer switch in your home. Just as you adjust the dimmer to set the brightness of the light, the DAC adjusts the analog voltage output based on the digital input value. A higher digital input will increase the voltage, similar to how turning the dimmer increases the light's brightness.

Assembly Program for Ramp/Staircase Waveform

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Assembly Program for Ramp/Staircase Waveform (8085/8086 example):
  2. Aim: Generate a linearly increasing analog voltage output (staircase waveform) by sending incremental digital values to the DAC.
  3. Microprocessor: 8085 (example, similar logic for 8086)
  4. Port Address: Assume DAC is interfaced at Port 40H.

Assembly Code:

; 8085 Assembly Code for Ramp Waveform Generation
ORG 0000H
MVI A, 00H ; Initialize Accumulator with 0
LOOP:
OUT 40H ; Output A to DAC (Port 40H)
; DAC converts this digital value to an analog voltage
INR A ; Increment A
JNZ LOOP ; Repeat until A overflows (goes from FFH to 00H)
HLT ; Halt

Detailed Explanation

This part provides the assembly program for generating an analog staircase waveform using the DAC. It starts by clearing the accumulator to 0 and then enters a loop where it outputs the current value of the accumulator to the DAC at the specified port. The program increments the accumulator each time it outputs, creating a stepwise increase in voltage output, simulating a staircase. The loop continues until the accumulator overflows, showing a cyclic pattern from minimum to maximum voltage.

Examples & Analogies

Think of a staircase in a building. As you climb each step, you're moving higher in elevation, just like how the DAC output increases in voltage with each step of the digital input sent. When you reach the top step, you start over again at the bottom, similar to how the program resets when the accumulator overflows.

Part B: ADC0804 Interfacing and Digital Display

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Interfacing Schematic for ADC0804:
  2. Connect ADC0804 D0-D7 to the microprocessor's D0-D7 data bus.
  3. Connect VIN+ to the output of a potentiometer (variable voltage source, 0-5V). Connect VIN- to ground.
  4. Connect V_REF/2 to +2.5V (for a 0-5V input range, V_REF = 5V. If V_REF is tied to VCC, it sets the max input). Typically, V_REF/2 is connected to VCC/2 or a dedicated 2.5V source. If V_REF is left open, it defaults to VCC.
  5. Provide a clock source: For internal clock, connect 10k Ohm resistor between CLK R and CLK IN, and 150 pF capacitor between CLK IN and ground.
  6. Connect Power Supply pins: VCC to +5V, GND to ground.
  7. Control Signals:
  8. overlineCS (Chip Select): Connect to I/O address decode output (e.g., Port 41H).
  9. overlineRD (Read): Connect to microprocessor's overlineRD signal (for I/O read).
  10. overlineWR (Write): Connect to microprocessor's overlineWR signal (for I/O write).
  11. INTR (Interrupt): Connect to a status bit that the microprocessor can poll (e.g., a data line from an input port). For simple polling, connect INTR to D0 or D7 of an input port and read that port. Alternatively, use a ready pin if the trainer kit has one.
  12. Output Display: Connect D0-D7 of the ADC to 8 LEDs with current limiting resistors, or to an LCD module for display.

Detailed Explanation

This section describes how to set up the ADC0804 to convert an analog signal into a digital representation. It details the connections required for the ADC, including connecting the data output pins to the microprocessor, the voltage input pins to a potentiometer for adjustable readings, and setup for power and control signals. Notably, it explains how to provide a clock signal and how to configure the interrupt signal for indicating when a conversion is complete, allowing the microprocessor to poll for the converted digital data.

Examples & Analogies

Picture using a digital thermometer that displays the current temperature on its screen. The ADC0804 acts like the internal sensor of that thermometer, converting the analog temperature reading (like the voltage from the potentiometer) into a digital number that the display can understand and show.

Assembly Program for ADC Reading and Display

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Assembly Program for ADC Reading and Display (8085/8086 example):
  2. Aim: Read analog voltage from potentiometer, convert to digital, and display on LEDs/LCD.
  3. Microprocessor: 8085 (example, similar logic for 8086)
  4. Port Addresses: Assume ADC overlineWR is at Port 41H (dummy write to start conversion), and ADC overlineRD data is at Port 41H (actual read). Assume INTR is connected to bit D7 of Input Port 42H.

Assembly Code:

; 8085 Assembly Code for ADC Read and Display
ORG 0000H
; Initialize (if necessary, for LCD or LED segment drivers)
; For direct LED connection, no special init needed
START_CONVERSION:
MVI A, 00H ; Dummy data
OUT 41H ; Send pulse to ADC WR to start conversion.
; This OUT instruction asserts WR (low) and selects port 41H
; (assuming 41H is decoded for ADC WR)
WAIT_FOR_CONVERSION:
IN 42H ; Read status of INTR (e.g., from D7 of Port 42H)
ANI 80H ; Mask all bits except D7 (INTR connected to D7)
JNZ WAIT_FOR_CONVERSION ; Loop until INTR goes low (D7 becomes 0)
; If INTR is active low, it means D7 should be 0.
; So, JNZ means "If D7 is NOT 0, keep waiting"
READ_ADC_DATA:
IN 41H ; Read digital data from ADC (Port 41H)
; This IN instruction asserts RD (low) and selects port 41H
; (assuming 41H is decoded for ADC RD)
MOV B, A ; Store the digital value in B register (for observation/display)
; Optional: Display B on LEDs or LCD
; If LEDs connected directly to data bus for output (e.g., through a latch)
; OUT LED_PORT ; Replace LED_PORT with actual output port for LEDs
HLT ; Halt
; Consider a loop to continuously read and display if desired.
; JMP START_CONVERSION ; Uncomment for continuous operation

Detailed Explanation

In this part, we provide the assembly code to read the analog voltage from the potentiometer through the ADC, convert it into digital data, and display that on LEDs or an LCD. It starts the conversion by sending a dummy value to the ADC and waits for the conversion to complete by checking the INTR signal. Once the conversion is done, it reads the digital value from the ADC and stores it in a register for further use or display. This program allows the data flow from analog to digital format, showing how data is processed in practical applications.

Examples & Analogies

Think of a thermometer again. It continuously reads the temperature and gives you updates. Similarly, this program repeatedly checks the ADC for the new digital temperature reading based on the analog input from the potentiometer.

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

Key Concepts

  • Digital-to-Analog Conversion: Converting digital signals into analog outputs.

  • Analog-to-Digital Conversion: Converting analog signals into digital outputs.

  • Resolution: Determines how precise the output can be.

  • Full Scale Voltage: The maximum output or input voltage supported by the converter.

  • Reference Voltage: Stabilizes conversion output/input levels.

Examples & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • In a practical application, a DAC might be used in audio systems to convert digital audio signals into analog waveforms.

  • An ADC can be used in sensor applications, where temperature or pressure readings need to be converted into digital signals for processing.

Memory Aids

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎵 Rhymes Time

  • DACs give sound, the waves abound; ADCs capture light, in bits so bright!

📖 Fascinating Stories

  • Imagine a musician (DAC) transforming notes (digital signals) into melodies (analog signals), while a photographer (ADC) captures the vibrant scenes (analog) and stores them as images (digital).

🧠 Other Memory Gems

  • Remember 'RAV' for DACs: Resolution, Accuracy, Voltage.

🎯 Super Acronyms

DAC

  • Digital to Analog Conversion; ADC

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: DAC

    Definition:

    Digital-to-Analog Converter, a device that converts digital data into an analog signal.

  • Term: ADC

    Definition:

    Analog-to-Digital Converter, a device that converts an analog signal into digital data.

  • Term: Resolution

    Definition:

    The smallest change in output voltage that can be achieved by a DAC or the smallest change in input voltage that can result in a change in output from an ADC.

  • Term: Full Scale Voltage

    Definition:

    The maximum output voltage provided by a DAC or the maximum input voltage a DAC can convert.

  • Term: Reference Voltage

    Definition:

    A stable voltage used by a DAC or ADC to determine output or input voltage limits.

  • Term: Conversion Time

    Definition:

    The time taken by an ADC to convert an analog input to a digital output.