A fun math problem


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125

    Question A fun math problem

    meters = 44330.769 * (1 - (Millibars / 1013.25) ^ 0.190262525939031)

    This converts millibars in pressure to meters given a simple atmosphere. Since the PIC does not have FP, and this point REALLY floats, how can a PIC do this?

    Or can it at all? If we were just dealing with .xxx, then you could x1000, but we are dealing with .xxxxxxxxxxxxx!! Do we just multiply by 100000000000 I don't think so.

    The accuracy to 15 decimal places is needed because of the very small pressure movements inpact on estimated altitude.

    Hmmm...

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    My simple solution, do a spread sheet and store the results in a external EEPROM. Once it`s done just reading the results from the EEPROM.

    YEAH i can heard some here It's just an idea not the only one.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Default

    Except that I need to do this every time I get a new MB reading which can be as fast as 100ms....

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    and then??? reading from a eeprom is really much faster than this.

    Once the spread sheet is created and loaded into the EEPROM, you just need to read the results from. The longer part of the job will be to produce the spread sheet and load it to the EEPROM.

    But if you have some VB programming ability, that will make things easy. In VB you can create your own .BIN file with your own format. Once it's done, you have two(or more) choice:
    • use your favourite EEPROM programer to dump the file to your EEPROM
    • create a VB program to send data to your PIC, then from your PIC to your EEPROM
    Personnaly, i'll prefer the second one if the hardware permit to do it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Default

    OK.. I guess I am not tracking..

    How does one load a VB program into a PIC? I was under the impression the only things that could execute on a PIC were compiled code from PBP or some such compiler. I'd be VERY interested to know how I could load other things into a PIC or EEPROM or whatever.

    I have the spreadsheet (Attached) It is very simple. If it is easier I am sure I can make a .BIN file using VB..

    Very curious...
    Attached Files Attached Files

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i wasn't clear enough sorry. What i figure is to do a VB program wich will do the the whole calculation for you with a specified range and increment of Millibar or Meter value. Once the calculation are done, this program will store all result in a .BIN file. Once the file is created and saved to your hard disk, you use your EEPROM programmer to load this .BIN file into an external EEPROM attach to your PIC.

    After that, your PIC will just need to read the value of the calculation to your EEPROM by using the millibar variable as a kind of 'EEPROM address pointer'

    For sure a PIC can't run a VB program. But you can do a VB program that will communicate to your PIC via the COM port.

    what is the range of your millibar value?
    How many decimal you want to have in the result???

    If you need any info about VB let me know in PM.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Line Graph, math problem...
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th May 2009, 04:20
  2. PicBasic Pro Math Problem??
    By Glen65 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th March 2006, 04:36
  3. Math Problem
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st March 2006, 13:01
  4. Math Formula / Variable Problem! Help!
    By bwarp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th February 2006, 07:59
  5. Math problem...with picbasic pro
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2005, 19:28

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