Data Storage Tool Display Human Input Protocol Math Motor Control Sensor Signal Generation & Processing Speech & Sound Fun View all Objects


Quick Links
Contact Us
Forums
Support

Register
Login

This object is provided under license. By downloading this object, you are agreeing to the terms of the MIT License.

Fixed-point math with trig functions in SPIN

The PST application shows the first Fixed-point arithmetic library object on OBEX. The "SPIN_TrigPack" object is a complete Fixed-point package with the basic trigonometric functions for robot and navigation projects. You can do ATAN2 without enlisting extra COGs to run a full Floating-point library for that function. This small object has string conversion utilities to make Fixed-point math easy in your SPIN language based applications.

The object contains the first True Random Generator with the Propeller microcontroller written in SPIN code only. This TRNG will repeat its sequence only after the end of Times. Nobody knows why does it work. Maybe, you will be the first to find out.

Version:
  2.0

Type:
  Object

Attributes:


Author:
  I.Kövesdi
  istvan.kovesdi@me.com

Categories:
  Math

Downloads:
  951

Last Updated:
  2011-10-18



User Reviews:

  • ramboman commented:
    I am building an hexapod driven by propeller. I wrote Inverse Kinematics for one leg using this package; it takes 68486 µsec. Using Floating Point, it takes 3043 µsec. I did expect Fixed Point math to be faster that Floating Point...
    October 26, 2009 3:09 a.m.




  • Comments on this Object:


    [2011-09-23 16:28:57] Anonymous said:
    Found a bug in the sin calc. At exactly 90 and 270 degrees. I changed the fundamental sin calc as follows: CASE (iA & %1_1000_0000_0000) %0_0000_0000_0000: '1st quadrant [0, 90] RETURN WORD[_BASE_SINTABLE][iA & $7FF] %0_1000_0000_0000: '2nd quadrant [90, 180] if (iA & $7FF) RETURN WORD[_BASE_SINTABLE][-iA & $7FF] else RETURN WORD[_BASE_SINTABLE][$7FF] %1_0000_0000_0000: '3rd quadrant [180, 270] RETURN -WORD[_BASE_SINTABLE][iA & $7FF] %1_1000_0000_0000: '4th quadrant [270, 380] if (iA & $7FF) RETURN -WORD[_BASE_SINTABLE][-iA & $7FF] else RETURN -WORD[_BASE_SINTABLE][$7FF] Reply

    Post a comment:




    Please contact obex.support@parallax.com with comments or questions.

    Copyright 2011 by Parallax, Inc.