ADC 0804 Interfacing with 8051

 ADC 0804

ADC 0804 is an 8 bit parallel out and a single channel (ie only one analog input can be given)
First we need to learn the Pin details of the ADC .

CS:- This is an active low input pin. When this pin is at LOW logic level (i,e logic 0),ADC0804    is ready to operate.

WR:-This is an active low input pin. A LOW-to-HIGH pulse at this pin tells the ADC to start the conversion of applied analog input signal.

- This is an active low output pin to indicate the end of conversion.

RD:- This is an active low input pin.After the end of conversion the converted digital signal is stored in the internal register of ADC0804 chip. Before the data is lost it is required to read the digital data from those internal register. By sending a HIGH-to-LOW pulse at this pin, we can read the digital data through 8-bit parallel pins of ADC0804.

CLK IN:- This is an input pin to provide a clock source to ADC0804 required for conversion when an external clock source is used.

CLK R:- To use on chip clock generator of ADC0804, the CLK IN and CLK R pins needs to be connected with RC circuit as shown in figure below.

The suitable value of R and C used in the circuitry is 10k and 150pF respectively. But its not any hard rule to use the same value of R and C. You can use any value of R and C which can generate approximately 110us of conversion time.

Vin :- These (Vin+ and Vin-) are the pin where you apply differential analog input from any sensor.

Vref/2:- This is the reference voltage pin. If this pin is left not connected then the reference voltage will automatically become 5V. But for application where you require reference voltage to be less then 5V, an external source of appropirate voltage should be connected to this pin. An voltage divider circuit can be used to obtain the required reference voltage by utilizing the same power source which microcontroller and ADC0804 are using. Now, for example you require a reference voltage of 4 V, then 4V/2=2V voltage source source should be connected to this pin hence, this pin has got the name Vref/2.

AGND:- This is analog ground pin where an ground of analog input source is connected. Similarly, in DGND which is referred to as digital ground, the ground of working voltage source of the MCU or ADC is connected.

D0-D7:- These are a 8-bit parallel data pins of ADC0804.

Only 4 control pins needed to control the ADC ie,CS,RD,WR,and INTR 
the prorgamming logic as follows.

1)  Make chip select (CS) signal low. 

2)  Make write (WR) signal low.

3)  Make chip select (CS) high.

4)  Wait for INTR pin to go low (means conversion ends).  

Once the conversion in ADC is done, the data is available in the output latch of the ADC - See more at:

Once the conversion in ADC is done, the data is available in the output latch of the ADC . So to read the data fromthe internal register of the ADC to the output give the following control signls.

1)  Make chip select (CS) pin low.

2)  Make read (RD) signal low.

3)  Read the data from port where ADC is connected.

4) Make read (RD) signal high.

5) ·  Make chip select (CS) high.
Make read (RD) signal high.

Thats all, the data is available at the data pin of the  ADC. do it with fast or it given in a loop to time defendant input variation .

Program  ( 8051 used to give the control signal )
  This progarm only read the analog input signal and available at the data pin of ADC (DB0-DB7)
and in Proteus simulation that data Pin is connected to LED to check.
The program is written in Keil IDE.

#include <REGX51.H>
#define cs P0_0
#define rd P0_1
#define wr P0_2
#define intr P0_3

void conv();                   //Start of conversion function
void read();                   //Read ADC function

unsigned char adc_val;

void main()
    while (1) {                //Forever loop
    conv();                    //Start conversion
    read();                    //Read ADC


void conv()
    cs = 0;                    //Make CS low
    wr = 0;                    //Make WR low
    wr = 1;                    //Make WR high
    cs = 1;                    //Make CS high
    while (intr);       //Wait for INTR to go low

void read()
    cs = 0;                    //Make CS low
    rd = 0;                    //Make RD low

    rd = 1;                    //Make RD high
    cs = 1;                    //Make CS high


Download here the Proteus and Keil File Clik here

Post a Comment




Contact Form


Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget