Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Trig functions in C18 3.10 (http://www.chiefdelphi.com/forums/showthread.php?t=61098)

dmlawrence 08-01-2008 19:39

Trig functions in C18 3.10
 
Hi,

I am aware that numerous trig lookup tables and algorithms are available for the RC. However, as far as I can tell, none of them are compatible with Kevin Watson's new code.

Does anyone know of a method to calculate trig functions that works under the new version of C18?

Thanks,

David
Team 1751

Kevin Watson 08-01-2008 20:59

Re: Trig functions in C18 3.10
 
Quote:

Originally Posted by dmlawrence (Post 672699)
I am aware that numerous trig lookup tables and algorithms are available for the RC. However, as far as I can tell, none of them are compatible with Kevin Watson's new code.

Can you point me toward code that doesn't work? I'll have a look to see what it would take to get it working.

Quote:

Originally Posted by dmlawrence (Post 672699)
Does anyone know of a method to calculate trig functions that works under the new version of C18?

Unless you need to do hundreds of trig calculations per second, I would just go ahead and use the built-in functions. If you're the adventurous type and just want to do it yourself, you could very easily get my eeprom code code moved over and then use the trig table generation and lookup code I wrote a few years back.

-Kevin

dmlawrence 08-01-2008 21:09

Re: Trig functions in C18 3.10
 
The code in this whitepaper doesn't seem to compile correctly.

-David

Kevin Watson 08-01-2008 22:22

Re: Trig functions in C18 3.10
 
1 Attachment(s)
Quote:

Originally Posted by dmlawrence (Post 672802)
The code in this whitepaper doesn't seem to compile correctly.

-David

It compiles for me using the attached file that calls sin().

-Kevin

dmlawrence 09-01-2008 10:54

Re: Trig functions in C18 3.10
 
Sorry, I linked to an old version of the math library.

The updated library is here.

Thanks,
David

dmlawrence 09-01-2008 21:54

Re: Trig functions in C18 3.10
 
Just to clarify, the new version does NOT compile under C18 3.10. (My previous post was a bit unclear).

psh 11-01-2008 19:06

Re: Trig functions in C18 3.10
 
From experience we stay away from PIC floating point in our team. Its emulated, bloated and problematic to debug. It was even worse in the 2004 and 2005 years when the processors only had 32KB.

How widespread is the use of floating point by the teams out there?

>Per

Guy Davidson 11-01-2008 20:38

Re: Trig functions in C18 3.10
 
Quote:

Originally Posted by psh (Post 675538)
How widespread is the use of floating point by the teams out there?

We avoid it if at all possible, and never once have we found it impossible to avoid. In short, we haven't used it. We just make sure that we multiply two integers before diving them (ex in a PID calculation with Kp being 33 / 100 we do 33 * delta / 100 rather than 33 / 100 * delta).

kaszeta 11-01-2008 21:33

Re: Trig functions in C18 3.10
 
Quote:

Originally Posted by psh (Post 675538)
How widespread is the use of floating point by the teams out there?

In recent years, Team 95 has been around 50/50. Two years ago we prototyped an omnidrive that worked in field coordinates, and we did sin(), cos(), asin(), and acos() every loop, with no problems.

And last year, our infrared ranging system used lots of floating point as well, with no real problems, although I did help the students develop a fixed-point equivalent (we never subbed it in, however).

comphappy 08-02-2008 09:33

Re: Trig functions in C18 3.10
 
did this ever get resolved? Could someone point me in the direction of one that does work with the new code?


All times are GMT -5. The time now is 23:13.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi