View Single Post
  #3   Spotlight this post!  
Unread 25-10-2004, 20:27
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: Trigometric Functions

Quote:
Originally Posted by cibressus53
are there any libraries for mlab and control unit for trigometric functions?
Nope. Write your own. Since calculating a Taylor/McLauren series or whatever on the fly with the PIC isn't exactly practical there are several approaches

1.) Precomputed lookup tables. Fast to read from but eat alot of program space. If you are cramped for program space you can reduce the number of points in the table and use linear interpolation.

2.) CORDIC algorith. I'm lazy. Google it

3.)Parabolic approximation. a halfsin function can be approximated reasonably well using a parabola. All other trig functions can be derived from halfsine. This goes for lookup tables too. You only need to store half of a sin cycle

4.) calculatea series on the fly. We actually tested this and it worked reasonable well if you precomputer the factorials. I wouldn't recommend it though. It is rather slow compared to the other approaches. We did it more to show that it could be done.

There are a few old threads on forums that discuss this topic. Again I'm lazy. Search for them yourself
__________________
1139 Alumni