Adcon1


Closed Thread
Results 1 to 5 of 5

Thread: Adcon1

  1. #1
    Join Date
    Sep 2005
    Posts
    28

    Default Adcon1

    I am using a PIC 18F242 with 20mhz. I want to assign PinA.0 as an ADC input and all other Port A pins as digital inputs. I am currently using TrisaA = %11111111 and ADCON1 = %1001111. The digital input on PortA.2 does not appear to be working, and I assume there is a problem with the way I am reading the ADCON chart. Is ADCON1 = %1001111 correct?

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Not surprising ...

    IF you use external Vref + and Vref - ... ... A2 and A3 are the Vref+/- inputs ...

    IF NOT just try
    Code:
    ADCON1 = %01001110 ; ADCON1 is 8 Bits... not 7 !!!
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Sep 2005
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Using ADCON1 = %01001110 corrects my digital input problem, but now PortA.0 does not work as an analog input for ADC. Where can I find some more information on how ADCON1 works?

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Armadus View Post
    Using ADCON1 = %01001110 corrects my digital input problem, but now PortA.0 does not work as an analog input for ADC. Where can I find some more information on how ADCON1 works?
    Ok, I see ...

    You can try to open the 18F242 datasheet, ADC section ( $ 17 , I think )

    you also could post the code you've written here, I'm sure it will save lots of time to you ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Sep 2005
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Thanks for your help. I must have misread the table that I was looking at. The correct setting
    is ADCON1 = %10001110.

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