+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Full Member level 2
    Points: 3,070, Level: 13
    sawaak's Avatar
    Join Date
    May 2003
    Posts
    143
    Helped
    7 / 7
    Points
    3,070
    Level
    13

    calculating step size in ADC

    Hi,

    how to calculate step size when the information provided is Vcc=4V and input signal is from 0V to 1V and adc is 10 bits..

    should i do like

    Vcc / 1024 = 0.00390625 = 3.9 mV

    or

    1V / 1024 = 0.0009765625 = 0.976 mV


    thanks
    sawaak

  2. #2
    Super Moderator
    Points: 49,672, Level: 54
    Achievements:
    7 years registered
    keith1200rs's Avatar
    Join Date
    Oct 2009
    Location
    Yorkshire, UK
    Posts
    10,877
    Helped
    2074 / 2074
    Points
    49,672
    Level
    54

    Re: calculating step size in ADC

    It depends on the ADC and reference voltage being used. ADCs often have a separate input where you can feed an external reference of your choice. There are limits to the range of reference voltage though and 1V is unlikely.

    What is your ADC?

    Keith



    •   Alt23rd February 2011, 08:45

      advertising

        
       

  3. #3
    Administrator
    Points: 37,927, Level: 47
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    alexan_e's Avatar
    Join Date
    Mar 2008
    Location
    Greece
    Posts
    11,890
    Helped
    2085 / 2085
    Points
    37,927
    Level
    47
    Blog Entries
    6

    Re: calculating step size in ADC

    Quote Originally Posted by sawaak View Post
    Hi,

    how to calculate step size when the information provided is Vcc=4V and input signal is from 0V to 1V and adc is 10 bits..
    there is usually a separate reference voltage (internal or external) and in microcontrollers there is also the option (usually) to use the Vcc as reference.
    In any case the 0 to 1v is your input and it shouldn't be used as a reference voltage.
    If your reference voltage is the Vcc then Vcc / 1024 = 0.00390625 = 3.9 mV is correct
    if not then a reference voltage should be defined.

    Alex


    1 members found this post helpful.

  4. #4
    Advanced Member level 1
    Points: 5,476, Level: 17

    Join Date
    Jul 2004
    Location
    Hungary
    Posts
    474
    Helped
    188 / 188
    Points
    5,476
    Level
    17

    Re: calculating step size in ADC

    I agree with the above.
    Just one little thing:
    The step size of a 10 bits ADC is Uref/1023 , not Uref/1024 !!


    1 members found this post helpful.

    •   Alt23rd February 2011, 09:43

      advertising

        
       

  5. #5
    Administrator
    Points: 37,927, Level: 47
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    alexan_e's Avatar
    Join Date
    Mar 2008
    Location
    Greece
    Posts
    11,890
    Helped
    2085 / 2085
    Points
    37,927
    Level
    47
    Blog Entries
    6

    Re: calculating step size in ADC

    Quote Originally Posted by zuisti View Post
    I agree with the above.
    Just one little thing:
    The step size of a 10 bits ADC is Uref/1023 , not Uref/1024 !!
    Yes, that is correct, there are 1024 possible values, 0 to 1023 (0000000000 to 1111111111)

    Alex


    1 members found this post helpful.

    •   Alt23rd February 2011, 09:59

      advertising

        
       

  6. #6
    Super Moderator
    Points: 49,672, Level: 54
    Achievements:
    7 years registered
    keith1200rs's Avatar
    Join Date
    Oct 2009
    Location
    Yorkshire, UK
    Posts
    10,877
    Helped
    2074 / 2074
    Points
    49,672
    Level
    54

    Re: calculating step size in ADC

    Actually, I think it depends on the ADC. A lot divide by 2^n such as AD7658. It is the reason voltage references such as 4.096V exist.

    Keith.



  7. #7
    Advanced Member level 1
    Points: 5,476, Level: 17

    Join Date
    Jul 2004
    Location
    Hungary
    Posts
    474
    Helped
    188 / 188
    Points
    5,476
    Level
    17

    Re: calculating step size in ADC

    Hi my dear friends;

    On this issue (step size of an ADC), I am also a long ago uncertain:

    Which is correct: Ustep is equal to Uref/2^n or Uref/(2^n-1)

    I was looking for a lot longer on the net, but I did not get a clear answer.
    For example take a look on this site:
    analog-to-digital conversion: Definition from Answers.com

    Please discuss this here, if possible.

    One comment:
    In my PIC projects (10 bits ADC) I use always the second method (2^n-1),
    with good results.

    Thanks
    zuisti



  8. #8
    Super Moderator
    Points: 49,672, Level: 54
    Achievements:
    7 years registered
    keith1200rs's Avatar
    Join Date
    Oct 2009
    Location
    Yorkshire, UK
    Posts
    10,877
    Helped
    2074 / 2074
    Points
    49,672
    Level
    54

    Re: calculating step size in ADC

    I have just checked the PIC24H and that uses 1024 for the 10 bit ADC. I must admit I tend to think of 2^n as being more common, although there are some older 8 bit ADCs that use 2^(n-1) I think. Even the ADC0808 has a 20mV step from a 5.12V reference.

    Which PIC are you using?

    Keith.



  9. #9
    Administrator
    Points: 37,927, Level: 47
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    alexan_e's Avatar
    Join Date
    Mar 2008
    Location
    Greece
    Posts
    11,890
    Helped
    2085 / 2085
    Points
    37,927
    Level
    47
    Blog Entries
    6

    Re: calculating step size in ADC

    I was using Vref/1023 until now because this was what i have read in "embedded C programming and the atmel AVR" and i actually thoughtit was a standard to use Vref/((2^n)-1) but a quick look in the ATMega8 datasheet shows that is is actually (Vref/(2^n)) which is Vref/1024 for the 10bit ADC of AVRs

    Alex



  10. #10
    Advanced Member level 1
    Points: 5,476, Level: 17

    Join Date
    Jul 2004
    Location
    Hungary
    Posts
    474
    Helped
    188 / 188
    Points
    5,476
    Level
    17

    Re: calculating step size in ADC

    Yes, the ADC0808 is using a "pious fraud":

    (from the datasheet, page 5)
    "The bottom resistor and the top resistor of the ladder network
    in Figure 1 are not the same value as the remainder of the
    network. The difference in these resistors causes the output
    characteristic to be symmetrical with the zero and full-scale
    points of the transfer curve. The first output transition occurs
    when the analog signal has reached +½ LSB and succeeding
    output transitions occur every 1 LSB later up to full-scale."


    However, I did not find such a detailed description of the PICs
    ADC circuit, at least I did not. Perhaps it is also applied this solution?

    I'm using PIC18Fxxxx uCs, for ex. last a PIC18F2620 ...

    ---------- Post added at 14:03 ---------- Previous post was at 13:19 ----------

    Dealt with elsewhere also:
    View topic - A/D equation :: AVR Freaks
    and a Microchip forum:
    ADC quantum? (12F675)

    In any event, it really looks that the Vref/2^n is the good, but the "full-scale value"
    is not equal to Vref, but it's equal to Vref x 1023 / 1024 (in case of a 10 bits ADC).

    Thanks
    zuisti



  11. #11
    Super Moderator
    Points: 49,672, Level: 54
    Achievements:
    7 years registered
    keith1200rs's Avatar
    Join Date
    Oct 2009
    Location
    Yorkshire, UK
    Posts
    10,877
    Helped
    2074 / 2074
    Points
    49,672
    Level
    54

    Re: calculating step size in ADC

    Quote Originally Posted by zuisti View Post
    In any event, it really looks that the Vref/2^n is the good, but the "full-scale value"
    is not equal to Vref, but it's equal to Vref x 1023 / 1024 (in case of a 10 bits ADC).
    I think that has to be the case otherwise you would never reach the full scale value. i.e. you want full scale to be when the voltage is above 1023/1024 * 5V for a 10 bit ADC on a 5V reference/supply voltage.

    Keith.



    •   Alt23rd February 2011, 14:07

      advertising

        
       

  12. #12
    Advanced Member level 1
    Points: 5,476, Level: 17

    Join Date
    Jul 2004
    Location
    Hungary
    Posts
    474
    Helped
    188 / 188
    Points
    5,476
    Level
    17

    Re: calculating step size in ADC

    Well, yes, this is the mysticism of the numbers 8) :
    (assuming a 10 bits ADC)

    Vstep = Vref / 1024 = Vfullscale / 1023, and not Vref / 1023 !!
    since
    Vfullscale = Vref * 1023 / 1024, and not Vref !!!!
    so
    Vstep = Vref * 1023 / 1024 / 1023 = Vref / 1024

    It's clear (?)

    Thank you for your patience
    zuisti



--[[ ]]--