+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322

    Question How can you understand ADCON?

    Hi All,
    Trying to understand how to set "ADCON". We start with ADCON0, then ADCON1, then ADCON2. Is this the same as setting RA0-7 to either a 1 or a 0? 1 meaning the RA is analog and 0 meaning it is digital? Then would ADCON0 apply to the RA0-7 pins and ADCON1 the RB0-7 pins and ADCON2 the RC0-7 pins? If you do not define an ADCON what happens? YES, I did look at the data sheet for an 18F2520 and all I see is text! I have read other posts and nothing seems to be very clear.

    Thanks, Ed

  2. #2
    Join Date
    Sep 2009
    Posts
    774

    Default Re: How can you understand ADCON?


  3. #3

    Default Re: How can you understand ADCON?

    Is this the same as setting RA0-7 to either a 1 or a 0? 1 meaning the RA is analog and 0 meaning it is digital?
    I'm not sure that a very helpful way to view the situation. Generally PIC devices have 1 single ADC who's input is connected to a multiplexor, in turn the inputs to multiplexor are connected to external pins.

    I don't know what device you are using so I can't go into specifics but for example on a 18F4550, ADCON bit 5-2 determine which multiplexor input is connected to the ADC. Bit 1 is set low to initiate a conversion and will go high when data is available. Bit 0 enables the ADC.

    ADCON1 bit 6-7 allow you to offset the top and/or bottom reading of the ADC. Bits 3-0 determine which possible multiplexor inputs are used (analogue to use, digital for GPIO).

    ADCON2 bit 7 determines the formatting of the 10 bit result in the high and low result registers, bit 5-3 set conversion time and bit 2-0 determine the ADC clock source.

    If you take your time, set each bit in turn. It's helpful to use binary notation as it show exactly what is set and what is clear.

    I hope that helps.

Similar Threads

  1. Pic18f452 adcon
    By gavo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th April 2011, 02:15
  2. Adcon
    By Martin.... in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th January 2007, 08:30
  3. What is ADCON?
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th January 2007, 23:55
  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 : 0

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