You are on page 1of 17

ADC INTERFACING

Background
 Majority of signal processing is done using digital
systems because of their efficient, and reliable
operation.

 The majority of real-world signals, when converted to


electrical signals using sensors will remain analog in
nature, but the microcontrollers use a binary system of
zeros and ones.

 We need to convert the analog signals into digital


signals using an A/D converter.
ADC804 Pinout Diagram
Description
 8-bit successive approximation ADC 804

 Conversion time of 100 microseconds.

 On-chip clock generator

 Resolution : Smallest angalog input voltage


change that can be detected by the converter.
i.e. change in input that cause digital output
change by 1.
Contd.
 Resolution of (i) 8-bit, (ii) 10-bit ADC for input analog
voltage range 0 to 5 volts.

 (i)
8-bit ADC has 28 = 256 levels and 28– 1 = 255 steps.
The resolution is 1/(28–1) = 1/255, i.e. 1 part in 255.
For input range of 0 to 5 V, the resolution is
VMAX / (28–1) = 5 V/255 = 19.60 mV

(ii) 10 bits ADC : The resolution is 1/(210–1) = 1/1023,


i.e. 1 part in 1023.
 For input range of 0 to 5 V, the resolution is

VMAX / (210–1) = 5 V/1023 = 4.88 mV


Contd.
Range: Max. to Min. voltage can be
applied to ADC as input.
Contd.
 CS’ (input) : Active low chip select signal.

 WR’ (input) : Active low, used to inform ADC chip to


start the conversion (SOC). When CS=0, low to high
pulse requires to enable the i/p.

 INTR’(output) : Active low indicates that conversion is


completed (EOC).

 RD’ (input) : Active low used to read converted digital


data from ADC chip. When CS=0, high to low pulse
requires to enable the i/p.
Contd.
CLK IN & CLKR : To use internal clock
generator this pins are connected with R and C.

f = 1/1.1RC

Vin (+) and Vin (-) : Collectively provide


differential analog input voltage.
Contd.
 VREF/2 : Used to set input voltage range.
 Used to set input voltage range other than 0-5V.

 VREF/2 Vin range (V) Step size (mV)


Open 0 to 5 5/255=19.60
2.0 0 to 4 4/255 =15.68
0.5 0 to 1 1/255=3.92
Contd.
D7-D0 (Digital Output )

i.e. Dout ?
For Vin=1.28V and VREF/2 is open
Output = 1.28 V/19.60 mv = 65D

These pins are tri-state buffered and the output will be


available only when CS and RD are made low.
Contd.
Write a program to take 100 samples of analog signal connected at
input of the ADC. Take the sample after every 10 second and store
them at internal RAM addresses.

0
Handshaking
 CS and WR’ simultaneously low, the ADC will remain
in a reset state until the CS’ and WR’ inputs remain low.
 Conversion will start when WR’ input make a low to
high transition.
 Monitor the ‘end of conversion’ (INTR’) pin until it
becomes 0; when it is 0, it indicates that the conversion
is completed.
 To read data from the ADC, make CS and RD low,
this will output the data on D7–D0 pins, read this data
using appropriate instruction.
 When RD is made low, INTR will become high
automatically.
ORG 0000H
MOV R0, #80H // pointer to store samples
MOV R2, #100 // counter for 100 samples
SETB P1.0 // configure P1.0 as input for connecting INTR
MOV P2, #0FFH // configure P2 as input for reading data
CLR P1.1 // make CS low
NEXT: CLR P1.2 // make WR’ low
SETB P1.2 // WR’ = 1, low-to-high pulse for starting ADC
HERE: JB P1.0, HERE // wait until the end of conversion
CLR P1.3 // make RD’ low to read conversion result
MOV A, P2 // read data from ADC
MOV @R0, A // store the sample at 80H onwards
INC R0 // increment the pointer
SETB P1.3 // make RD high before taking the next sample
LCALL DELAY // delay of 10 second
DJNZ R2, NEXT // repeat until 100 samples are taken
HERE1: SJMP HERE1
Write a program by considering following interfacing
such that VR reference voltage should change the
ON/OFF of the corresponding LED as per followings.

(i) if VR > = 5V all LEDs should glow.


(ii) if VR > = 4V LED2 to LED5 should glow.
(ii) if 4V> VR >= 3V LED3 to LED5 should glow.
(iv) if 3V> VR >= 2V LED4 and LED5 should glow.
(v) if 2V> VR >= 1V LED5 should glow.

You might also like