ADCIN does not work with AN16
Hello All,
Is there any limitation in analog input #? I have ADCIN working OK with AN15 but it does not work with AN16.
Defines are standard:
DEFINE ADC_BITS 10 'Set number of bits in result
DEFINE ADC_SAMPLEUS 50 'Set sampling time in uS
DEFINE ADC_CLOCK 3
adcin 16 , READING returns a value around near 14000 (READING is word) which is strange for 10 bit conversion...
I use microcontroller PIC18F25k22
adcin 15 works OK
Can someone comment please?
Thank you
Re: ADCIN does not work with AN16
Re: ADCIN does not work with AN16
Yes,
ANSELC = %11000 'C.3, C.4 analog
C.3 and C.4 are AN15 and AN16
I suspect that unless there is my mistake somewhere, input # may be a byte variable in PBP3
I did the reading manually:
ADCON2 = %10000000 '111 'LEFT JUSTIFIED(0),not used,...
ADCON0 = %1000001 'AN16 USED 10000, NO GO NOW,STAY ON
ADCON1 = %1000 'VOLTAGE REFFERENCES
VREFCON0 = %10010000 'ENABLED, SET FOR 1.024 VOLT
RefNotReady:
IF VREFCON0.6 = 0 THEN GOTO RefNotReady
PAUSEUS 50
ADCON0 = %1000011 'GO NOW
ADCNotComplete:
IF ADCON0.1 = 1 THEN GOTO ADCNotComplete
AMB_TEMP.BYTE1 = ADRESH
AMB_TEMP.BYTE0 = ADRESL
VREFCON0 = 0 'DISABLE REFERENCE
ADCON1 = 0
ADCON0 = 0 'CONVERTER OFF, NO CURRENT
This seems to be working well
Re: ADCIN does not work with AN16
Which version of PBP are you using? The manual does not mention any limit to the number of addresses, but it is suspicious that 0-15 work and 16 and up do not...
Re: ADCIN does not work with AN16
It is PBP3 3.0.7.4, must be the most recent. Actually I did not try higher #s than 16.