A/D Conversion Clock Select bits confussion ..


+ Reply to Thread
Results 1 to 30 of 30
  1. #1
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default A/D Conversion Clock Select bits confussion ..

    Hello everyone ..

    For a long time I've been struggling with these settings ... When one would like to perform an ADC reading what kind of settings he must add into his code ?

    As far as I read the datasheet of 16F1827 , I see the following details about this setting

    Code:
    ADCS<2:0>:A/D Conversion Clock Select bits
    000=FOSC/2
    001=FOSC/8
    010=FOSC/32
    011=FRC(clock supplied from a dedicated RC oscillator)
    100=FOSC/4
    101=FOSC/16
    110=FOSC/64
    111=FRC(clock supplied from a dedicated RC oscillator)
    So , If I'm running my PIC at 32 MHZ internal oscillator , the setting should be 011 or 010 ?

    and the SECOND QUESTION :

    What is the maximum ADC conversion time at 32MHZ for the PIC16F1827 ...
    When I look at the conversion tables that Microchip has published for this PIC , I can't understand which is the exact time at the selected OSC frequency that takes for a complete ADC conversion time ..

    Thanks in advance ...

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,032

    Default Re: A/D Conversion Clock Select bits confussion ..

    010=FOSC/32 tad=1.0uS
    011=FRC tad=1.0uS to 6uS (vcc and temperature dependant)
    110=FOSC/64 tad=2.0uS

    a 10 bit adc takes 11.5 tads

    any divider less than fosc/32 @32mhz is out of reliable conversion range

  3. #3
    Join Date
    Apr 2013
    Posts
    32

    Default Re: A/D Conversion Clock Select bits confussion ..

    FOSC is Frequency of OSCillator, so if you are using 32MHz internal osc, your fosc is 32MHz if you are using 8MHz external osc then your fosc is 8 MHz and if you are using 4 MHz external with PLL then your FOSC is 16MHz.
    011 and 111 settings are for an internal dedicated oscillator with 1.6us period if I remember correct...
    You can always use fosc/2 timing since faster is generally better. But again, it depends on your timing need. If you don't need a special timing, just choose whatever you like.

    Edit: I'm not sure minimum conversion time but I believe it has to be larger then 10us
    Last edited by elcrcp; - 19th July 2015 at 14:03.

  4. #4
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: A/D Conversion Clock Select bits confussion ..

    Thanks for your answers but I still do not understand something .. Which one of these oscillator settings should be chosen for a robust operation .. Or in other words , for a "classic proper" operation ... What I understand from your explanations is that I can choose any of these settings non regarding if the OSC is internal or external ...

    As far as I know the Frc stands for internal oscillator ... Please correct me If I'm wrong at this point .. So If I choose 4MHZ with PLL operation , I'm running it with 32 MHZ internal oscillator which is also called the internal RC osc block , so in this case I should go with Frc for a more accurate conversion ... or with Fosc/32 or Fosc/2 for a faster conversion ... Right ?

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    32 MHz is a too high frequency to obtain a good ADC reading. The minimum TAD is 1.6 us and If you set fosc/64 you will get a TAD of 2 us and you are barely inside the correct timing. Since you will be in the low end side as far as the TAD value is concerned. Dropping your fosc to 16 MHz with the same setting you will have a TAD of 4 us which is much better than 2 us.

    Cheers
    Al.
    Last edited by aratti; - 20th July 2015 at 00:58.
    All progress began with an idea

  6. #6
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: A/D Conversion Clock Select bits confussion ..

    Thanks Al .. You may be right ...
    Well the question is how to set the define adc sampleus parameter in pbp ? I should adjust it according to the decided Fosc ?

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    The sampleus parameter is the time given for the acquisition ( changing the sample & hold capacitor). This timing is critical since you must charge the capacitor no more than 1T..(up to 1T the charging curve is quasi linear) Now If you have decided to use fosc = 16 MHz than the minimum pauseus you can get is 5 us so a Define adc_sampleus 15 should give you good results.

    Cheers

    Al.
    Last edited by aratti; - 20th July 2015 at 09:02.
    All progress began with an idea

  8. #8
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: A/D Conversion Clock Select bits confussion ..

    Should we not calculate it 1.6x11 Tad = 17.6 uS ? Thus is it not better to set it to 20 uS ?

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    The 11 TADs is the time taken by the MCU for the 10 bits convertion! Please do not confuse acquisition with convertion. The setting suggested is the time you will give to the sample & hold capacitor to charge with your input dc value. This time should be enough to charge the cap not beyond the 1T, because beyond this point the charging function is no longer quasi-linear, but totaly logaritmic.

    You can set it to 20 us and see If your ADC reading are consistent and adjust this value to suite your need. (Remember that the best acquisition time will depend by the hardware setting, so every circuit has his own best acquisition time)

    Cheers
    Al.
    Last edited by aratti; - 20th July 2015 at 12:22.
    All progress began with an idea

  10. #10
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: A/D Conversion Clock Select bits confussion ..

    Grazie tante per la risposta cara aratti ..

  11. #11
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Re: A/D Conversion Clock Select bits confussion ..

    I remember saving a link to this... http://www.edaboard.com/nextoldesttoentry1570.html
    page. Be sure to hit the "next" button at the bottom of the page where there is discussion of acquisition time.

    hope this helps you.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  12. #12
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default Re: A/D Conversion Clock Select bits confussion ..

    I remember saving a link to this... http://www.edaboard.com/nextoldesttoentry1570.html
    page. Be sure to hit the "next" button at the bottom of the page to go to Part 2 where there is discussion of acquisition time.

    Possibly something of value there.
    Last edited by Heckler; - 21st July 2015 at 05:13.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  13. #13
    Join Date
    Dec 2012
    Location
    Türkiye
    Posts
    103

    Default Re: A/D Conversion Clock Select bits confussion ..

    The only part I cant understand is the line he somehow calculated 40 + 38.4 us = 78.4 uS .. where did that 40 come from ?

  14. #14
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    40 us is the value the author arbitrarely gives as acquisition time "sampleus parameter".

    Remember:

    A too high acquisition time will give issues when the analog input approch the V(ref+)

    A too low acquisition time will give issues when the analog input approch the zero

    So, if you do not see any issues in your reading at the extreme of the reading field then the acquisition time used is correct!

    Ciao, complimenti per il tuo italiano!

    Al.
    Last edited by aratti; - 21st July 2015 at 14:37.
    All progress began with an idea

  15. #15

    Default Re: A/D Conversion Clock Select bits confussion ..

    A too high acquisition time will give issues when the analog input approch the V(ref+)
    A too low acquisition time will give issues when the analog input approch the zero
    Where do you get this from?

    The aquisition time is the MINIMUM amount of time you have to wait for the holding capacitor (and it's RC network) to fully charge/discharge to the voltage level you're sampling.

    If you set the acquisition time too low then you won't have allowed enough time for the charge on the capacitor to reach the desired level, and you'll get an incorrect conversion. It doesn't matter so much if the input is near Vref or zero, it'll be wrong.

    If you're measuring a DC voltage, there is no "too high" an aquisition time.

  16. #16
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    Where do you get this from?
    From the charging function of a capacitor!

    Al.
    All progress began with an idea

  17. #17

    Default Re: A/D Conversion Clock Select bits confussion ..

    So you're saying that if you wait too long the voltage on your sampling capacitor will be wrong?

    If you put a small RC network across a voltage source, what will the voltage across the capacitor be if you wait a second? A minute? An hour?

  18. #18
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    You cannot use the full function because it is foundamentally a logaritmic function. For the ADC convertion you need a linear function. Once time, resistence and capacity are fixed than the charging function depend only from the voltage applied. If during the charging time you do not pass the 1T point of the function, than the charging function can be considered "quasi liner" and the system work. In other words you can deduce the value of the voltage applied. If you pass the 1T point then thing become more complicated since from that point on the function is purely logaritmic.

    Cheers
    Al.
    All progress began with an idea

  19. #19

    Default Re: A/D Conversion Clock Select bits confussion ..

    You're somehow mixing Acquisition time with the linearity of the ADC conversion function.

    For the Acquisition time, you need the sample cap to charge to whatever value you want the ADC to convert. Period.

    The time constant of an RC network is T=RC, and after one T the voltage across the cap is roughly 66% of the input voltage.
    If you look at T vs percent, you get:
    Code:
    1    63.2% 
    2    86.5% 
    3    95.0% 
    4    98.2% 
    5    99.3% 
    10   99.995%
    20   99.9999998%
    If you set the Acquisition time to 1T and then convert the value, you could be VERY wrong... 37% wrong. Of course, that depends on the new input voltage you want to convert and any existing charge on the sample cap, but T gives you a worst-case number.

    For example, an 8-bit ADC (1 part in 256, or 0.39%) would need an acquisition time of better than 5T, but there's nothing wrong with giving it 10T or 20T or 100T, as long as nothing else changes in that time.

    You do not have to hit some magic 1T window trying to get it into a "quasi-linear" range, or guess at things to "see if it's good enough".

  20. #20
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    No much to say, just keep your convintions if you are happy with them.

    Al.
    All progress began with an idea

  21. #21
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,382

    Default Re: A/D Conversion Clock Select bits confussion ..

    Hi,
    I must say I'm quite confused and intruiged by this statement as well.

    As I'm currently messing around with the ADC in the 18F2431 I've been reading up on the acquisition time and conversion time requirement(s) in order to better understand it and I can't for the life of me find any references to issues with too long acqusition time.

    The datasheet is pretty clear on the point that the conversion clock period (TAD) needs to be as short as possible, yet still longer than the minimum (418ns for 18F2431). This means that when operating at 40MHz the selection FOsc/32 must be used since that gives a TAD of 800ns. Going a step lower (FOsc/16) would violate the 416ns requirement. A conversion takes 12TAD so 9.6us in this case.

    The minimum acqusition time, ie for how long the S/H capacitor is connected to the analog input before the conversion starts dependes on the source impedence driving the inputs, temperature range etc. For a 1k source impedence I calculated the minimum acquistion time to 2.38us which is ~3TAD in my case. I'm well below 1k in source impedence but I'm going to stick with a acqusition time of 4TAD.

    This gives me a total A to D time of 3.2+9.6=12.8us.

    Nowhere can I see any reference to issues with too long acqusition time.

    Confused.....

    /Henrik.

  22. #22
    Join Date
    May 2013
    Location
    australia
    Posts
    2,032

    Default Re: A/D Conversion Clock Select bits confussion ..

    if it were possible that the acquisition time could be too long then surely the optimum acquisition time would have to varied logarithmically according to the instantaneous sample voltage . the suggestion is not realistic ,unsubstantiated and unworkable

  23. #23

    Default Re: A/D Conversion Clock Select bits confussion ..

    Agreed.

    Confused...
    Don't be. You have it correct.

    What you're computing is the minimum time it takes for the RC sample/hold network to charge to the input voltage assuming you're making a full-scale voltage change. Depending on the accuracy you're trying to reach that normally takes about 7T-8T. Once it's charged up (or down), you're good to go, but it does no harm in waiting longer (as long as nothing else changes).

    The only thing to watch out for is if you change PIC's be sure to check the specs of the new device. The source resistance of the internal switch and the cap can be different for different families, so that can change the calculation.

  24. #24
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default Re: A/D Conversion Clock Select bits confussion ..

    Henrik, I am using a rather old pic (18F2620), I still have a couple of hundreds of them. But timing apart your and mine are very similar in the setting of the TAD value and the acquisition time.
    As far as TAD value is concerned I can Select value up to Fosc/64 (minimum delay required for 1 TAD = 1.6 us)
    As far as ACQUISTION TIME is concerned, I have a range selectable from 2 TAD to 20 TAD. (So you have a lower and upper limits)

    I made some experimenting some years ago, using the manual acquisition time, so I could increase/decrease the acquisition time beyond the 2/20 TAD limits. Unfortunatly I was not able to find these data (I have been digging for the whole day without success) but I assure you they were very interesting. The experiment was done taking 100 reading at three specific points of the 10 bits range. First point was fixed to 10 ADC count (low end), second point in the middle at 512 ADC count and the third point at 1012 ADC count (high end). These reading were taken at different acquisition time going from 1 us up to 200 us in steps of 10 us each.
    Once, all the data were collected ( they have been collected via RS232 connection and loaded directly into an Excel sheet), the statistic applied were : Average/Standard deviation/standard error.
    Looking at the standard error, I noticed an increase in the two extreme regions when the acquisition time was too low or higher than the 2/20 TADs region , no significant variation of standard error were observed in the middle range.
    I will continue to search these files (I am sure I still have them somewhere) and If I found them I will post them here in this thread.
    But everybody, with some time to spare, can repeat the experiment on his own.
    Cheers.
    Al
    Last edited by aratti; - 23rd July 2015 at 07:11.
    All progress began with an idea

  25. #25
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,382

    Default Re: A/D Conversion Clock Select bits confussion ..

    Hi,
    OK, I did the test.

    For this I was using a 18F25K20 running at 64MHz and 3.3V. Vref set to VDD/VSS and measured at 2.999V.
    Actual voltages measured with a FLUKE189

    The test program cycles thru all the available clock selections and all the available acquisition times (49 combinations). For each selection it takes 8 readings on AN0. Between each reading it makes a dummy conversion of another (floating) channel. After 8 readings it calculates the averages and presents the result.

    The test was conducted at 3 different input voltages (25mV, 1.65V, 3.285V) with 3 different source impedences (1k, 10k, 39k). For the 18F25K20 10k is the max recommended source impedence.

    Here's the code if anyone wants to repeat the test.
    Please note the ADC clock and acquisition time may be different on other devices, this matches the 25K20 that I used:
    Code:
    '****************************************************************
    '*  Name    : ADC Test.PBP                                      *
    '*  Author  : Henrik Olsson                                     *
    '*  Notice  : Copyright (c) 2015 Henrik Olsson                  *
    '*          : All Rights Reserved                               *
    '*  Date    : 2015-07-23                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : Test program for verifying ADC clock selection    *
    '*          : and acquisition times.                            *
    '*          : For 18F25K20.                                     *
    '****************************************************************
    DEFINE OSC 64
    DEFINE LOADER_USED 1                        ' We're using a bootloader.
    DEFINE HSER_RCSTA 90h                       ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h                       ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1                       ' Clear overflow automatically
    DEFINE HSER_SPBRG 138                       ' 115200 Baud @ 64MHz, -0,08%
    
    SPBRGH = 0
    BAUDCON.3 = 1                               ' Enable 16 bit baudrate generator
    
    ADCON0 = %00000001                          ' Enable the ADC, select AN0
    ADCON1 = %00000000                          ' Vref is Vdd/Vss respectively
    ADCON2 = %10001000                          ' Right justified result, 2TAD, FOosc/2
    
    TRISA.0 = 1                                 ' RA0/AN0 is input
    ANSEL.0 = 1                                 ' Digital buffer disabled, analog enabled
    
    Samples VAR BYTE
    ACQT VAR BYTE
    ADCS VAR BYTE
    RESULT VAR WORD
    Accumulator VAR WORD
    
    GODONE VAR ADCON0.1
    
    PAUSE 1000
    HSEROUT["Start",10,13]
    
    For ACQT = 1 to 7                           ' We have 7 different TAD settings ranging from 2TAD to 20TAD
        For ADCS = 0 to 6                       ' We hace 7 different conversion clock selections 
            ADCON2 = 128 + (ACQT * 8) + ADCS    ' "Build the ADCON2 word by combining the two settings.
            
            PAUSE 25
            
            Accumulator = 0
                    
            For samples = 0 to 7                ' Take 8 samples
                
                ' First make a dummy conversion of a channel we're not really interested in
                ADCON0.2 = 1
                GODONE = 1
                WHILE GODONE : WEND
                
                ' Then switch to AN0 and make a conversion.
                ADCON0.2 = 0
                GODONE = 1
                WHILE GODONE : WEND            
                
                ' Get the result and add it to the accumulator
                Result.HighByte=ADRESH
                Result.LOWBYTE=ADRESL
                Accumulator = Accumulator + Result
    
            NEXT
            
            ' Divide accumulated result by 8 to get the average of our 8 readings.
            Result = Accumulator >> 3
            
            ' These selections matches the 18F25K20
            Select CASE ADCS
                CASE 0
                    HSEROUT["FOSC/2     "]
                CASE 1
                    HSEROUT["FOSC/8     "]
                CASE 2
                    HSEROUT["FOSC/32    "]
                CASE 3
                    HSEROUT["FRC        "]
                CASE 4
                    HSEROUT["FOSC/4     "]
                CASE 5
                    HSEROUT["FOSC/16    "]
                CASE 6
                    HSEROUT["FOSC/64    "]
            END Select
            
            
            SELECT CASE ACQT
                CASE 1
                    HSEROUT["2 TAD    "]
                CASE 2
                    HSEROUT["4 TAD    "]
                CASE 3
                    HSEROUT["6 TAD    "]
                CASE 4
                    HSEROUT["8 TAD    "]
                CASE 5
                    HSEROUT["12 TAD   "]
                CASE 6
                    HSEROUT["16 TAD   "]
                CASE 7
                    HSEROUT["20 TAD   "]        
            END SELECT
            
            ' Report the result.
            HSEROUT["  Result: ", #RESULT, 13]
            
        NEXT
    NEXT
    
    PAUSE 100
    
    END
    And here are the results:
    Code:
    *****************************************************
    *****************************************************
    VRef is VDD/VSS measured to 3.299V
    1k resistor in series with input
    *****************************************************
    *****************************************************
    
    Input voltage 25.7mV
    FOSC/2     2 TAD      Result: 8
    FOSC/8     2 TAD      Result: 8
    FOSC/32    2 TAD      Result: 7
    FRC        2 TAD      Result: 7
    FOSC/4     2 TAD      Result: 8
    FOSC/16    2 TAD      Result: 7
    FOSC/64    2 TAD      Result: 7
    FOSC/2     4 TAD      Result: 9
    FOSC/8     4 TAD      Result: 7
    FOSC/32    4 TAD      Result: 7
    FRC        4 TAD      Result: 7
    FOSC/4     4 TAD      Result: 8
    FOSC/16    4 TAD      Result: 7
    FOSC/64    4 TAD      Result: 7
    FOSC/2     6 TAD      Result: 8
    FOSC/8     6 TAD      Result: 7
    FOSC/32    6 TAD      Result: 7
    FRC        6 TAD      Result: 7
    FOSC/4     6 TAD      Result: 7
    FOSC/16    6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FOSC/2     8 TAD      Result: 8
    FOSC/8     8 TAD      Result: 7
    FOSC/32    8 TAD      Result: 6
    FRC        8 TAD      Result: 7
    FOSC/4     8 TAD      Result: 7
    FOSC/16    8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FOSC/2     12 TAD     Result: 8
    FOSC/8     12 TAD     Result: 8
    FOSC/32    12 TAD     Result: 7
    FRC        12 TAD     Result: 7
    FOSC/4     12 TAD     Result: 7
    FOSC/16    12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FOSC/2     16 TAD     Result: 8
    FOSC/8     16 TAD     Result: 7
    FOSC/32    16 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/4     16 TAD     Result: 7
    FOSC/16    16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FOSC/2     20 TAD     Result: 8
    FOSC/8     20 TAD     Result: 7
    FOSC/32    20 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/4     20 TAD     Result: 7
    FOSC/16    20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    Input Voltage: 1.650V
    FOSC/2     2 TAD      Result: 497
    FOSC/8     2 TAD      Result: 509
    FOSC/32    2 TAD      Result: 511
    FRC        2 TAD      Result: 511
    FOSC/4     2 TAD      Result: 508
    FOSC/16    2 TAD      Result: 511
    FOSC/64    2 TAD      Result: 511
    FOSC/2     4 TAD      Result: 504
    FOSC/8     4 TAD      Result: 511
    FOSC/32    4 TAD      Result: 511
    FRC        4 TAD      Result: 511
    FOSC/4     4 TAD      Result: 512
    FOSC/16    4 TAD      Result: 511
    FOSC/64    4 TAD      Result: 511
    FOSC/2     6 TAD      Result: 507
    FOSC/8     6 TAD      Result: 511
    FOSC/32    6 TAD      Result: 511
    FRC        6 TAD      Result: 511
    FOSC/4     6 TAD      Result: 512
    FOSC/16    6 TAD      Result: 511
    FOSC/64    6 TAD      Result: 511
    FOSC/2     8 TAD      Result: 509
    FOSC/8     8 TAD      Result: 511
    FOSC/32    8 TAD      Result: 511
    FRC        8 TAD      Result: 511
    FOSC/4     8 TAD      Result: 512
    FOSC/16    8 TAD      Result: 511
    FOSC/64    8 TAD      Result: 511
    FOSC/2     12 TAD     Result: 511
    FOSC/8     12 TAD     Result: 511
    FOSC/32    12 TAD     Result: 511
    FRC        12 TAD     Result: 512
    FOSC/4     12 TAD     Result: 512
    FOSC/16    12 TAD     Result: 511
    FOSC/64    12 TAD     Result: 511
    FOSC/2     16 TAD     Result: 511
    FOSC/8     16 TAD     Result: 511
    FOSC/32    16 TAD     Result: 511
    FRC        16 TAD     Result: 511
    FOSC/4     16 TAD     Result: 512
    FOSC/16    16 TAD     Result: 511
    FOSC/64    16 TAD     Result: 511
    FOSC/2     20 TAD     Result: 511
    FOSC/8     20 TAD     Result: 511
    FOSC/32    20 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/4     20 TAD     Result: 512
    FOSC/16    20 TAD     Result: 512
    FOSC/64    20 TAD     Result: 511
    
    Input Voltage: 3.286V
    FOSC/2     2 TAD      Result: 511
    FOSC/8     2 TAD      Result: 1013
    FOSC/32    2 TAD      Result: 1019
    FRC        2 TAD      Result: 1019
    FOSC/4     2 TAD      Result: 995
    FOSC/16    2 TAD      Result: 1018
    FOSC/64    2 TAD      Result: 1019
    FOSC/2     4 TAD      Result: 511
    FOSC/8     4 TAD      Result: 1019
    FOSC/32    4 TAD      Result: 1019
    FRC        4 TAD      Result: 1020
    FOSC/4     4 TAD      Result: 1011
    FOSC/16    4 TAD      Result: 1020
    FOSC/64    4 TAD      Result: 1019
    FOSC/2     6 TAD      Result: 1006
    FOSC/8     6 TAD      Result: 1019
    FOSC/32    6 TAD      Result: 1019
    FRC        6 TAD      Result: 1020
    FOSC/4     6 TAD      Result: 1016
    FOSC/16    6 TAD      Result: 1019
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 1014
    FOSC/8     8 TAD      Result: 1020
    FOSC/32    8 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/4     8 TAD      Result: 1018
    FOSC/16    8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FOSC/2     12 TAD     Result: 1017
    FOSC/8     12 TAD     Result: 1019
    FOSC/32    12 TAD     Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/4     12 TAD     Result: 1020
    FOSC/16    12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1019
    FOSC/2     16 TAD     Result: 1019
    FOSC/8     16 TAD     Result: 1019
    FOSC/32    16 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/4     16 TAD     Result: 1020
    FOSC/16    16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FOSC/2     20 TAD     Result: 1020
    FOSC/8     20 TAD     Result: 1020
    FOSC/32    20 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/4     20 TAD     Result: 1020
    FOSC/16    20 TAD     Result: 1020
    FOSC/64    20 TAD     Result: 1019
    
    *****************************************************
    *****************************************************
    VRef is VDD/VSS measured to 3.299V
    10k resistor in series with input
    *****************************************************
    *****************************************************
    
    Input voltage 25.7mV
    FOSC/2     2 TAD      Result: 9
    FOSC/8     2 TAD      Result: 8
    FOSC/32    2 TAD      Result: 7
    FRC        2 TAD      Result: 7
    FOSC/4     2 TAD      Result: 8
    FOSC/16    2 TAD      Result: 7
    FOSC/64    2 TAD      Result: 7
    FOSC/2     4 TAD      Result: 8
    FOSC/8     4 TAD      Result: 7
    FOSC/32    4 TAD      Result: 7
    FRC        4 TAD      Result: 7
    FOSC/4     4 TAD      Result: 8
    FOSC/16    4 TAD      Result: 7
    FOSC/64    4 TAD      Result: 7
    FOSC/2     6 TAD      Result: 8
    FOSC/8     6 TAD      Result: 7
    FOSC/32    6 TAD      Result: 7
    FRC        6 TAD      Result: 7
    FOSC/4     6 TAD      Result: 7
    FOSC/16    6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FOSC/2     8 TAD      Result: 8
    FOSC/8     8 TAD      Result: 7
    FOSC/32    8 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/4     8 TAD      Result: 7
    FOSC/16    8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FOSC/2     12 TAD     Result: 8
    FOSC/8     12 TAD     Result: 7
    FOSC/32    12 TAD     Result: 7
    FRC        12 TAD     Result: 7
    FOSC/4     12 TAD     Result: 7
    FOSC/16    12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FOSC/2     16 TAD     Result: 8
    FOSC/8     16 TAD     Result: 8
    FOSC/32    16 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/4     16 TAD     Result: 8
    FOSC/16    16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FOSC/2     20 TAD     Result: 8
    FOSC/8     20 TAD     Result: 7
    FOSC/32    20 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/4     20 TAD     Result: 7
    FOSC/16    20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    
    Input voltage 1.650V
    FOSC/2     2 TAD      Result: 445
    FOSC/8     2 TAD      Result: 471
    FOSC/32    2 TAD      Result: 508
    FRC        2 TAD      Result: 511
    FOSC/4     2 TAD      Result: 448
    FOSC/16    2 TAD      Result: 494
    FOSC/64    2 TAD      Result: 511
    FOSC/2     4 TAD      Result: 457
    FOSC/8     4 TAD      Result: 493
    FOSC/32    4 TAD      Result: 511
    FRC        4 TAD      Result: 511
    FOSC/4     4 TAD      Result: 470
    FOSC/16    4 TAD      Result: 507
    FOSC/64    4 TAD      Result: 511
    FOSC/2     6 TAD      Result: 461
    FOSC/8     6 TAD      Result: 503
    FOSC/32    6 TAD      Result: 511
    FRC        6 TAD      Result: 511
    FOSC/4     6 TAD      Result: 485
    FOSC/16    6 TAD      Result: 510
    FOSC/64    6 TAD      Result: 511
    FOSC/2     8 TAD      Result: 472
    FOSC/8     8 TAD      Result: 507
    FOSC/32    8 TAD      Result: 511
    FRC        8 TAD      Result: 511
    FOSC/4     8 TAD      Result: 494
    FOSC/16    8 TAD      Result: 511
    FOSC/64    8 TAD      Result: 511
    FOSC/2     12 TAD     Result: 478
    FOSC/8     12 TAD     Result: 510
    FOSC/32    12 TAD     Result: 511
    FRC        12 TAD     Result: 511
    FOSC/4     12 TAD     Result: 510
    FOSC/16    12 TAD     Result: 511
    FOSC/64    12 TAD     Result: 511
    FOSC/2     16 TAD     Result: 493
    FOSC/8     16 TAD     Result: 511
    FOSC/32    16 TAD     Result: 511
    FRC        16 TAD     Result: 511
    FOSC/4     16 TAD     Result: 512
    FOSC/16    16 TAD     Result: 511
    FOSC/64    16 TAD     Result: 511
    FOSC/2     20 TAD     Result: 503
    FOSC/8     20 TAD     Result: 511
    FOSC/32    20 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/4     20 TAD     Result: 512
    FOSC/16    20 TAD     Result: 511
    FOSC/64    20 TAD     Result: 511
    
    
    Input voltage 3.286V
    FOSC/2     2 TAD      Result: 511
    FOSC/8     2 TAD      Result: 929
    FOSC/32    2 TAD      Result: 1012
    FRC        2 TAD      Result: 1019
    FOSC/4     2 TAD      Result: 880
    FOSC/16    2 TAD      Result: 981
    FOSC/64    2 TAD      Result: 1019
    FOSC/2     4 TAD      Result: 511
    FOSC/8     4 TAD      Result: 980
    FOSC/32    4 TAD      Result: 1018
    FRC        4 TAD      Result: 1019
    FOSC/4     4 TAD      Result: 926
    FOSC/16    4 TAD      Result: 1011
    FOSC/64    4 TAD      Result: 1019
    FOSC/2     6 TAD      Result: 511
    FOSC/8     6 TAD      Result: 1001
    FOSC/32    6 TAD      Result: 1019
    FRC        6 TAD      Result: 1020
    FOSC/4     6 TAD      Result: 959
    FOSC/16    6 TAD      Result: 1017
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 511
    FOSC/8     8 TAD      Result: 1010
    FOSC/32    8 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/4     8 TAD      Result: 979
    FOSC/16    8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FOSC/2     12 TAD     Result: 511
    FOSC/8     12 TAD     Result: 1017
    FOSC/32    12 TAD     Result: 1020
    FRC        12 TAD     Result: 1020
    FOSC/4     12 TAD     Result: 1000
    FOSC/16    12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1019
    FOSC/2     16 TAD     Result: 923
    FOSC/8     16 TAD     Result: 1019
    FOSC/32    16 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/4     16 TAD     Result: 1010
    FOSC/16    16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FOSC/2     20 TAD     Result: 990
    FOSC/8     20 TAD     Result: 1019
    FOSC/32    20 TAD     Result: 1019
    FRC        20 TAD     Result: 1020
    FOSC/4     20 TAD     Result: 1015
    FOSC/16    20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1019
    
    
    *****************************************************
    *****************************************************
    VRef is VDD/VSS measured to 3.299V
    39k resistor in series with input
    *****************************************************
    *****************************************************
    
    Input voltage: 25.7mV
    FOSC/2     2 TAD      Result: 11
    FOSC/8     2 TAD      Result: 7
    FOSC/32    2 TAD      Result: 7
    FRC        2 TAD      Result: 7
    FOSC/4     2 TAD      Result: 8
    FOSC/16    2 TAD      Result: 7
    FOSC/64    2 TAD      Result: 7
    FOSC/2     4 TAD      Result: 9
    FOSC/8     4 TAD      Result: 7
    FOSC/32    4 TAD      Result: 7
    FRC        4 TAD      Result: 7
    FOSC/4     4 TAD      Result: 7
    FOSC/16    4 TAD      Result: 7
    FOSC/64    4 TAD      Result: 7
    FOSC/2     6 TAD      Result: 8
    FOSC/8     6 TAD      Result: 8
    FOSC/32    6 TAD      Result: 7
    FRC        6 TAD      Result: 7
    FOSC/4     6 TAD      Result: 8
    FOSC/16    6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FOSC/2     8 TAD      Result: 8
    FOSC/8     8 TAD      Result: 7
    FOSC/32    8 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/4     8 TAD      Result: 8
    FOSC/16    8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FOSC/2     12 TAD     Result: 9
    FOSC/8     12 TAD     Result: 7
    FOSC/32    12 TAD     Result: 7
    FRC        12 TAD     Result: 7
    FOSC/4     12 TAD     Result: 7
    FOSC/16    12 TAD     Result: 8
    FOSC/64    12 TAD     Result: 7
    FOSC/2     16 TAD     Result: 8
    FOSC/8     16 TAD     Result: 7
    FOSC/32    16 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/4     16 TAD     Result: 7
    FOSC/16    16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FOSC/2     20 TAD     Result: 8
    FOSC/8     20 TAD     Result: 7
    FOSC/32    20 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/4     20 TAD     Result: 7
    FOSC/16    20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    Input voltage: 1.650V
    FOSC/2     2 TAD      Result: 406
    FOSC/8     2 TAD      Result: 420
    FOSC/32    2 TAD      Result: 470
    FRC        2 TAD      Result: 507
    FOSC/4     2 TAD      Result: 407
    FOSC/16    2 TAD      Result: 441
    FOSC/64    2 TAD      Result: 496
    FOSC/2     4 TAD      Result: 408
    FOSC/8     4 TAD      Result: 439
    FOSC/32    4 TAD      Result: 495
    FRC        4 TAD      Result: 511
    FOSC/4     4 TAD      Result: 418
    FOSC/16    4 TAD      Result: 469
    FOSC/64    4 TAD      Result: 509
    FOSC/2     6 TAD      Result: 415
    FOSC/8     6 TAD      Result: 457
    FOSC/32    6 TAD      Result: 505
    FRC        6 TAD      Result: 511
    FOSC/4     6 TAD      Result: 428
    FOSC/16    6 TAD      Result: 485
    FOSC/64    6 TAD      Result: 511
    FOSC/2     8 TAD      Result: 418
    FOSC/8     8 TAD      Result: 469
    FOSC/32    8 TAD      Result: 509
    FRC        8 TAD      Result: 512
    FOSC/4     8 TAD      Result: 442
    FOSC/16    8 TAD      Result: 495
    FOSC/64    8 TAD      Result: 511
    FOSC/2     12 TAD     Result: 427
    FOSC/8     12 TAD     Result: 486
    FOSC/32    12 TAD     Result: 511
    FRC        12 TAD     Result: 511
    FOSC/4     12 TAD     Result: 456
    FOSC/16    12 TAD     Result: 506
    FOSC/64    12 TAD     Result: 511
    FOSC/2     16 TAD     Result: 450
    FOSC/8     16 TAD     Result: 496
    FOSC/32    16 TAD     Result: 511
    FRC        16 TAD     Result: 512
    FOSC/4     16 TAD     Result: 469
    FOSC/16    16 TAD     Result: 509
    FOSC/64    16 TAD     Result: 511
    FOSC/2     20 TAD     Result: 453
    FOSC/8     20 TAD     Result: 502
    FOSC/32    20 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/4     20 TAD     Result: 478
    FOSC/16    20 TAD     Result: 510
    FOSC/64    20 TAD     Result: 511
    
    Input voltage: 3.286V
    FOSC/2     2 TAD      Result: 768
    FOSC/8     2 TAD      Result: 826
    FOSC/32    2 TAD      Result: 931
    FRC        2 TAD      Result: 1010
    FOSC/4     2 TAD      Result: 801
    FOSC/16    2 TAD      Result: 873
    FOSC/64    2 TAD      Result: 986
    FOSC/2     4 TAD      Result: 511
    FOSC/8     4 TAD      Result: 867
    FOSC/32    4 TAD      Result: 984
    FRC        4 TAD      Result: 1019
    FOSC/4     4 TAD      Result: 824
    FOSC/16    4 TAD      Result: 929
    FOSC/64    4 TAD      Result: 1014
    FOSC/2     6 TAD      Result: 511
    FOSC/8     6 TAD      Result: 904
    FOSC/32    6 TAD      Result: 1006
    FRC        6 TAD      Result: 1019
    FOSC/4     6 TAD      Result: 847
    FOSC/16    6 TAD      Result: 963
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 511
    FOSC/8     8 TAD      Result: 930
    FOSC/32    8 TAD      Result: 1014
    FRC        8 TAD      Result: 1019
    FOSC/4     8 TAD      Result: 874
    FOSC/16    8 TAD      Result: 985
    FOSC/64    8 TAD      Result: 1019
    FOSC/2     12 TAD     Result: 511
    FOSC/8     12 TAD     Result: 963
    FOSC/32    12 TAD     Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/4     12 TAD     Result: 901
    FOSC/16    12 TAD     Result: 1006
    FOSC/64    12 TAD     Result: 1019
    FOSC/2     16 TAD     Result: 847
    FOSC/8     16 TAD     Result: 985
    FOSC/32    16 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/4     16 TAD     Result: 927
    FOSC/16    16 TAD     Result: 1015
    FOSC/64    16 TAD     Result: 1019
    FOSC/2     20 TAD     Result: 847
    FOSC/8     20 TAD     Result: 999
    FOSC/32    20 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/4     20 TAD     Result: 950
    FOSC/16    20 TAD     Result: 1017
    FOSC/64    20 TAD     Result: 1019
    I haven't analyzed any of it yet and I don't have any more time just now but I wanted to post the results. If anyone wants to graph the results in Excel or whatever to better see what's going on, please feel free to do so.

    /Henrik.

  26. #26

    Default Re: A/D Conversion Clock Select bits confussion ..

    You certainly coverted all the bases! Good job.

    Instead of bothering to graph all the data and try and make sense of it, Let's start with this:

    The 25K20 has a TAD spec of 0.7us min.

    At 64MHz, that means all ADCS settings except for FOSC/64 and FRC violate minimum times (Table 19-1).
    Using the FOSC/64 setting gives a TAD of 1us

    Computing Tc from equation 19-1 for each of the three source resistances gives:
    1K = 0.27us
    10K = 1.2us
    39K = 4.2us

    Computing TACQ = Tamp + Tc + Tcoff, given Tamp = 5us and Tcoff = 0 (25degC) produces:
    1K = 5.27us
    10K = 6.2us
    39K = 9.2us

    So, since TAD = 1us, TACQ must be a min of ~6-9 TAD for the three different resistances.

    Removing all of the measurements that don't fit the above you get:
    Code:
    *****************************************************
    1k resistor in series with input (TACQ=5.27us)
    *****************************************************
    Input voltage 25.7mV
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    Input Voltage: 1.650V
    FRC        6 TAD      Result: 511
    FOSC/64    6 TAD      Result: 511
    FRC        8 TAD      Result: 511
    FOSC/64    8 TAD      Result: 511
    FRC        12 TAD     Result: 512
    FOSC/64    12 TAD     Result: 511
    FRC        16 TAD     Result: 511
    FOSC/64    16 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/64    20 TAD     Result: 511
    
    Input Voltage: 3.286V
    FRC        6 TAD      Result: 1020
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1019
    
    
    *****************************************************
    10k resistor in series with input  (TACQ=6.2us)
    *****************************************************
    
    Input voltage 25.7mV
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    
    Input voltage 1.650V
    FRC        6 TAD      Result: 511
    FOSC/64    6 TAD      Result: 511
    FRC        8 TAD      Result: 511
    FOSC/64    8 TAD      Result: 511
    FRC        12 TAD     Result: 511
    FOSC/64    12 TAD     Result: 511
    FRC        16 TAD     Result: 511
    FOSC/64    16 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/64    20 TAD     Result: 511
    
    
    Input voltage 3.286V
    FRC        6 TAD      Result: 1020
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1020
    FOSC/64    12 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1020
    FOSC/64    20 TAD     Result: 1019
    
    
    *****************************************************
    39k resistor in series with input  (TACQ=9.2us)
    *****************************************************
    
    Input voltage: 25.7mV
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    Input voltage: 1.650V
    FRC        6 TAD      Result: 511
    FOSC/64    6 TAD      Result: 511
    FRC        8 TAD      Result: 512
    FOSC/64    8 TAD      Result: 511
    FRC        12 TAD     Result: 511
    FOSC/64    12 TAD     Result: 511
    FRC        16 TAD     Result: 512
    FOSC/64    16 TAD     Result: 511
    FRC        20 TAD     Result: 511
    FOSC/64    20 TAD     Result: 511
    
    Input voltage: 3.286V
    FRC        6 TAD      Result: 1019
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1019
    FRC        16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1019
    Pretty consistent. It shows that waiting longer than the minimum doesn't get you anything, but it also doesn't change anything either.
    The interesting thing is as you look through the raw data you can see the effect of not using the proper TAD setting for the clock freq you're using, or not waiting/setting TACQ to at least the minimum time.

  27. #27
    Join Date
    May 2013
    Location
    australia
    Posts
    2,032

    Default Re: A/D Conversion Clock Select bits confussion ..

    it might be interesting to connect the "dummy conversion" pin to ground and then in another pass vcc , and give it a long acquisition and then take your reading . I would expect the real effect of a too short acquisition time would become more evident (ie the previous reading sample cap charge will have a effect on the current reading)

  28. #28

    Default Re: A/D Conversion Clock Select bits confussion ..

    I wondered about that too. As you say, connecting it to a floating input would probably just leave the charge on Chold since all you have is the leakage current to discharge it.

    I noticed in figure 19-4 that they show a 2TAD "discharge" time between measurements, and they say this:
    19.2.3 DISCHARGE
    The discharge phase is used to initialize the value of
    the capacitor array. The array is discharged after every
    sample. This feature helps to optimize the unity-gain
    amplifier, as the circuit always needs to charge the
    capacitor array, rather than charge/discharge based on
    previous measure values.
    The PIC18 reference manual has the same sort of text, but is also has the statement
    The charge holding capacitor (CHOLD) is not discharged after each conversion
    so it sounds like they're talking about something to do with the internal ADC structure and not Chold.

    It WOULD be interesting to see the same measurements without any averaging and with alternating input voltages for the in between "idle" cycles.

  29. #29
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,382

    Default Re: A/D Conversion Clock Select bits confussion ..

    Hi guys,
    OK, doing a dummy conversion on a floating input wasn't the greatest idea....

    I took out the averaging and set up my arb gen to generate 3.3Vpp noise and injected that into AN1 (the dummy channel).

    Code:
    25.6mV input, 10k source resistor, 3.3V noise on "dummy channel":
    FOSC/2     2 TAD      Result: 512
    FOSC/8     2 TAD      Result: 120
    FOSC/32    2 TAD      Result: 23
    FRC        2 TAD      Result: 6
    FOSC/4     2 TAD      Result: 184
    FOSC/16    2 TAD      Result: 54
    FOSC/64    2 TAD      Result: 7
    FOSC/2     4 TAD      Result: 190
    FOSC/8     4 TAD      Result: 59
    FOSC/32    4 TAD      Result: 14
    FRC        4 TAD      Result: 13
    FOSC/4     4 TAD      Result: 117
    FOSC/16    4 TAD      Result: 21
    FOSC/64    4 TAD      Result: 14
    FOSC/2     6 TAD      Result: 127
    FOSC/8     6 TAD      Result: 32
    FOSC/32    6 TAD      Result: 11
    FRC        6 TAD      Result: 11
    FOSC/4     6 TAD      Result: 74
    FOSC/16    6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 10
    FOSC/2     8 TAD      Result: 512
    FOSC/8     8 TAD      Result: 15
    FOSC/32    8 TAD      Result: 15
    FRC        8 TAD      Result: 12
    FOSC/4     8 TAD      Result: 56
    FOSC/16    8 TAD      Result: 10
    FOSC/64    8 TAD      Result: 6
    FOSC/2     12 TAD     Result: 512
    FOSC/8     12 TAD     Result: 11
    FOSC/32    12 TAD     Result: 16
    FRC        12 TAD     Result: 13
    FOSC/4     12 TAD     Result: 31
    FOSC/16    12 TAD     Result: 11
    FOSC/64    12 TAD     Result: 14
    FOSC/2     16 TAD     Result: 512
    FOSC/8     16 TAD     Result: 13
    FOSC/32    16 TAD     Result: 11
    FRC        16 TAD     Result: 11
    FOSC/4     16 TAD     Result: 18
    FOSC/16    16 TAD     Result: 11
    FOSC/64    16 TAD     Result: 9
    FOSC/2     20 TAD     Result: 49
    FOSC/8     20 TAD     Result: 15
    FOSC/32    20 TAD     Result: 10
    FRC        20 TAD     Result: 8
    FOSC/4     20 TAD     Result: 14
    FOSC/16    20 TAD     Result: 10
    FOSC/64    20 TAD     Result: 13
    
    ***************************************
    
    3.285V, 10k source resistor 3.3V noise on "dummy channel":
    
    FOSC/2     2 TAD      Result: 511
    FOSC/8     2 TAD      Result: 861
    FOSC/32    2 TAD      Result: 1008
    FRC        2 TAD      Result: 1022
    FOSC/4     2 TAD      Result: 812
    FOSC/16    2 TAD      Result: 963
    FOSC/64    2 TAD      Result: 1014
    FOSC/2     4 TAD      Result: 511
    FOSC/8     4 TAD      Result: 964
    FOSC/32    4 TAD      Result: 1021
    FRC        4 TAD      Result: 1023
    FOSC/4     4 TAD      Result: 888
    FOSC/16    4 TAD      Result: 1004
    FOSC/64    4 TAD      Result: 1015
    FOSC/2     6 TAD      Result: 511
    FOSC/8     6 TAD      Result: 994
    FOSC/32    6 TAD      Result: 1019
    FRC        6 TAD      Result: 1023
    FOSC/4     6 TAD      Result: 911
    FOSC/16    6 TAD      Result: 1018
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 511
    FOSC/8     8 TAD      Result: 1006
    FOSC/32    8 TAD      Result: 1019
    FRC        8 TAD      Result: 1021
    FOSC/4     8 TAD      Result: 964
    FOSC/16    8 TAD      Result: 1022
    FOSC/64    8 TAD      Result: 1016
    FOSC/2     12 TAD     Result: 511
    FOSC/8     12 TAD     Result: 1015
    FOSC/32    12 TAD     Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/4     12 TAD     Result: 991
    FOSC/16    12 TAD     Result: 1023
    FOSC/64    12 TAD     Result: 1015
    FOSC/2     16 TAD     Result: 511
    FOSC/8     16 TAD     Result: 1014
    FOSC/32    16 TAD     Result: 1018
    FRC        16 TAD     Result: 1018
    FOSC/4     16 TAD     Result: 1005
    FOSC/16    16 TAD     Result: 1016
    FOSC/64    16 TAD     Result: 1023
    FOSC/2     20 TAD     Result: 983
    FOSC/8     20 TAD     Result: 1020
    FOSC/32    20 TAD     Result: 1017
    FRC        20 TAD     Result: 1023
    FOSC/4     20 TAD     Result: 1010
    FOSC/16    20 TAD     Result: 1017
    FOSC/64    20 TAD     Result: 1019
    Then I connected the dummy channel to GND:
    Code:
    25.6mV input, 10k source resistor, "dummy channel" connected to GND:
    
    FOSC/2     2 TAD      Result: 8
    FOSC/8     2 TAD      Result: 6
    FOSC/32    2 TAD      Result: 8
    FRC        2 TAD      Result: 7
    FOSC/4     2 TAD      Result: 6
    FOSC/16    2 TAD      Result: 7
    FOSC/64    2 TAD      Result: 7
    FOSC/2     4 TAD      Result: 8
    FOSC/8     4 TAD      Result: 7
    FOSC/32    4 TAD      Result: 8
    FRC        4 TAD      Result: 7
    FOSC/4     4 TAD      Result: 6
    FOSC/16    4 TAD      Result: 7
    FOSC/64    4 TAD      Result: 7
    FOSC/2     6 TAD      Result: 8
    FOSC/8     6 TAD      Result: 7
    FOSC/32    6 TAD      Result: 7
    FRC        6 TAD      Result: 7
    FOSC/4     6 TAD      Result: 6
    FOSC/16    6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FOSC/2     8 TAD      Result: 8
    FOSC/8     8 TAD      Result: 7
    FOSC/32    8 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/4     8 TAD      Result: 7
    FOSC/16    8 TAD      Result: 8
    FOSC/64    8 TAD      Result: 7
    FOSC/2     12 TAD     Result: 8
    FOSC/8     12 TAD     Result: 7
    FOSC/32    12 TAD     Result: 7
    FRC        12 TAD     Result: 7
    FOSC/4     12 TAD     Result: 8
    FOSC/16    12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FOSC/2     16 TAD     Result: 8
    FOSC/8     16 TAD     Result: 7
    FOSC/32    16 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/4     16 TAD     Result: 8
    FOSC/16    16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FOSC/2     20 TAD     Result: 8
    FOSC/8     20 TAD     Result: 7
    FOSC/32    20 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/4     20 TAD     Result: 8
    FOSC/16    20 TAD     Result: 8
    FOSC/64    20 TAD     Result: 7
    
    *******************************************************
    
    3.285V input, 10k source resistor, "dummy" channel connected to GND:
    
    FOSC/2     2 TAD      Result: 511
    FOSC/8     2 TAD      Result: 714
    FOSC/32    2 TAD      Result: 996
    FRC        2 TAD      Result: 1019
    FOSC/4     2 TAD      Result: 610
    FOSC/16    2 TAD      Result: 892
    FOSC/64    2 TAD      Result: 1018
    FOSC/2     4 TAD      Result: 511
    FOSC/8     4 TAD      Result: 862
    FOSC/32    4 TAD      Result: 1018
    FRC        4 TAD      Result: 1018
    FOSC/4     4 TAD      Result: 687
    FOSC/16    4 TAD      Result: 991
    FOSC/64    4 TAD      Result: 1019
    FOSC/2     6 TAD      Result: 511
    FOSC/8     6 TAD      Result: 955
    FOSC/32    6 TAD      Result: 1020
    FRC        6 TAD      Result: 1019
    FOSC/4     6 TAD      Result: 761
    FOSC/16    6 TAD      Result: 1010
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 511
    FOSC/8     8 TAD      Result: 983
    FOSC/32    8 TAD      Result: 1020
    FRC        8 TAD      Result: 1018
    FOSC/4     8 TAD      Result: 836
    FOSC/16    8 TAD      Result: 1018
    FOSC/64    8 TAD      Result: 1019
    FOSC/2     12 TAD     Result: 511
    FOSC/8     12 TAD     Result: 1010
    FOSC/32    12 TAD     Result: 1020
    FRC        12 TAD     Result: 1019
    FOSC/4     12 TAD     Result: 944
    FOSC/16    12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1020
    FOSC/2     16 TAD     Result: 511
    FOSC/8     16 TAD     Result: 1017
    FOSC/32    16 TAD     Result: 1019
    FRC        16 TAD     Result: 1018
    FOSC/4     16 TAD     Result: 981
    FOSC/16    16 TAD     Result: 1020
    FOSC/64    16 TAD     Result: 1019
    FOSC/2     20 TAD     Result: 511
    FOSC/8     20 TAD     Result: 1017
    FOSC/32    20 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/4     20 TAD     Result: 998
    FOSC/16    20 TAD     Result: 1021
    FOSC/64    20 TAD     Result: 1020
    And finally, dummy channel to Vdd (3.3V):
    Code:
    25.6mV input, 10k source resistor, "dummy channel" connected to Vdd:
    
    FOSC/2     2 TAD      Result: 512
    FOSC/8     2 TAD      Result: 344
    FOSC/32    2 TAD      Result: 29
    FRC        2 TAD      Result: 8
    FOSC/4     2 TAD      Result: 432
    FOSC/16    2 TAD      Result: 192
    FOSC/64    2 TAD      Result: 9
    FOSC/2     4 TAD      Result: 512
    FOSC/8     4 TAD      Result: 262
    FOSC/32    4 TAD      Result: 9
    FRC        4 TAD      Result: 8
    FOSC/4     4 TAD      Result: 383
    FOSC/16    4 TAD      Result: 46
    FOSC/64    4 TAD      Result: 8
    FOSC/2     6 TAD      Result: 512
    FOSC/8     6 TAD      Result: 180
    FOSC/32    6 TAD      Result: 8
    FRC        6 TAD      Result: 7
    FOSC/4     6 TAD      Result: 350
    FOSC/16    6 TAD      Result: 17
    FOSC/64    6 TAD      Result: 7
    FOSC/2     8 TAD      Result: 512
    FOSC/8     8 TAD      Result: 99
    FOSC/32    8 TAD      Result: 8
    FRC        8 TAD      Result: 7
    FOSC/4     8 TAD      Result: 312
    FOSC/16    8 TAD      Result: 10
    FOSC/64    8 TAD      Result: 7
    FOSC/2     12 TAD     Result: 512
    FOSC/8     12 TAD     Result: 25
    FOSC/32    12 TAD     Result: 7
    FRC        12 TAD     Result: 8
    FOSC/4     12 TAD     Result: 229
    FOSC/16    12 TAD     Result: 8
    FOSC/64    12 TAD     Result: 7
    FOSC/2     16 TAD     Result: 512
    FOSC/8     16 TAD     Result: 12
    FOSC/32    16 TAD     Result: 7
    FRC        16 TAD     Result: 8
    FOSC/4     16 TAD     Result: 147
    FOSC/16    16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FOSC/2     20 TAD     Result: 512
    FOSC/8     20 TAD     Result: 9
    FOSC/32    20 TAD     Result: 7
    FRC        20 TAD     Result: 8
    FOSC/4     20 TAD     Result: 66
    FOSC/16    20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    *********************************************
    
    
    3.285V input, 10k source resistor, "dummy channel" connected to Vdd:
    
    FOSC/2     2 TAD      Result: 1022
    FOSC/8     2 TAD      Result: 1021
    FOSC/32    2 TAD      Result: 1020
    FRC        2 TAD      Result: 1020
    FOSC/4     2 TAD      Result: 1022
    FOSC/16    2 TAD      Result: 1020
    FOSC/64    2 TAD      Result: 1019
    FOSC/2     4 TAD      Result: 1022
    FOSC/8     4 TAD      Result: 1019
    FOSC/32    4 TAD      Result: 1019
    FRC        4 TAD      Result: 1019
    FOSC/4     4 TAD      Result: 1019
    FOSC/16    4 TAD      Result: 1021
    FOSC/64    4 TAD      Result: 1020
    FOSC/2     6 TAD      Result: 1023
    FOSC/8     6 TAD      Result: 1021
    FOSC/32    6 TAD      Result: 1019
    FRC        6 TAD      Result: 1020
    FOSC/4     6 TAD      Result: 1020
    FOSC/16    6 TAD      Result: 1020
    FOSC/64    6 TAD      Result: 1019
    FOSC/2     8 TAD      Result: 1022
    FOSC/8     8 TAD      Result: 1020
    FOSC/32    8 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/4     8 TAD      Result: 1020
    FOSC/16    8 TAD      Result: 1021
    FOSC/64    8 TAD      Result: 1019
    FOSC/2     12 TAD     Result: 1022
    FOSC/8     12 TAD     Result: 1020
    FOSC/32    12 TAD     Result: 1019
    FRC        12 TAD     Result: 1020
    FOSC/4     12 TAD     Result: 1020
    FOSC/16    12 TAD     Result: 1021
    FOSC/64    12 TAD     Result: 1020
    FOSC/2     16 TAD     Result: 1021
    FOSC/8     16 TAD     Result: 1021
    FOSC/32    16 TAD     Result: 1019
    FRC        16 TAD     Result: 1021
    FOSC/4     16 TAD     Result: 1021
    FOSC/16    16 TAD     Result: 1019
    FOSC/64    16 TAD     Result: 1019
    FOSC/2     20 TAD     Result: 1020
    FOSC/8     20 TAD     Result: 1021
    FOSC/32    20 TAD     Result: 1019
    FRC        20 TAD     Result: 1021
    FOSC/4     20 TAD     Result: 1018
    FOSC/16    20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1020
    Henrik.

  30. #30

    Default Re: A/D Conversion Clock Select bits confussion ..

    Thanks Henrik. So again, removing the ones where the ADCS setting is invalid/too fast gives:
    Code:
    25.6mV input, 10k source resistor, 3.3V noise on "dummy channel":
    
    FRC        2 TAD      Result: 6
    FOSC/64    2 TAD      Result: 7
    FRC        4 TAD      Result: 13
    FOSC/64    4 TAD      Result: 14
    FRC        6 TAD      Result: 11
    FOSC/64    6 TAD      Result: 10
    FRC        8 TAD      Result: 12
    FOSC/64    8 TAD      Result: 6
    FRC        12 TAD     Result: 13
    FOSC/64    12 TAD     Result: 14
    FRC        16 TAD     Result: 11
    FOSC/64    16 TAD     Result: 9
    FRC        20 TAD     Result: 8
    FOSC/64    20 TAD     Result: 13
    
    *********************************************
    
    3.285V, 10k source resistor 3.3V noise on "dummy channel":
    
    FRC        2 TAD      Result: 1022
    FOSC/64    2 TAD      Result: 1014
    FRC        4 TAD      Result: 1023
    FOSC/64    4 TAD      Result: 1015
    FRC        6 TAD      Result: 1023
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1021
    FOSC/64    8 TAD      Result: 1016
    FRC        12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1015
    FRC        16 TAD     Result: 1018
    FOSC/64    16 TAD     Result: 1023
    FRC        20 TAD     Result: 1023
    FOSC/64    20 TAD     Result: 1019
    
    *********************************************
    
    25.6mV input, 10k source resistor, "dummy channel" connected to GND:
    
    FRC        2 TAD      Result: 7
    FOSC/64    2 TAD      Result: 7
    FRC        4 TAD      Result: 7
    FOSC/64    4 TAD      Result: 7
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 7
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 7
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 7
    FOSC/64    20 TAD     Result: 7
    
    *********************************************
    
    3.285V input, 10k source resistor, "dummy" channel connected to GND:
    
    FRC        2 TAD      Result: 1019
    FOSC/64    2 TAD      Result: 1018
    FRC        4 TAD      Result: 1018
    FOSC/64    4 TAD      Result: 1019
    FRC        6 TAD      Result: 1019
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1018
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1020
    FRC        16 TAD     Result: 1018
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1020
    
    *********************************************
    
    25.6mV input, 10k source resistor, "dummy channel" connected to Vdd:
    
    FRC        2 TAD      Result: 8
    FOSC/64    2 TAD      Result: 9
    FRC        4 TAD      Result: 8
    FOSC/64    4 TAD      Result: 8
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 8
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 8
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 8
    FOSC/64    20 TAD     Result: 7
    
    *********************************************
    
    3.285V input, 10k source resistor, "dummy channel" connected to Vdd:
    
    FRC        2 TAD      Result: 1020
    FOSC/64    2 TAD      Result: 1019
    FRC        4 TAD      Result: 1019
    FOSC/64    4 TAD      Result: 1020
    FRC        6 TAD      Result: 1020
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1019
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1020
    FOSC/64    12 TAD     Result: 1020
    FRC        16 TAD     Result: 1021
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1021
    FOSC/64    20 TAD     Result: 1020
    Probably the ones of most interest are where Chold has to swing the full range between samples:
    Code:
    3.285V input, 10k source resistor, "dummy" channel connected to GND:
    
    FRC        2 TAD      Result: 1019
    FOSC/64    2 TAD      Result: 1018
    FRC        4 TAD      Result: 1018
    FOSC/64    4 TAD      Result: 1019
    FRC        6 TAD      Result: 1019
    FOSC/64    6 TAD      Result: 1019
    FRC        8 TAD      Result: 1018
    FOSC/64    8 TAD      Result: 1019
    FRC        12 TAD     Result: 1019
    FOSC/64    12 TAD     Result: 1020
    FRC        16 TAD     Result: 1018
    FOSC/64    16 TAD     Result: 1019
    FRC        20 TAD     Result: 1019
    FOSC/64    20 TAD     Result: 1020
    
    *********************************************
    
    25.6mV input, 10k source resistor, "dummy channel" connected to Vdd:
    
    FRC        2 TAD      Result: 8
    FOSC/64    2 TAD      Result: 9
    FRC        4 TAD      Result: 8
    FOSC/64    4 TAD      Result: 8
    FRC        6 TAD      Result: 7
    FOSC/64    6 TAD      Result: 7
    FRC        8 TAD      Result: 7
    FOSC/64    8 TAD      Result: 7
    FRC        12 TAD     Result: 8
    FOSC/64    12 TAD     Result: 7
    FRC        16 TAD     Result: 8
    FOSC/64    16 TAD     Result: 7
    FRC        20 TAD     Result: 8
    FOSC/64    20 TAD     Result: 7
    For no averaging those numbers seem pretty reasonable.

Similar Threads

  1. Replies: 2
    Last Post: - 23rd April 2013, 17:34
  2. DT_INTS-14 /interrupts enable bits / flag bits
    By bogdan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th May 2009, 19:42
  3. external clock / internal clock
    By grounded in forum General
    Replies: 4
    Last Post: - 31st May 2008, 18:44
  4. IF or SELECT
    By RYTECH in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 31st December 2005, 19:31
  5. Need clever way to convert 10 bits to 8 bits
    By MikeTamu in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd September 2005, 16:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts