Thread created automatically to discuss a document in CD-Media.

CORDIC Trigonometric Math Library

by: **Pat Fairbank***Provides functions to calculate the sine and cosine of angles, and the magnitude and direction (arctangent) of Cartesian coordinates, using integer math and minimal memory space.*

This is an updated version of Team 296’s CORDIC trigonometric math library.

The CORDIC algorithm simultaneously calculates the sine and cosine of a given angle, or the

arctangent and magnitude of a given pair of co-ordinates, using only a small table of arctangent values and the bit-shift and addition/subtraction operators. This implementation uses 16-bit integer math throughout, and is generally accurate to within 0.01%.

Improvements from the last version include:

- Returning the sine & cosine (or arctangent & magnitude) in a structure so that both can be used
- 16-bit math instead of 24-bit math (because 24 bits is overkill)
- Re-writing of the functions from C to PIC assembly for a 2.5x speed increase

Instructions for use are found in trig.h.

trig_rev2.zip (3.54 KB)