Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/17/03 14:31
Read: times


 
#54876 - AD0804
Hi
I have connect an ADC0804 to an AT89c52 to port P1 and the RD,WR, INT to P2. and the output is display on digtial trainner but If I increase the IN voltage to the ADC the display is not changing. The following is the code i am using Keil can any tell what is the problem


include<reg51.h>
xdata unsigned char var;
void delay();
void display();
void adc();

sbit WR1 =P2^3;
sbit RD1 =P2^2;
sbit INTFLAG =P2^1;



main()
{

P1=0xFF;
P2=0X02;
while(1)
{
adc();
}
}



void adc()

{


WR1=0;
WR1=1;

if(INTFLAG==0)
{
RD1=1;
RD1=0;
var=P1;
display();
delay();
RD1=1;

}

}

void display()
{
#pragma asm
push dph
push dpl
push acc
push b

mov dptr,#var
movx a,@dptr
mov 60h,a
lcall 019bh
pop b
pop acc
pop dpl
pop dph


#pragma endasm

}

void delay()
{
int i;
for(i=0;i<30000;i++);
}

List of 4 messages in thread
TopicAuthorDate
AD0804            01/01/70 00:00      
   RE: AD0804            01/01/70 00:00      
      RE: AD0804            01/01/70 00:00      
   RE: AD0804            01/01/70 00:00      

Back to Subject List