0% found this document useful (0 votes)
7 views3 pages

Interfacing ADC804 with 8051 Microcontroller

Uploaded by

smsanjay189
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Interfacing ADC804 with 8051 Microcontroller

Uploaded by

smsanjay189
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LCD Timing

‰ One can put data at any location in the


INTERFACING INTERFACING
LCD TO 8051
LCD and the following shows address LCD TO 8051
tDSW = Data set up time
= 195 ns (minimum)
locations and how they are accessed Data
LCD Data RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 LCD Data tH = Data hold time
Sheet Sheet
tH = 10 ns (minimum)
0 0 1 A A A A A A A E tDSW

(cont’)
R/W tAS tPWH tAH

¾ AAAAAAA=000_0000 to 010_0111 for line1


RS
¾ AAAAAAA=100_0000 to 110_0111 for line2 tAH = Hold time after E has
The upper address
come down for both RS and
range can go as LCD Addressing for the LCDs of 40×2 size
R/W = 10 ns (minimum)
high as 0100111
DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
for the 40- tPWH = Enable pulse width
character-wide Line1 (min) 1 0 0 0 0 0 0 0 = 450 ns (minimum)
LCD, which Line1 (max) 1 0 1 0 0 1 1 1
tAS = Set up time prior to E
corresponds to Line2 (min) 1 1 0 0 0 0 0 0 (going high) for both RS and
locations 0 to 39 Line2 (max) 1 1 1 0 0 1 1 1 R/W = 140 ns (minimum)

Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 9
HANEL National Cheng Kung University 10

‰ ADCs (analog-to-digital converters) are ‰ ADC804 IC is an analog-to-digital


INTERFACING INTERFACING
TO ADC AND
among the most widely used devices TO ADC AND
converter
SENSORS for data acquisition SENSORS ¾ It works with +5 volts and has a resolution
¾ A physical quantity, like temperature, of 8 bits
ADC Devices pressure, humidity, and velocity, etc., is ADC804 Chip ¾ Conversion time is another major factor in
converted to electrical (voltage, current) judging an ADC
signals using a device called a transducer, ƒ Conversion time is defined as the time it takes
or sensor the ADC to convert the analog input to a digital
(binary) number
‰ We need an analog-to-digital converter ƒ In ADC804 conversion time varies depending on
to translate the analog signals to digital the clocking signals applied to CLK R and CLK IN
numbers, so microcontroller can read pins, but it cannot be faster than 110 µs

them

Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 11
HANEL National Cheng Kung University 12

3
+5V power supply

CLK IN and CLK R


or a reference
voltage when ‰
INTERFACING Differential analog
+5V INTERFACING
CLK IN is an input pin connected to an
Vref/2 input is open
¾
TO ADC AND inputs where Vin 20 (not connected) TO ADC AND
SENSORS
= Vin (+) – Vin (-) 10k
POT
6 Vin(+)
VCC
D0 18
SENSORS external clock source
Vin (-) is connected 7 D1 17
To use the internal clock generator
Vin(-)
8 D2 16 ¾
to ground and Vin A GND 15
9 D3
ADC804 Chip (+) is used as the
19
Vref /2
D4 14
13
To LEDs
ADC804 Chip (also called self-clocking), CLK IN and
analog input to be CLK R D5
(cont’) converted 10k D6
D7
12
11 (cont’) CLK R pins are connected to a capacitor
150 pF
4 CLK in 3
and a resistor, and the clock frequency
CS is an active low WR
INTR 5
+5V is determined by
1
input used to activate 1 CS normally
ADC804 2 RD open 20
f =
1.1 RC
VCC
10 D GND START 6 Vin(+) D0 18
7 D1 17
Vin(-)
ƒ Typical values are R = 10K ohms and C =
8 16
A GND D2
“output enable” 9 Vref /2 D3
15
14
a high-to-low RD pulse is
“end of conversion” “start conversion”
19
CLK R
D4
D5 13
12
150 pF
D6
used to get the 8-bit
ƒ We get f = 606 kHz and the conversion time
D7 11
When the conversion is When WR makes a low-to-
converted data out of 4
is 110 µs
high transition, ADC804 CLK in 3
finished, it goes low to signal WR
ADC804 starts converting the analog INTR 5
the CPU that the converted 1 CS
2 RD
data is ready to be picked up input value of Vin to an 8- 10 D GND
bit digital number

Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 13
HANEL National Cheng Kung University 14

