your variable A0 by ADCIN must be defined as word and no as byte
Thank you so much for your help!
This is all of the code,
A0 VAR WORD
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
TRISA = 255 ' Set PORTA to all input
'ADCON1 = 2 ' This gives me 16 bit results
ADCON1=%10000010 'This gives me 8 bit results
ADCIN 0, A0 ' PORTA.0 PIN 13
SEROUT PORTC.5,6,[" A0 = ",#A0,10]
your defines are ok.
A0 VAR WORD
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
TRISA = 255 ' Set PORTA to all input
ADCON1=%10000010 'This gives me 8 bit results
ADCIN 0, A0 ' PORTA.0 PIN 13
SEROUT PORTC.5,6,[" A0 = ",#A0,10]
note!
When use 8 bit PIC then working this only with 8 bit resolution. Check datasheet from your PIC
Bookmarks