0% found this document useful (0 votes)
11 views28 pages

Adc Dac Sensors

Uploaded by

krishtiwari2122
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
11 views28 pages

Adc Dac Sensors

Uploaded by

krishtiwari2122
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 28

ADC INTERFACE

 ADCs (analog-to-digital converters) are among the


most widely used devices for data acquisition

 A physical quantity, like temperature, pressure,


humidity, and velocity, etc., is converted to electrical
(voltage, current) signals using a device called a
transducer, or sensor

 We need an analog-to-digital converter to translate


the analog signals to digital numbers, so
microcontroller can read them
ADC INTERFACE
ADC INTERFACE
 The ADC chip can be either parallel or serial.

 In parallel ADC (0804, 0808 and 0809) we have 8 or


more dedicated pins to bringing out the binary data
but in serial ADC (MAX1112) we have only one pin for
data out.

 An ADC has n-bit resolution where n can be


8,10,12,16 or even 24 bits

 The higher resolution ADC provides high accuracy by


having a smaller step size where Step size is the
smallest change that can be discerned by an ADC
ADC INTERFACE
ADC INTERFACE

ADC 0804 PIN DIAGRAM


ADC INTERFACE
 CLK IN and CLK R:
 CLK IN is an input pin connected to an external
clock source
 To use the internal clock generator (also called
self-clocking), CLK IN and CLK R pins are
connected to a capacitor and a resistor, and the
clock frequency is determined by

 Typical values are R = 10K ohms and C = 150 pF


 We get f= 606 kHz and the conversion time is
110 µs
ADC INTERFACE
 Vref/2:
 It is used for the reference voltage
 If this pin is open (not connected), the analog
input voltage is in the range of 0 to 5 volts (the
same as the Vcc pin)
 If the analog input range needs to be 0 to 4
volts, Vref/2 is connected to 2 volt
ADC INTERFACE
For 8-bit ADC
ADC INTERFACE
 D0-D7:
 The digital data output pins and these are tri-
state buffered
 The converted data is accessed only when CS
=0 and RD is forced low
 To calculate the output voltage, use the
following formula

 Dout= digital data output (in decimal),


 Vin= analog voltage, and
 step size(resolution) is the smallest change
ADC INTERFACE
 The following steps must be followed for data
conversion by the ADC804 chip
 Make CS = 0 and send a low-to-high pulse to pin
WR to start conversion

 Keep monitoring the INTR pin


 If INTR is low, the conversion is finished
 If the INTR is high, keep polling until it goes low

 After the INTR has become low, we make CS = 0


and send a high-to-low pulse to the RD pin to
get the data out of the ADC804
ADC INTERFACE
ADC INTERFACE
 Examine the ADC804 connection to the 8051 in Figure. Write a
program to monitor the INTR pin and bring an analog input
into register A. Then call a hex-to ASCII conversion and data
display subroutines. Do this continuously.

Sensor
ADC INTERFACE
ADC INTERFACE
ADC INTERFACE
INTERFACING LM35 WITH 8051

 The ADC804 has 8-bit resolution with a maximum of 256 steps


and the LM35 (or LM34) produces 10 mV for every degree of
temperature Change

 we can condition Vin of the ADC804 to produce a Vout of 2560


mV full-scale output. Therefore, in order to produce the
fullscale Vout of 2.56 V for the ADC804

 We need to set Vref/2 = 1.28.This makes Vout of the ADC804


correspond directly to the temperature as monitored by the
LM35.
ADC INTERFACE
DAC INTERFACE
 Microcontrollers are used in wide variety of applications
such as measuring and control of physical quantity like
temperature, pressure, speed, distance, etc.

 In these systems microcontroller generates output which


is in digital form but the controlling system requires
analog signal as they don't accept digital data thus
making it necessary to use DAC which converts digital
data into equivalent analog voltage.

 The 8-bit DAC 0808 converts digital data into equivalent


analog Current. Hence we require an I to V converter to
convert this current into equivalent voltage.
DAC INTERFACE
 The digital-to-analog converter (DAC) is a device
widely used to convert digital pulses to analog
signals.

 The vast majority of integrated circuit DACs, use the


R/2R method since it can achieve a much higher
degree of precision.

 The first criterion for judging a DAC is its resolution,


which is a function of the number of binary inputs.

 The common ones are 8, 10, and 12 bits.


DAC INTERFACE
 The number of data bit inputs decides the resolution
of the DAC since the number of analog output levels
is equal to 2n, where n is the number of data bit
inputs.

 Therefore, an 8-input DAC such as the DAC0808


provides 256 discrete voltage (or current) levels of
output.
Similarly, the 12-bit DAC provides 4096 discrete
voltage levels.

 In the MC1408 (DAC0808), the digital inputs are


converted to current (I ), and by connecting a
DAC INTERFACE
 The total current provided by the Iout pin is a function
of the binary numbers at the DO – D7 inputs of the
DAC0808 and the reference current (Iref), and is as
follows:

where DO is the LSB, D7 is the MSB for the inputs,


and Iref is the input current that must be applied to
pin 14.
DAC INTERFACE
DAC INTERFACE
 Write a program to send data to the DAC to generate
a Sawtooth, triangle and staircase waveforms.

ORG 0000H
SAWTOOTH: MOV A, #00H
BACK: MOV P1,A
INC A
CJNE A,#255, BACK
MOV A,#00
SJMP SAWTOOTH
DAC INTERFACE
TRIANGLE: MOV A,#00
INCR: MOV P1,A
INC A
CJNE A,#255, INCR
DECR: MOV P1,A
DEC A
CJNE A,#00, DECR
SJMP TRIANGLE
DAC INTERFACE

STAIRCASE: MOV A,#00


MOV P1,A
RPT: ADD A,#51
MOV P1,A
CJNE A,#255, RPT
SJMP STAIRCASE
DAC INTERFACE
Generating a 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.

 Table shows the angles, the sine values, the voltage


magnitudes, and the integer values representing the
voltage magnitude for each angle (with 30-degree
increments).
DAC INTERFACE
Generating a sine wave
DAC INTERFACE
Generating a sine wave
DAC INTERFACE
Generating a sine wave
This program sends the values to the DAC continuously (in an
infinite loop) to produce a sine wave
SINEWAVE: MOV DPTR, #SINE
MOV R2,#13
NEXT: CLR A
MOVC A, @A+DPTR
MOV P1,A
INC DPTR
DJNZ R2, NEXT
SJMP SINEWAVE
ORG 050H
SINE : DB 27,160,191,217,237,250,255,250,237,217,191,160,127,94,63,37,17, 4,0,4,17,37,63,94,127
END

You might also like