‰ Vref/2 ‰ D0-D7
INTERFACING INTERFACING
TO ADC AND ¾ It is used for the reference voltage TO ADC AND ¾ The digital data output pins
ƒ If this pin is open (not connected), the analog These are tri-state buffered
SENSORS SENSORS ¾
input voltage is in the range of 0 to 5 volts (the
ƒ The converted data is accessed only when CS =
same as the Vcc pin)
ADC804 Chip ADC804 Chip 0 and RD is forced low
ƒ If the analog input range needs to be 0 to 4
(cont’) volts, Vref/2 is connected to 2 volts (cont’) ¾ To calculate the output voltage, use the
following formula
Vref/2 Relation to Vin Range
V in
D out =
+5V +5V
Vref/2(v) Vin(V) Step Size ( mV)
6 Vin(+)
20
VCC
18 Not connected* 0 to 5 5/256=19.53 6 Vin(+)
20
VCC
D0 18
step size
D0
7 D1 17 7 D1 17
Vin(-)
2.0 0 to 4 4/255=15.62 Vin(-)
8
9
A GND
Vref /2
D2
D3
16
15
8
9
A GND
Vref /2
D2
D3
16
15 ƒ Dout = digital data output (in decimal),
14 1.5 0 to 3 3/256=11.71 D4 14
ƒ Vin = analog voltage, and
19 D4 19
13 13
CLK R D5
12
CLK R D5 12
D6
11 1.28 0 to 2.56 2.56/256=10 D6 11
ƒ step size (resolution) is the smallest change
D7 D7
4 CLK in
WR
3 1.0 0 to 2 2/256=7.81 4 CLK in
WR
3

INTR 5 INTR 5
1 CS 0.5 0 to 1 1/256=3.90 1 CS
2 RD 2 RD
10 10
D GND Step size is the smallest change can be discerned by an ADC D GND

Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 15
HANEL National Cheng Kung University 16

4
‰ The following steps must be followed
‰ Analog ground and digital ground
INTERFACING INTERFACING for data conversion by the ADC804 chip
¾ Analog ground is connected to the ground
TO ADC AND TO ADC AND ¾ Make CS = 0 and send a low-to-high pulse
of the analog Vin to pin WR to start conversion
SENSORS SENSORS
¾ Digital ground is connected to the ground ¾ Keep monitoring the INTR pin
of the Vcc pin ƒ If INTR is low, the conversion is finished
ADC804 Chip ADC804 Chip ƒ If the INTR is high, keep polling until it goes low
(cont’) ‰ To isolate the analog Vin signal from (cont’) ¾ After the INTR has become low, we make
transient voltages caused by digital CS = 0 and send a high-to-low pulse to the
+5V switching of the output D0 – D7 RD pin to get the data out of the ADC804
6 Vin(+)
20
VCC
18
¾ This contributes to the accuracy of the CS

digital data output


D0
7 D1 17
Vin(-)
8 16
A GND D2 15
9 D3
Vref /2
D4 14 WR
19 13
CLK R D5
12
D6
D7 11 D0-D7 Data out
End conversion
4 CLK in
WR
3 INTR
1 INTR 5 Start conversion
CS
2 RD RD
10
D GND
CS is set to low for both Read it
RD and WR pulses
Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 17
HANEL National Cheng Kung University 18

The binary outputs are


ADC804 Free Running Test Mode Examine the ADC804 connection to the 8051 in Figure 12-7. Write a program to
monitored on the LED monitor the INTR pin and bring an analog input into register A. Then call a
INTERFACING +5V of the digital trainer INTERFACING hex-to ACSII conversion and data display subroutines. Do this continuously.
TO ADC AND 10k
20
VCC
TO ADC AND ;p2.6=WR (start conversion needs to L-to-H pulse)
SENSORS SENSORS
6 Vin(+) 18 ;p2.7 When low, end-of-conversion)
POT D0
7 Vin(-) D1 17
16 ;p2.5=RD (a H-to-L will read the data from ADC chip)
8 A GND D2
9 D3 15 ;p1.0 – P1.7= D0 - D7 of the ADC804
Vref /2 To LEDs
Testing 19
CLK R
D4
D5
14
13 Testing ;
MOV P1,#0FFH ;make P1 = input
ADC804 ADC804
D6 12
10k 11 BACK: CLR P2.6 ;WR = 0
150 pF D7
4 CLK in 3
(cont’) SETB P2.6 ;WR = 1 L-to-H to start conversion
WR HERE: JB P2.7,HERE ;wait for end of conversion
1 CS INTR 5 normally CLR P2.5 ;conversion finished, enable RD
2 RD open MOV A,P1 ;read the data
10 D GND START ACALL CONVERSION ;hex-to-ASCII conversion
ACALL DATA_DISPLAY;display the data
SETB p2.5 ;make RD=1 for next round
The CS input is SJMP BACK
a potentiometer used to
grounded and the
apply a 0-to-5 V analog
WR input is
voltage to input Vin (+)
connected to the
of the 804 ADC
INTR output

Department of Computer Science and Information Engineering Department of Computer Science and Information Engineering
HANEL National Cheng Kung University 19
HANEL National Cheng Kung University 20

You might also like