Strange problem. I can run pretty much the same thing you have here on an 877A and it
works fine.
On a LAB-X1 board it reads the POT on RA0. Changing to ADCIN 1 it reads the POT on RA1.Code:DEFINE OSC 20 @ DEVICE HS_OSC DEFINE ADC_BITS 10 DEFINE ADC_SAMPLEUS 50 B0 VAR BYTE 'just used for SERIN input and testing adcVal VAR WORD 'used for ADC value W1 VAR WORD 'used to test DEC function in SEROUT2 TRISA = 255 'PORTA is all input ADCON1 = %10000000 'PORTA analog, no ref voltages, output right justified PAUSE 500 W1 = 1022 'just to test DEC SEROUT2 PORTC.6,84,["Ready to go ", DEC W1, 10] 'Verify communication pause 10 loop: SERIN2 PORTC.7,84,[B0] 'Read in a character on PORTB.2 PAUSE 10 Serout2 PORTC.6,84, ["Getting ADC value", 10] pause 10 ADCIN 0, adcVal 'perform ADC and store 10 bits in adcVal pause 10 SEROUT2 PORTC.6,84,["ADC value: ", DEC adcVal, 10] 'Send the decimal value Goto loop 'Start again END
What happens if you disable A/D and try blinking an LED on RA0?




Bookmarks