Shop OBEX P1 Docs P2 Docs Learn Events
Using trigonometric funtions with SX Chips. ( Help) — Parallax Forums

Using trigonometric funtions with SX Chips. ( Help)

JoeJoe Posts: 184
edited 2008-04-17 18:42 in General Discussion
Hi,

Only to know if I can use trigonometric funtions
and logarithm funtions with SX chips.



Thanks, Joe

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-15 22:36
    Usually trigonometric and logarithmic functions make use of floating point arithmetic which the SX does not support. It is possible to code trig and log functions using fixed point integer arithmetic with limited accuracy using various algorithms like CORDIC. It's probably more practical to use tables of values and use table lookup. If you need floating point and transcendental functions, you should consider using the Propeller which does have a floating point library that includes the usual trigonometric and logarithmic functions.
  • JoeJoe Posts: 184
    edited 2008-04-15 22:45
    Thanks,

    The problem I have is that Basic compiler
    is very similar to use a Basic Stamp (easy) and
    the alternative of using a Propeller could
    be usefull but I need to understand Spin or assembler.

    for this reason I would like to use SX.

    Do you know if adding the math coprocesor to the SX is a
    good alternative ? ( better than a propeller)

    thanks, Joe
  • BeanBean Posts: 8,129
    edited 2008-04-15 23:38
    What functions do you need ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-15 23:43
    A math coprocessor is one good solution. Depending on your needs, the other suggestions I made (table lookup, CORDIC) could also work.
  • JoeJoe Posts: 184
    edited 2008-04-16 04:25
    I am asking because

    I found a microcontroller called BasicX-24
    and I would like to use Parallax products instead of
    BasicX-24.

    The BasicX-24 has a lot of math.
    and am trying to have the same
    ( or similar) math with Parallax products.
    ( But I dont want to use the propeller because
    I want to continue with Basic instead of Spin.

    If you know how, here is the link:
    http://www.basicx.com/Products/BX-24/bx24instset.htm


    Thanks, Joe
    PS: I don't want to move from Parallax becuase you
    have a very good support, thanks.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-16 04:48
    The only way to get the kind of floating point support you want is to use an external floating point coprocessor like the uM-FPU that Parallax sells. The uM-FPU, even though it is not hard to use, is not the same as using the built-in floating point in BasicX's version of Basic. The only Parallax product that has anything like the built-in floating point of the BasicX processor is the Propeller. You will have to decide what is more important for you ... the integrated Basic floating point of the BasicX device or the level of support you get with Parallax products.
  • JoeJoe Posts: 184
    edited 2008-04-17 01:30
    Thanks:

    I read the Propeller manual and It is difficult
    to understand.

    I thought that Spin was like PBasic but isn't.

    Why Parallax doesn't add Pbasic to the Propeller?
    ( Or something similar to the PBasic)

    I have waist several days learning Pbasic and
    I will not waist several days again learning Spin.


    I will need to buy the BX-24 this time because Basic Stamps
    don't have enough math., SX does not has enough math too
    and Propeller is too difficult to understand.

    Any way thanks for the support .
    Joe
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-17 03:14
    Different microcontrollers do well at different things. It depends on what your needs are. The BasicX-24 contains a fast Basic interpreter with floating point arithmetic. Many of its I/O pins can be used as ADCs. It has lots of memory for program and data. If that's what you need for your project, that's fine. Parallax's microcontrollers have other selling points. Ease of use is one of them. Support and the sheer mass of educational materials is another. The SX processor has a nice, fast, predictable interrupt mechanism that allows easy creation of various virtual devices and it can do Sigma-Delta ADC on one or several I/O pins. The Propeller is a fast multiprocessor with a built-in interpreter for Spin, a proprietary language with some similarities to C. There's a large library of I/O drivers for various sensors, direct support of SD cards for PC compatible mass storage, displays, keyboards, servo and stepper motors, etc. There's even a simple Basic interpreter written in Spin that can be used as the basis for special functions.
  • John CoutureJohn Couture Posts: 370
    edited 2008-04-17 18:42
    Joe,

    Take a look Bean's comments on the Compass module which requires the use of some trig functions

    http://forums.parallax.com/forums/default.aspx?f=7&m=159976&g=161596#m161596

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
Sign In or Register to comment.