Shop OBEX P1 Docs P2 Docs Learn Events
HELP Using the uF-MPU math coprocessor — Parallax Forums

HELP Using the uF-MPU math coprocessor

Brian CarpenterBrian Carpenter Posts: 728
edited 2005-09-27 12:11 in BASIC Stamp
i have an equation that i need to solve with the math coprocessor.· anyone have experience with this?

The math is

Altitude = (10^(log(P/S)/5.2558797)-1)/-6.8755856*10^-6

Altitude is in Feet

P is a variable from an ADC

S is a constant that could just be added to the equation.· it should be 208

Any ideas on how to do this?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


It's Only A Stupid Question If You Have Not Googled It First!!

Comments

  • metron9metron9 Posts: 1,100
    edited 2005-09-27 10:25
    Remember, a microprocessor uses addition and subtraction to do math functions. write your equasion out long hand, convert the multiplication to a for next addition loop, the division to a subtraction loop, the log function to a lookup table. That's how under the hood the basic stamp processor works as well as the coprocessor, the coprocessor is optimized hardware that will do what software in a stabdard microprocessor does.

    If you don't have a time critical application, that could work.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-27 12:11
    If you're using the um-FPU then I strongly suggest you download and use the IDE -- it makes life so much easier (after you spend a few minutes learning how to use it).· What I like about the um-FPU IDE is that it lets one download the equations into the device so that you don't need a lot of Stamp code to deal with the conversion.

    I wrote about the um-FPU in my column: http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv123.pdf

    I've attached a screen shot of the latest IDE with your equation installed.· It compiles ... you'll have to determine if it works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    709 x 531 - 65K
Sign In or Register to comment.