Shop OBEX P1 Docs P2 Docs Learn Events
Floating Point Operations — Parallax Forums

Floating Point Operations

skatjskatj Posts: 88
edited 2007-12-16 21:10 in BASIC Stamp
I'm working on a model aircraft autopilot and I need to calculate the angle of an output vector using the inverse tangent function. I was wondering if there was any way I could do this with a Basic Stamp 2 Module?

I've been told that I'm screwed but I was wondering what my options were. I've already purchased the Stamp 2 so I don't know what I should do know.

Comments

  • metron9metron9 Posts: 1,100
    edited 2007-12-15 05:07
    Floating point coprocessor

    or

    A lookup table

    Depending on how accurate you need to know the angle you may need external eeprom

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • skatjskatj Posts: 88
    edited 2007-12-15 05:11
    Angle accuracy is not a big deal.

    Could you elaborate please? A google on floating point coprocessor didn't yield much. I've heard of it before but I'm not exactly sure how it works.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-12-15 05:18
    skatj -

    If you're speaking of the ARCTANGENT function it IS available on all PBASIC Stamps starting with the Model 2 (BS-2). The function is ATN and details can be found in the PBASIC Help file, or in the PBASIC Reference Manual.

    Regards,

    Bruce Bates
  • FranklinFranklin Posts: 4,747
    edited 2007-12-15 17:16
    This was the second hit in a google search for floating point coprocessor www.micromegacorp.com/umfpu-v2.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-12-16 21:10
    emesystems.com/BS2math3.htm#ATN_HYP has some information on this, also using CORDIC, emesystems.com/programs/cordic-atn.bpe. The ATN and HYP functions are no longer "undocumented".

    P.S. These are integer functions, not floating point. Is there some reason you need floating point?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.