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.
Without having read the documentation for your specific processor: Isn't the AIN1 and AIN0 registers in your source code the virtual registers in the debugger/simulator, that allows a simulated version of your processor to think that it is seeing these voltages?
Note that the programming language used by the simulator to create test harnesses looks very much like C.