Today I trapped into the same hole...
ADCIN doesn't work on a PIC18Fxx31.
I have just written some code to read AN0..AN7 on devices who have this inputs.
Init-Part:
Code:
;ADC
ADON=true:ADCON2=%11101101 ;FOSC/16 AN0-AN4=analog right-justified, 40xTAD Sample
ANSEL0=%00011111
Inside Main-Code:
Code:
;ADC-Zyklus
;messen, umrechnen und gewichtet mitteln
;CtADC contains the ADC-channel
ADCHS=0:If CtADC.2 Then ADCHS=%01010101 ;Channel-Select
ADCON0.3=CtADC.1:ADCON0.2=CtADC.0
GO=true:Repeat:Until !GO ;ADC starten
DummyW.Highbyte=ADRESH:DummyW.Lowbyte=ADRESL
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
Bookmarks