Not sure what is going on with your setup, I do not see the problem.
I dug out a board with an 18F2550 and ran the below code to make sure it works. I only have the ADC on channels 1 and 2 as I have a LED soldered on channel 2. Other than that it should all be the same.
Code:
'<FL_PIC18F2550>'
'<FL_PBPL>'
DEFINE OSC 48
#CONFIG
__CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
__CONFIG _CONFIG2L, _PWRT_ON_2L & _VREGEN_ON_2L
__CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
#ENDCONFIG
CNT VAR BYTE
ADCON2.7 = 1
ADCON1 = %00001101
TRISA = %00000011
DEFINE ADC_BITS 10
DEFINE ADC_SAMPLEUS 50
ADC_0 VAR WORD
ADC_1 VAR WORD
START:
CNT = CNT + 1
Serout2 PORTC.6, 16572, ["TEST ",DEC3 CNT, $d, $a]
Serout2 PORTC.6, 16572, ["ADC_0 ",DEC4 ADC_0, $d, $a]
Serout2 PORTC.6, 16572, ["ADC_1 ",DEC4 ADC_1, $d, $a]
TOGGLE PORTA.2
PAUSE 1000
GOSUB GET_ADC
GOTO START
GET_ADC:
ADCIN 0, ADC_0
ADCIN 1, ADC_1
RETURN
Bookmarks