iamalien
Newbie level 4
hello there i am trying to use the adc0808 with the microcontroller 8051 for a bigger project, so i wanted to test if i get correct output from the adc. To do this i made a temporary circuit and connected data pins to p3, eoc sc clock and ale to the port 0(used pull up too) and i am using only 1 input so i have kept others open and given address abc as 000 direct to ground and OE to vcc, vref+ to vcc, vref- to gnd and to test if conversion is happening, a pot in IN0. So i did what the datasheet says and sent controls accordingly but the eoc is not behaving properly, like i am checking for eoc pulse so that when it goes low to high the conversion would be over and until that happens the controller would check for it and so there is no output coming and stuck in that loop. This is my problem but when i tried the same circuit and code in proteus simulation everything works fine without any problem, please tell me what might be causing the problem
If u want to recheck the relevant part of the code isthe adc value reading function
[the clock is given using timer interrupt continuously at 500khz, another thing i tried only checking eoc if it went 1 since it might do conversion under 1 to 8 us according to data sheet so the code moves forward but then i get random value from data lines, after that i tried without checking eoc and just waiting still then it was giving random values]
If u want to recheck the relevant part of the code isthe adc value reading function
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 unsigned char readadc() { unsigned char adcvalue; delay(1); ale=1; delay(1); sc=1; delay(1); ale=0; delay(1); sc=0; while(eoc==1); while(eoc==0); delay(1); adcvalue=P3; delay(1); return adcvalue; }