Hi, I'm Alex from Italy.
Sorry for the bad English.
I'm trying to verify what is the input voltage level on AN0 that sets the LSB to 1 (in theory 5/1024 = 4.88mV!).
On breadboard I stabilized Vdd = 5V with lm317.
I send the converted value to 10bits on portb (8 least significant bits!), And on RC0 and RC1 the two bits MSB
Problems:
1) The Vin level that sets the LSB (RB0!) to 1 is "variable" (almost a linear ramp between about 1.8 and 5V!) Between about 6 and 8mV.
2) with an oscilloscope I see a sort of "PWM" output on RB0 with variable duty cycle, when the Vin varies between about 6 and 8mV !!!!
Unless you are extremely careful, you will always get noise on the signal.
My 'rule of thumb' is that you only really get 8 bits directly out of a 10 (or even 12) bit ADC and you might get another bit (or 2) with careful programming (averaging etc.)
Therefore having the LSB (or 2) moving randomly is to be expected.
Susan