You went from something good like this...
ADCON1 = 2
.. ..
for sample = 0 to 20
adcin 2 ,temp
samples= samples + temp
pause 100
next sample
temp = samples / 20
...and all you had to do was change ADCIN 2 to ADCIN 0 (PBP Manual!) for it to read from RA0/AN0, to something like your second example which is completely shot.
For complete definitions of ADCON0 and ADCON1 see your PICs DATASHEET.
Bookmarks