ADC 0808/0809 Interfacing With 8051 Microcontroller
ADC 0808/0809 Interfacing With 8051
Microcontroller
In physical world everything is analog/continuous ( pressure,
temperature, velocity, humidity etc ). ADC (analog to
digital converter) is a way used to convert any physical data which is in analog to the format microcontroller
can read and process them. We will need a device to display the output here we
are using LCD for that purpose. We will also need some input to feed as analog
signal, here we will use potentiometer.
ADC0808/0809 Chip with
8 analog channels:
·
Manufactured by
National semiconductor
·
Allows to monitor 8 analog
inputs
·
8 bit data output
Pin Description:
· ADDRESS LINE A, B, C
The device
contains 8-channels. A particular channel is selected by using the address
decoder line. The TABLE 1 shows the input states for address lines to select
any channel.
·
Address Latch
Enable ALE
The address is
latched on the Low – High transition of ALE.
·
START
The ADC’s
Successive Approximation Register (SAR) is reset on the positive edge i.e. Low-
High of the Start Conversion pulse. Whereas the conversion is begun on the
falling edge i.e. High – Low of the pulse.
·
Output Enable
Whenever data has
to be read from the ADC, Output Enable pin has to be pulled high thus enabling
the TRI-STATE outputs, allowing data to be read from the data pins D0-D7.
·
End of Conversion
(EOC)
This Pin becomes
High when the conversion has ended, so the controller comes to know that the
data can now be read from the data pins.
·
Clock
External clock
pulses are to be given to the ADC; this can be given either from LM 555 in astable
mode or the controller can also be used to give the pulses.
ALGORITHM:
1.
Start
2.
Select the channel
3.
A Low –High transition on ALE to latch in the
address
4.
A Low – Low transition on start to reset the
ADC’s SAR
5.
A High – Low transition on ALE
6.
A High – Low transition on start to start the
conversion.
7.
Wait for End of cycle (EOC) pin to become
high.
8.
Make Output Enable pin High.
9.
Take Data from the ADC’s output
10. Make Output
Enable pin Low.
11. Stop
Embedded C Code:
#include<reg51.>
sbit
ALE=P2^4;
sbit
OE=P2^5;
sbit
SC=P2^6;
sbit
EOC=P2^7;
sbit
ADDR_A=P2^0;
sbit
ADDR_B=P2^1;
sbit
ADDR_C=P2^2;
sfr
MYDATA=P1;
void
main()
{
unsined char value;
MYDATA=0xFF;
EOC=1;
ALE=0;
OE=0;
SC=0;
wile()
{
ADDR_C=0;
ADDR_B=0;
ADDR_A=1;
MSdelay(1);
ALE=1;
MSDelay(1);
SC=1
MSDelay(1);
ALE=0;
SC=0;
while(EOC==1);
while(EOC==0);
OE=1;
MSDelay(1);
value=MYDATA;
OE=0;
ConvertAndDisplay(value);
}
}
Comments
Post a Comment