Shop OBEX P1 Docs P2 Docs Learn Events
bs2 math — Parallax Forums

bs2 math

mizemize Posts: 15
edited 2004-11-01 18:48 in BASIC Stamp
i am trying to compute vapor pressure with a bs2 and a sensiron shtx
the formula is·· e= 6.11*10.0**(7.5*t/(237.7+t))· where· e is vapor pressure and t is temperature in degrees celsius at a resolution of tenths of a degree.· Can this formulat be computed on the bs2?

Comments

  • AlWilliamsAWCAlWilliamsAWC Posts: 135
    edited 2004-11-01 18:48
    There are tricks you can do to work with fractional numbers on the Stamp. For example, 7.5*t could be represented as (75*t)/10 (of course, you lose precision when you divide by 10). The exponent is probably your biggest problem (although Tracy may have some trick up his sleeve).

    However, this would be very easy to do with a PAK floating point coprocessor. The PAK12 uses ASCII RPN so it is dead simple to use. You can even define macros that would store you whole computation. See http://www.awce.com/pak12.htm.

    The PAK-II (or the PAK-IX if you want A/D inputs also) will work. It uses a more efficient way of handling numbers, but that also makes it a little less inutitive to use. If you are worried about getting the most speed of a variety of computations, the PAK-II (or IX) is a good choice. However, the PAK-XII actually runs a bit faster, and if you use macros to cut down on the number of bytes sent between the Stamp and the PAK it can also achieve good speeds. See http://www.awce.com/pak1.htm for more on the PAK-II and IX (the PAK-I doesn't do everything you need, so it is out of consideration, but it shares a page with the PAK-II).

    You can see examples of these at http://www.awce.com/doclib.htm

    Regards,

    Al Williams
    AWC
    ·
Sign In or Register to comment.