Sei sulla pagina 1di 37

Digital-to-Analog Analog-to-Digital

Interface Part IV Microprocessor

Data Collection and Control

Digital-to-Analog Conversion [DAC]

Digital to Analog(D/A) Converters


Digital to analog converters can be broadly classified in three categories: current output, voltage output, and multiplying type. The current output DAC provides current as the output signal. The voltage output DAC internally converts signal into the voltage signal. The voltage output DAC is slower than the current output DAC because of the delay in converting the current signal into the voltage signal. The multiplying DAC is similar to the other two types except its output represents the product of the input signal and the reference source, and product is linear over a broad range. D/A converters are available as integrated circuits. Some are designed to be compatible with the microprocessor. Typical applications include digital voltmeters, peak detectors , panel meters, programmable gain and attenuation, and stepping motor drive.

MSB D2
Digital Input D1

LSB D0

Figure shows a block diagram of a 3 bit D/A converter; it has three digital input lines (D2, D1, D0) and one output line for the analog signal. The three input lines can Analog Output assume eight input D/A Conveter combinations from 000 to 111. If the input ranges from 0 to 3 Bit D/A converter 1 V, it can be divided into eight equal parts; each successive input is 1/8V higher than the previous combination

Digital-to-Analog Conversion
2 Basic Approaches
Weighted Summing Amplifier R-2R Network Approach

Weighted Sum DAC


One way to achieve D/A conversion is to use a summing amplifier. This approach is not satisfactory for a large number of bits because it requires too much precision in the summing resistors. This problem is overcome in the R-2R network DAC.

Weighted Sum DAC

R-2R Ladder DAC

R-2R Ladder DAC

R-2R Ladder DAC


The summing amplifier with the R-2R ladder of resistances shown produces the output where the D's take the value 0 or 1. The digital inputs could be TTL voltages which close the switches on a logical 1 and leave it grounded for a logical 0. This is illustrated for 4 bits, but can be extended to any number with just the resistance values R and 2R.

Q1. Write a program to generate a triangular wave? Q2. Write a program to generate a square wave of particular frequency? Q3. Write a program to generate a saw tooth wave? Q4. Write a program to generate a ramp wave?

Analog to Digital Conversion [ADC]

ADC Basic Principle


The basic principle of operation is to use the comparator principle to determine whether or not to turn on a particular bit of the binary number output. It is typical for an ADC to use a digital-toanalog converter (DAC) to determine one of the inputs to the comparator.

ADC Various Approaches


3 Basic Types Digital-Ramp ADC Successive Approximation ADC Flash ADC

Digital-Ramp ADC
Conversion from analog to digital form inherently involves comparator action where the value of the analog voltage at some point in time is compared with some standard. A common way to do that is to apply the analog voltage to one terminal of a comparator and trigger a binary counter which drives a DAC.

Digital-Ramp ADC

Digital-Ramp ADC
The output of the DAC is applied to the other terminal of the comparator. Since the output of the DAC is increasing with the counter, it will trigger the comparator at some point when its voltage exceeds the analog input. The transition of the comparator stops the binary counter, which at that point holds the digital value corresponding to the analog voltage.

Successive approximation ADC

Illustration of 4-bit SAC with 1 volt step size

Successive approximation ADC


Much faster than the digital ramp ADC because it uses digital logic to converge on the value closest to the input voltage. A comparator and a DAC are used in the process.

Flash ADC
It is the fastest type of ADC available, but requires a comparator for each value of output. (63 for 6-bit, 255 for 8-bit, etc.) Such ADCs are available in IC form up to 8-bit and 10-bit flash ADCs (1023 comparators) are planned. The encoder logic executes a truth table to convert the ladder of inputs to the binary number output.
Illustrated is a 3-bit flash ADC with resolution 1 volt

ADC080x Features
Compatible with 8080 P derivativesno interfacing logic needed - access time 135 ns. Easy interface to all microprocessors, or operates stand alone Differential analog voltage inputs Logic inputs and outputs meet both MOS and TTL voltage level specifications Works with 2.5V (LM336) voltage reference On-chip clock generator 0V to 5V analog input voltage range with single 5V supply No zero adjust required

ADC080x, interfacing

Interfacing Application
To control the temperature of heater

Temperature control using 8085

PROJECT DISCRIPTION
It sense the temperature and on/off the heater accordingly. The sensing circuitry may consist of resistance thermometer, thermocouples, thermisters, pyrometers place in the arm of wheatstone bridge. A change in temperature causes a change in resistance giving a voltage that is proportional to the change in temperature

Thermocouples are widely used transducers to measure the temperature. The o/p of thermocouple is proportional to the temperature of heater in microvolts. This voltage is amplified by multistage amplifier and then A/D converter. 8085 sends a SOC signal to A/D converter via 8255.

After the conversion an EOC signal is given to the microprocessor. Then the microprocessor reads the o/p as digital quantity proportional to the temperature to be measured.

HARDWARE
thermocouple t DB0-DB7 PORTA

3stage amplifier

ADC EOC

8255

MPU

PC7

SOC

PC3

FLOWCHART

PROGRAM
MVI A, 91H OUT CWR ;INITIALIZE 8255 L2:CALL CONVERSION CPI 80H ; COMPARE WITH SET POINT JC L1 MVI A,0EH ; RESET PC7,HEATER OFF WITH BSR MODE OUT CWR JMP L2 L1: MVI A,0FH ; SET PC7, HEATER ON WITH BSR MODE OUT CWR JMP L2

MVI A,00H OUT PB ; SEND ADDRESS TO SELECT I/P 0 MVI A,08H ;LATCH ADDRESS BY ALE=1 OUT PB MVI C,0AH L3: DCR C JNZ L3;DELAY MVI A,18H OUT PB ; MAKE SOC HIGH MVI A,08H ; MAKE SOC LOW OUT PB
CONVERSION:

MVI A,00H OUT PB L4: IN PC ANI 01H JZ L4 IN PA RET

MAKE ALE LOW

; WAIT FOR EOC