cannot read RA4 pin3 ADC configuration?
I can read AN0, AN1, AN2 but not AN3, AN4 data appears to change with AN2.
AM I missing a configuration setting?
INCLUDE "modedefs.bas"
DEFINE CHAR_PACING 500 '
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
WPUA=%00000000
OSCCON = $60 ' WDT_OFF,
@ DEVICE PIC16F684, INTRC_OSC_NOCLKOUT, PWRT_Off, MCLR_OFF, BOD_OFF,PROTECT_OFF
AD0 VAR WORD ' AD0 word (10 bits)
AD1 VAR WORD ' AD1 word (10 bits)
AD2 VAR WORD ' AD2 word (10 bits)
AD3 VAR WORD ' AD3 word (10 bits)
AD4 VAR WORD ' AD4 word (10 bits)
TRISA = %11011111
TRISC = %11000000
CMCON0 = 7 '%00000111 ' Comparators OFF
CCP1CON = %00000000
adcon0=%00000001
ANSEL = %00000001
LOW PORTC.1
loop:
ADCIN 0,AD0 'read channel 0...AN0
AD0 = AD0 >> 6
ADCIN 2,AD2 'read channel 2...AN2
AD2 = AD2 >> 6
ADCIN 3,AD3 'read channel 3...AN3
AD3 = AD3 >> 6
ADCIN 4,AD4 'read channel 4...AN4
AD4 = AD4 >> 6
SerOut PORTA.5, n2400,[I,192,#AD0," ",#ad2," ",#AD4," "]
SerOut PORTA.5, n2400,[I,128,#AD3," "]
goto loop
ANSEL %00011111 didn't work
Thanks MR E for the reply!
pin 3 RA4, AN3 seems like it is an output because it is low impeadance.
I am trying to measure 0 - 4 vdc and have a 10k series
resistor and a .1uf capacitor. The voltage is loaded down
on some boards, a few boards pin 3 seems to work.
I figure I am missing some configuration setting or don't understand
something. 3 other adc inputs work as expected.
Mark