DEFINE ADC_CLOCK for 16F PICs


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Thanks, Alain.

    So . . . if I have a Tad of 24us and a sampling time of 12us, the total time required to sample the channel will be 36us, yes?

    Russ
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

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


    Did you find this post helpful? Yes | No

    Exclamation

    NO, Russ ...

    Conversion time = TAD + N • TAD + (11 - N)(2TOSC)
    Where: N = number of bits of resolution required.
    See the "Midrange Databook" $ 23.4 to 7 for details ...

    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
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RussMartin View Post
    So . . . if I have a Tad of 24us and a sampling time of 12us, the total time required to sample the channel will be 36us, yes?
    Yes Russ ...

    24uS would be the total for 12 TAD, with each TAD being 2uS, plus the acquisition time of 12uS (the minimum @8mhz).

    It may take just a little more for the instruction times within the ADCIN command.
    <br>
    DT

  4. #4
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    I looked at the ADC data book, Alain. Thanks. And thanks (again!) to Darrel.

    I've done ADC before, with the 12F683 at 4 MHz and 8 bits.

    Should I do anything different for the 16F88 at 8 MHz and 10 bits?
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RussMartin View Post
    I've done ADC before, with the 12F683 at 4 MHz and 8 bits.

    Should I do anything different for the 16F88 at 8 MHz and 10 bits?
    There are a few things to do differently.

    First thing is obvious, DEFINE ADC_BITS 10

    And, Right Justify the result ADCON1.7 = 1

    Then go here, and start using 12-bits or more.
    http://www.darreltaylor.com/DT_Analog/
    <br>
    DT

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I already oversample on the 12 bit-ers. I use averaging as part of the math. Rather than use something like (sample * 9) >> 4, it is better just to perform 9 conversions, add them together and shift. I typically only need 3 digits of precision.

    The thing most people ignore is the quality of their reference and dividers. They try to get 10-12 bits (or more) of resolution when using Vcc as the reference voltage. That just doesn't work. We use an LM4120-4096 (4.096V) reference with 0.2% accuracy. All voltage dividers use 0.1% resistors.

    I have code that has to run on 8720s. 8722s and 8723s (the user doesn't know what chip they have in their unit and I have to do field upgrades). I read the processor type and speed (PLL enabled or not - I have chips running at both 20 and 40Mhz) from the CONFIG registers and do a right shift (>>2) on the result if the chip is an 8723. I have to change all the timing, buad rates, A/D clocks as well. It all works well, though.
    Charles Linquist

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    The thing most people ignore is the quality of their reference and dividers. They try to get 10-12 bits (or more) of resolution when using Vcc as the reference voltage. That just doesn't work. We use an LM4120-4096 (4.096V) reference with 0.2% accuracy. All voltage dividers use 0.1% resistors.
    If the thing you are reading also operates with a Fixed Reference, then sure ... you should use a reference on the A/D.

    But most things are "Ratiometric" and a fixed reference will transfer any ripple on the power supply straight into your A/D readings. And regulators like 7805's that can't keep a constant voltage will make the readings wander all over the place.

    References have their place, but I believe you should not use them unless the right conditions are met.

    0.1% resistors ... gotta agree with that though.
    <br>
    DT

  8. #8
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    The power supply voltages I have to read are never ratiometric.
    Charles Linquist

Similar Threads

  1. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  2. PIC16F877A analog problem
    By DeViLa_Q8 in forum mel PIC BASIC
    Replies: 0
    Last Post: - 30th July 2009, 20:19
  3. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  4. PIC HSERIN problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 20th July 2008, 11:08
  5. Replies: 8
    Last Post: - 17th September 2006, 17:46

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