dolphinlabs
...
Doplhin labs
News

ADC Interface


 

·         Program Statement : Interfacing of ADC 0804 with 89C51 microcontroller

Connections: P1.4= INTR, P1.5=W, P1.6=R,P1.7=CS

                      Port P3=Input ,Port P2=output

 

Hardware Connections for 8051 Board:-

1.      Give supply to 8051 board with the help of adapter

2.       Connect +5V pin of 8051 microcontroller to +5V supply and GND pin of 8051 microcontroller to GND pin of supply.

3.      Connect +5V pin of RS232 interface to +5V supply and GND pin of RS232 interface to GND pin of supply.

4.      Connect R2OUT pin of RS232 interface to RXD pin of 8051 and T2IN pin of RS232 interface to TXD pin of 8051.

5.      Connect ANALOG VIN of ADC to +5V supply and GND to GND pin of supply.

6.      Connect INTR pin of ADC to P1.4,WR pin of ADC to P1.5, RD pin  of ADC to P1.6 and CS pin of ADC to P1.7.

7.      Connect a jumper to VIN or LM35 or POT according to our input.

8.      Then connect D0-D7 pins of ADC to input. Here PORT 3 is input.

9.      Connect PORT2 to the output. Here LEDs are the output So connect them to PORT 2.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Circuit Diagram:

 

 

 

 

 

 

 

Program Code:

#include<reg51.h>

sbit R=P1^6;                                                         //set P1.6 bit as Read

sbit cs=P1^7;                                                        //set  P1.7 bit as chip select

sbit w=P1^5;                                                         //set P1.5 bit as write

sbit intr=P1^4;                                                      //set P1.4 bit as INTR

void delay(int);                                   

adc_read();

void delay(int a)

{

int i;

for(i=0;i<a;i++);

}

adc_read()

{

cs=0;                                                      //make chip select pin low

R=1;                                                       //make read pin high

w=0;                                                       //make write pin low

w=1;                                                       //make write pin high

while(intr!=0);

cs=0;

R=0;

}

void main()

{

unsigned char i;

while(1)

{

adc_read();

i=P3;

P2=i;

delay(10000);

}

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Get SOCIAL







SAFE & SECURE SHOPPING

visa card master card maestro card
Maverick IT Industries Pvt. Ltd.