Introduction:
ADC0804 is one of the most commonly
used analog to digital converter IC. In many applications it is
required to convert the output of the sensor, which is analogue in
nature to a digital form. The data in digital format can then be
utilized for further processing by the digital processors. Typical
applications include sound processing, temperature processing etc. The
below figure demonstrates the principle and operation of interfacing a
simple ADC 0804 using 8051 microcontroller.
(courtesy: Engineergargae.com)
Program:
#include "REGX52.H"
#define Mydata P2
#define LED P0
#define INTR P1_3
#define WR P1_1
#define RD P1_0
void main()
{
unsigned char value;
Mydata=0xFF; //make P1 as input
INTR=1;
RD=1;
WR=1;
while(1)
{
WR=0; //send WR pulse
WR=1; //L to H (start conversion)
while(INTR==1); //wait for End of Conversion
RD=0; //send RD pulse
value=Mydata; //read value
LED=value; //display on 8-LEDs
}
}
Comments
Post a Comment