View Single Post
  #1   Spotlight this post!  
Unread 25-07-2007, 21:10
Pat Fairbank's Avatar
Pat Fairbank Pat Fairbank is offline
Circuit Breaker
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2001
Location: San Jose, CA
Posts: 2,132
Pat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond reputePat Fairbank has a reputation beyond repute
Send a message via MSN to Pat Fairbank
Re: paper: CORDIC Trigonometric Math Library

I felt like doing some programming, so I updated the CORDIC math library I posted a few years ago.

I made a few changes such as returning both the sine and cosine values instead of throwing one away (since CORDIC calculates both at once), and downgrading from 24-bit math to 16-bit math in the interest of speed. However, the biggest change is that the library is now written in PIC assembly instead of C, since I was curious to see if there was any speed advantage to be had.

I did some speed testing by calling the function as many times as possible in one Process_Data_From_Master_uP() loop before the RC crashed. The assembly implementation of the sin_cos() function took 4500 calls to crash while the C implementation took 1800 calls; the atan2_sqrt() function took 4700 and 1900, respectively. So it seems that the assembly implementation is about 2.5 times faster than the C implementation.

Any questions or comments are welcome.
__________________
Patrick Fairbank
Team 254 | Mentor (2012-)
Team 1503 | Mentor (2007-2011)
Team 296 | Alumnus (2001-2004) | Mentor (2005-2006)

patfairbank.com
Reply With Quote