What is ADCON?


Closed Thread
Results 1 to 3 of 3

Thread: What is ADCON?

  1. #1
    Join Date
    Jul 2006
    Posts
    76

    Default What is ADCON?

    Hello everyone,

    Can someone tell me how to configure adcon(1)? I need to use all the analog channels on my PIC18F4550 for the adcin command. Can anyone tell me how to read the datasheet?

    I have attached a picture of the table from the datasheet for anyone who is interested.

    On the table, if I configure adcon1 to the values on the left, does that mean that the corresponding ports will be either analog or digital? And then by default they are analog? And that also means that you cannot make channel 12 analog without making everything else analog? Thanks you for any responses, as this is probably a really stupid question.

    -Mike

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default

    Hi,

    ADCON1:
    Bit 7 is not used
    Bit 6 is not used
    Bit 5 sets the negative reference
    Bit 4 sets the positive reference
    Bit 3-0 sets the pins to Analog or Digital according to the table.

    So,
    ADCON1 = 0 should do it.
    That will assign Vdd and Vss as pos/neg reference for the ADC and set all 13 inputs to analog.

    The state at startup depends on the PBADEN configuration bit. (See note 1 just under the table)

    As the table shows you can not use AN12 only as analog, if you need one channel only set ADCON1 to 14 and use AN0.

    Dont forget to check if there are other functions on any of the pins that need's to be turned off. (Comparators is a classic example)

    /Henrik Olsson.

  3. #3
    Join Date
    Jul 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    Thank you very much, Henrik! This problem has been plaguing me forever.

    -Mike

Similar Threads

  1. Adcon
    By Martin.... in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th January 2007, 08:30
  2. adcon problems with adcin
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 3rd January 2007, 22:15
  3. 16F818 ADCON question
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st February 2006, 10:50
  4. ADCON Explanation
    By eoasap in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th December 2005, 19:08
  5. ADCON does not compile 16F628
    By mslaney in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2005, 15:43

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