Problem with ADC interfacing!!

Status
Not open for further replies.

Tamasco

Full Member level 3
Joined
Jun 27, 2006
Messages
155
Helped
10
Reputation
20
Reaction score
6
Trophy points
1,298
Activity points
2,083
Hi Everyone !!

I simulated an 8051 with an ADC8004 but got some unexpected results. The following is the schematic. For simplicity, I output the result to leds. The output is the same irrespective of the value of Vin!

The following is the assembly code :

***************************************************
Org 0h
start:
mov A,P2 ; save ADC data to Accumulator
mov P3, A ; output data
sjmp start
end
**************************************************

What could be this problem?
I would indeed be very grateful for your input. Thanks in advance.
 

Hi Tamasco

Even if ADC is running continuously you still need an initializing pulse following power-up. The WR and INTR node should be momentarily forced to logic low following a power-up cycle to guarantee operation.
 

    Tamasco

    Points: 2
    Helpful Answer Positive Rating
here my code! Hope it help full to you
Code:
#include "REG52.H"
sbit INT = P3^3;
sbit RW  = P3^2;  //edge L->H (canh len) cho phep analog signal vao ADC _bat dau chuyen doi
sbit READ  = P3^1;//doc data tu ADC0804 edge H->L (tac dong canh xuong)
sbit CS  =  P3^0;

void delay(unsigned char i);
//+++++++++++++++++++++++++

void main(void)
{
IE=0x84;//cho phep ngat ngoai 1 o chan P3.3
IT0=1;//cho phep ngat canh xuong

P2=0xFF;
P3=0xFF;
//cho phep ADC hoat dong
CS=0;
//RW tac dong canh len => bat dau cuyen doi
//start covert
RW=0;
RW=1;


while(1);
}
//============interupt================
void ADC_READY(void) interrupt 2
{unsigned char temp;
EX1=0;//cam ngat ngoài 1
//Read tac dong canh xuong cho phep doc digital
READ=1;
READ=0;
EX1=1;//cho phep ngat
//bat dau chuyen doi
RW=0;
RW=1;
} 

// ==========sub================ 
void delay(unsigned char i)
{
while(i--)
{ unsigned char k=121;
while(k--);
}
}
//
[/quote]
 

    Tamasco

    Points: 2
    Helpful Answer Positive Rating
Thank you very much, Silvio and baocr!!
I'll reconfigure it.
 

see this link and use the same hardware logic
**broken link removed**

Bibin john
www.bibinjohn.tk
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…