I have posted the full code above(first post). That is the the first code I tried, eventually modified it numerous times, but still no success. I have neglected the bug regarding adc 0808 model in proteus as of now.
View attachment 124673
Initially I had connected EOC pin to pin 3.1, however it was giving me logic contention error despite proper initialization of eoc pin(refer code). So now after giving start pulse, I'm giving some delay and reading the data but not getting proper output.
Also, on hardware output values of adc displayed on lcd are not changing instantaneously with the change in analog input. It only changes when I switch the off and switch on the power supply of board.
for 0v: 00
for 5v: 255
In between it will give random values.
Note: I'm using P89v51rd2 whose library is not available on proteus.
Advice and suggestions would be highly appreciated.
Thank You