Questions about using the A to D


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: A to D reading confusion

    Hi Steve, Ed,

    Just to clarify further, it can never return 65535 no matter how you configure it.
    It'll look like this, where x is the actual conversion result returned by the 10 bit ADC:
    Code:
     ADRESH    ADRESL
    xxxxxxxx  xx000000	Left justified, ADCON2.7 = 0   (default)
    000000xx  xxxxxxxx	Right justified, ADCON2.7 = 1
    With left justification the two most significant bits in ADRESL are the two least significant bits of the 10 bit result.
    With right justification the two least significant bits in ADRESH are the two most significant bits of the 10 bit result.

    If you have the ADC set to left justification but look at the result as a "normal" 16 bit value each LSB of the ADC result will change the 16 bit value by 64 since the LSB of the ADC result is aligned with ADRESL.6.

    So, with left justification and the ADC saturated the maximum value it can return is 65472 since the 6 least significant bits in ADRESL will be 0.

    /Henrik.

  2. #2
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: A to D reading confusion

    Hi Henrik!
    Again thank you! You are correct. I connected a 10K resistor from the +5v to the ADC input pin and got 65472! Probably should have done that first! Just wondering, any way to eliminate the "bounce"?

    Ed

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: A to D reading confusion

    Hi Ed,
    Just wondering, any way to eliminate the "bounce"?
    Make sure that VRef is stable.
    In this case I think you're using Vdd as Vref so proper bypassing right at the supply pin(s) of the PIC. At Vdd/VRef=5V a difference of 4.88mV will make the ADC result "jump" a LSB. So any ripple larger than +/-5mV on the supply will be reflected on the readings.

    Make sure that you feed the ADC input from a low(ish) impedence circuit.
    If your sensor has a high output impedence you may need to buffer the signal with a OP-amp or whatever. Filter the sensor output then feed it to the buffer then to the ADC input.

    Or you can simply try throwing a 10-100nF capacitor right on the ADC input pin....
    Or just filter it in software.... which, again, will allow you to oversample and get more resolution (if needed).

    Remember, you're seeing a "bounce" of 4 (or 64 actually) but in reallity it's only a single LSB - and that's pretty normal.

    /Henrik.

Similar Threads

  1. PicKit 2 Questions
    By dmairspotter in forum General
    Replies: 3
    Last Post: - 11th November 2007, 21:10
  2. 2 questions
    By Archangel in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st December 2006, 02:47
  3. Serial questions
    By Armando Herjim in forum Serial
    Replies: 0
    Last Post: - 29th June 2006, 19:49
  4. New with questions
    By Terke in forum General
    Replies: 5
    Last Post: - 6th December 2005, 06:35
  5. Questions?
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd June 2005, 14:44

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