|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
C programming problem...
hey we're trying to use a simple cosine function call in our code, and we've done the "#include <math.h>" already but we keep getting an error of
"Error - could not find definition of symbol 'cos' in file 'C:\Program Files\MPLAB IDE\default\user_routines.o'. " when we try to compile. obviously, this is using the MPLAB IDE v6.30... has anyone else successfully used the math functions in their code, or any suggestions on how to fix this? thanks in advance, jason |
|
#2
|
|||||
|
|||||
|
Re: C programming problem...
Quote:
![]() |
|
#3
|
|||||
|
|||||
|
Re: C programming problem...
You could try making a table lookup. Basically make a table in Excel then copy it into your code. the problem with this is you only have the values you put in the table.
rom float costable[numvalues] = {1, .985, etc., etc, etc...} Check out this thread: math.h |
|
#4
|
|||
|
|||
|
Re: C programming problem...
we thought that math.h was part of the default C programming library... but any advice on how to implement/call cosine in MPLAB assuming we can't use math.h?
thanks |
|
#5
|
||||
|
||||
|
Re: C programming problem...
Nope ... there is no sine or cosine for the PIC. The best bet is to make a lookup table and just reference it. I would avoid using floating point variables though and stick to integers. Search CD for "lookup table" and you should be able to find what you need to know. This has been discussed several times.
|
|
#6
|
|||
|
|||
|
Re: C programming problem...
And, if you do use floating point, use doubles not floats. I had a lot of troubles with roundoff errors until I switched. 100/25 = 3.99 apparently
Must be Pentium-based... ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multi-bank programming problem | GregC | Programming | 3 | 14-02-2003 16:13 |
| The problem with scouting... | archiver | 2001 | 10 | 23-06-2002 23:49 |
| control system programming | archiver | 2000 | 17 | 23-06-2002 22:14 |
| programming problem | gthakore | Programming | 16 | 20-04-2002 12:21 |
| Major problem with chipphua motors | aka Scott White | Motors | 18 | 19-03-2002 19:44 |