I have a new Uniboard with ATMega 128. I want to try out adc with 8 bit resolution & Vref=2.56 V internal ref. I wrote the code for the same, to convert adc0 & adc1 channels. I tried this code on a ATMega 8 dev board that I have (ofcourse with relevant changes in register names etc) and the result of the adc is displayed through a USART to a PC. When I tried the code on Uniboard, even with zero volts i/p, I get some small readings. I checked the hardware and found that the Vref on the uniboard is directly shorted to the AVCC pin, which is connected to Vcc. This is a problem, since now I cannot get better resolutions at lower i/p volts.
How can I separate the Vref as a separate input? I also get some small readings on the o/p related to both i/p channels. The readings are same, as if the two i/p are from one analog source. I use two separate pots from 5v source to get two independent analogs.
I have attached the code, there is much more in the code, like LCD display, USART comm, binary conversion to bcd for LCD display etc, which can be ignored.
Can someone please help?