0% found this document useful (0 votes)
49 views12 pages

Communication Between ADC0804 and 8051

Here are the steps to solve Problem 2: 1. Create diagram in Proteus: - Components needed: ADC0804, humidity sensor, LCD, LED, resistors, capacitors - Connect components as in given diagram 2. Create block diagram: - Connect humidity sensor output to ADC0804 Vin+ pin - Connect ADC0804 to MCU for digital output - Program MCU to read ADC value, calculate humidity %, display on LCD - Trigger LED if humidity is less than 50% 3. Program in Keil C: - Include library files for LCD, delay - Define I/O ports - Write functions to initialize LCD, trigger LED - Main loop:
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views12 pages

Communication Between ADC0804 and 8051

Here are the steps to solve Problem 2: 1. Create diagram in Proteus: - Components needed: ADC0804, humidity sensor, LCD, LED, resistors, capacitors - Connect components as in given diagram 2. Create block diagram: - Connect humidity sensor output to ADC0804 Vin+ pin - Connect ADC0804 to MCU for digital output - Program MCU to read ADC value, calculate humidity %, display on LCD - Trigger LED if humidity is less than 50% 3. Program in Keil C: - Include library files for LCD, delay - Define I/O ports - Write functions to initialize LCD, trigger LED - Main loop:
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Communication between ADC0804 and

8051
Introduction
Objectives: After this unit students will
 Understand the ADC0804, its features and functions.
 Understand how the ADC0804 communicates with the 8051 microcontroller.
 Develop teamwork, research, and presentation skills.
Theory
I. Overview
ADC0804 is a low voltage integrated circuit used to convert low voltage analog signal to
8-bit digital signal. It works from 0 to 5 volts, has 1 analog input pin and 8 output pins.
ADC0804 has an internal clock, and can connect to an external clock to change its
frequency. Minimum conversion time is 110 microseconds with internal or external
clock.
Pinout of ADC0804:
Pin Name Description
CS(Chip Chip select is used if more than 1 ADC module is
1
Select) used. By default grounded.
2 RD(Read) Read pin must be grounded to read the Analog value
Write pin should be pulsed high to start data
3 WR(Write)
conversion
External clock can be connected here, other RC can be
4 CLK IN
used for accessing internal clock
5 INTR(Interrupt) Goes high for interrupt request.
6 Vin(+) Differential Analog input +. Connects to ADC input.
7 Vin(-) Differential Analog input -. Connects to ground.
8 Ground Analog Ground pin connected to ground of circuit.
9 Vref/2 Reference voltage for ADC conversion.
10 Ground Digital Ground pin connected to ground of circuit
Eight output Data bit pins from which output is
11 to 18 Data bit 0 to 7
obtained.
19 CLK R RC timing resistor input pin for internal clock.
20 Vcc Powers the ADC module, uses +5V
Figure 1: Pinout of ADC0804
II. Where to use ADC0804
This IC is very Ideal to use with Microprocessors like Raspberry Pi, Beagle bone etc.. Or
even to use as a standalone ADC module. Every ADC module requires a clock to function;
this IC comes with its own internal clock so you don’t have to worry about it. Hence, if
you are looking for a compact ADC module with a decent resolution of 8-bit then this IC
is for you.
III. How to use ADC0804
Since the IC comes with an internal clock we do not need many components to make it
work. However to make the internal clock to work we have to use a RC circuit. The IC
should be powered by +5V and the both ground pins should be tied to circuit ground. To
design the RC circuit simply use a resistor of value 10k and capacitor of 100pf (approx)
and connect them to CLK R and CLK IN pins as shown in the circuit below. The chip select
(CS) and Read (R) pin should also be grounded. The Vref pin is left free because by
default without any connection it will be connected to +5V.
The digital output will be obtained from the pins DB0 to DB7 and the analog voltage
should be connected to V in(+) pin as shown in the circuit. Also note that another end of
the voltage source (sensor/module) should also be grounded to the circuit for the ADC
conversion to work. Now, for the ADC Conversion to start we have to make the
Write(WR) pin to go high momentarily. This can be done by connecting the pin to I/O of
MPU and toggling it high before every ADC read. Only if this is done the ADC value on
the output side will be updated.

Practice – Communication between ADC0804 and 8051


Problem 1: Read temperature from LM35 sensor using ADC0804.
Part 1: Creating simulation in Proteus.
1. Create project in Proteus.
- Start Proteus, select New Project.

- Name, select location for project. Hit Next.

- Hit Next -> Next -> Finish to start working on project.


2. Choose components.
- Hit P to open Pick Device window.

- Type in the name of component, double click on component to select.


- Components to use:

- VCC, GND can be picked from Terminals


- Connect components as diagram below

Part 2: Programming in Keil C.


- Name the project and select location, then hit Save.

- Select AT89C51 -> OK -> No.


- Create file main.c

- Name the file main.c, select saving location, then Save.


- Double click on Source Group 1, locate main.c, click Add.

- Create Hex code: Right click on Target 1 -> Option -> Output -> Tick “Create Hex File”.
- Source code for main.c:
#include <REGX51.H>

#define CS P3_0
#define RD P3_1
#define WR P3_2
#define INTR P3_3
#define Data P1

int kq;

unsigned char hex[10] =


{0xC0 ,0xF9 ,0xA4 ,0xB0 ,0x99 ,0x92 ,0x82 ,0xF8 ,0x80 ,0x90};

void delay_ms(int time){


int i, j;
for(i=0; i<time; i++)
for(j=0; j<123; j++);
}

void ADC_Read(){
CS = 0;
WR = 0;
WR = 1;
while(INTR);
RD = 0;
kq = Data;
RD = 1;
}

void hienThi(){
int chuc, donVi, i;
chuc = kq/10;
donVi = kq%10;
for(i = 0; i< 100; i++){
P2_0 = 1; P0 = hex[chuc]; delay_ms(5); P2_0 = 0;
P2_1 = 1; P0 = hex[donVi]; delay_ms(5); P2_1 = 0;
}
}

void main(){
while(1){
ADC_Read();
kq = kq/0.512;
hienThi();
}
}

- Rebuild. Success if no errors in Build Output.

Part 3: Double click on AT89C51, select Program Files


- Locate .hex file.

- Verify simulation.
Self-learning instruction for students
Problem 2: Read temperature from humidity sensor, display said temperature on LCD, and
trigger light warning if humidity is less than 50%. Given the range of humidity sensor is 0 to 100
percent, translated to output voltage from 0 to 5 volts.
Instruction:
- Create diagram using Proteus.
- Create block diagram to solve problem.
- Program in Keil C.
- Verify simulation/work on actual circuit.

You might also like