Shop OBEX P1 Docs P2 Docs Learn Events
Trig Functions — Parallax Forums

Trig Functions

NewzedNewzed Posts: 2,503
edited 2007-08-28 18:46 in Propeller 1
Here is a utility program for the Propeller that produces trigonometric functions for all angles from 0 to 90 degrees.· The program is menu-driven and very easy to run.· When an angle is entered, the screen displays sine, cosine and tangent.· The attached .zip file contains the program and all objects used by the program.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.

That is why they call it the present.

Don't have VGA?
Newzed@aol.com

Comments

  • mcstarmcstar Posts: 144
    edited 2007-08-28 18:46
    That's really cool, but it looks like you've hardcoded the values using one big lookup table. According to the Propeller manual, the sin and cos can be calculated via the internal rom Lookup between addresses ($E000 and $F001)
    From page 423...

    Sine Table ($E000-$F001)
    The sine table provides 2,049 unsigned 16-bit sine samples spanning from 0° to 90°,
    inclusively (0.0439° resolution).
    A small amount of assembly code can mirror and flip the sine table samples to create a fullcycle
    sine/cosine lookup routine which has 13-bit angle resolution and 17-bit sample

    I haven't tried to do this yet, but you should be able to lookup the values from spin too.
Sign In or Register to comment.