Math operations execution time


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    One question I have is, How do you have the pressure sensor mounted? If it mounted in such way that the thrust is being impressed on the sensing element then the pressure readings will be offset. I would mount the sensor so that the sensing element is perpindicular to the rockets thrust. It should give you a much more stable and reliable reading. I would also take about 64 readings and do a right shift 4 places to the give you a 12 bit reading. I do this as a mater of fact for all of my A/D readings from the PIC internal A/D. I only use a 40uS. delay when changing channels. You should easily be able to captute the data at 100 Hz.
    Dave Purola,
    N8NTA
    EN82fn

  2. #2
    Join Date
    Jan 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Quote Originally Posted by Dave View Post
    One question I have is, How do you have the pressure sensor mounted? If it mounted in such way that the thrust is being impressed on the sensing element then the pressure readings will be offset. I would mount the sensor so that the sensing element is perpindicular to the rockets thrust. It should give you a much more stable and reliable reading. I would also take about 64 readings and do a right shift 4 places to the give you a 12 bit reading. I do this as a mater of fact for all of my A/D readings from the PIC internal A/D. I only use a 40uS. delay when changing channels. You should easily be able to captute the data at 100 Hz.
    Yes Dave, you´re right! I still have to think about how the circuit will be disposed inside the rocket, calculate the pressure vents in the fuselage and etc...
    Anyway, as I said, I am very noob to this so, is there any material where I can read about this 12bit reading with a 10bit AD?

  3. #3
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Quote Originally Posted by Dave View Post
    I would also take about 64 readings and do a right shift 4 places to the give you a 12 bit reading. I do this as a mater of fact for all of my A/D readings from the PIC internal A/D. I only use a 40uS. delay when changing channels. You should easily be able to captute the data at 100 Hz.
    Can you explain this in more detail? Sounds like an interesting trick to me. Thanks!
    Shawn

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Just accumulate 64, 10 bit readings in a row into the same word variable, then do a shift to the right by 4 places which will give you a 12 bit result. Here is an example:
    '************************************************* ********************
    READAD: 'READ SYSTEM A/D VOLTAGES (AVERAGE 64 READINGS) 18F2620
    '************************************************* ********************
    TMPCHAN = CHANNEL 'COPY CHANNEL DATA
    IF CHANNEL = 3 THEN TMPCHAN = 4 'SKIP CHANNEL 3 AS IT IS USED AS REFERENCE
    ADCON0 = $01 | (TMPCHAN << 2) ' Set A/D to Channel X, On
    PAUSEUS 40
    VOLTS(CHANNEL) = 0 'CLEAR A/D READINGS
    SCRATCH = 0
    WHILE SCRATCH < 64 'SUM 64 READINGS
    ADCON0.1 = 1 ' START CONVERSION
    WHILE ADCON0.1 = 1 'WAIT FOR A/D TO FINISH
    WEND
    VOLTS(CHANNEL) = VOLTS(CHANNEL) + (((ADRESH & $3) << 8) + ADRESL) 'BUILD SENSOR WORD
    SCRATCH = SCRATCH + 1
    WEND
    VOLTS(CHANNEL) = VOLTS(CHANNEL) >> 4 'TURN INTO 12 BIT RESULT

    RETURN
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Hi;

    Following what Dave has said, take a look at this link, by Darrel Taylor;
    http://www.darreltaylor.com/DT_Analog/

    By the way rasciodc, i'm Portuguese too, i'm from Maia.
    Thanks and Regards;
    Gadelhas

  6. #6
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Thank you Dave, and Gadelhas! I am excited to try this!
    Shawn

  7. #7
    Join Date
    Jan 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Quote Originally Posted by gadelhas View Post
    Hi;

    Following what Dave has said, take a look at this link, by Darrel Taylor;
    http://www.darreltaylor.com/DT_Analog/

    By the way rasciodc, i'm Portuguese too, i'm from Maia.
    Thanks, gadelhas, for the link! very useful!! mainly for beginners like me!
    And, actually I´m Brazilian! living in São Paulo at the time....

    Just accumulate 64, 10 bit readings in a row into the same word variable, then do a shift to the right by 4 places which will give you a 12 bit result.
    Dave, thanks for the explanation! How much time would this algorithm take to do this, any idea? (just wondering if I can use it in my altimeter...)
    Thanks!

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Isn't the 12-14-16 bit reading just a guess about being between the 2- 10 bit readings which could be off the expanded factor bits ??
    If the a/d values do not bounce in the 64 samples, the actual voltage could be up or down on that step but the guess would be middle.
    Don
    amgen

  9. #9
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Math operations execution time

    Quote Originally Posted by amgen View Post
    If the a/d values do not bounce in the 64 samples, the actual voltage could be up or down on that step but the guess would be middle.
    Yes, but in practice the numbers jump around enough so oversampling can extract more data from the result. The main drawback is speed, but it is very effective.

    Here's some sources of info:
    http://www.atmel.com/dyn/resources/p...ts/doc8003.pdf
    http://ww1.microchip.com/downloads/e...otes/Achieving Higher ADC Resolution Using Oversampling 01152A.pdf
    Attached Images Attached Images
    Last edited by ScaleRobotics; - 28th January 2012 at 20:35.
    http://www.scalerobotics.com

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