ADCIN does not work with AN16


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68

    Default 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

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: ADCIN does not work with AN16

    Anselc correctly set ?

  3. #3
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default 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

  4. #4
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default 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...

  5. #5
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default 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.

Similar Threads

  1. Help with ADCin
    By RDavid60 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 18th May 2011, 02:56
  2. Adcin, can't get it right
    By atwoz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th January 2008, 20:38
  3. adcon1/ adcin
    By Patrick in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th July 2006, 07:39
  4. help using adcin
    By harryweb in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2006, 07:46
  5. ADCIN Help
    By Tear in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th July 2005, 18:47

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts