This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

89C2051 comparator not working....Help!!!

code as below, It suppose to work but not working,the output goes high even if no input is
present.I think the code is proper as documented by i don't know what is the problem...pls reply.

#include<89c2051.h>

#define LED P3_1

void main(void){

P1=P3= 0xff;

AIN0 = 0.000; //analog i/p 1
AIN1 = 4.500; //analog i/p 2

while(1){

/* If comparator o/p is high blink led*/
if(AOUT == 1){

LED = 1;
delay(1000); //delay 1 sec

LED = 0;
delay(1000); //delay 1 sec
}

}
}

I have connected AIN1 with 5k trimmer resistor to +5v vcc. AIN0 is my i/p..I varied trimmer in lot direction, even i changed the AIN0/AIN1 values, still i get high o/p...do anybody knows.

0