Go to Post Such reasonableness will not be tolerated! This is teh interwebz! - pfreivald [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-02-2004, 15:43
wasabi824 wasabi824 is offline
Jason. Another FIRST dude
#0824 (SWAT Robotics)
Team Role: College Student
 
Join Date: Jan 2004
Location: Seattle, WA
Posts: 19
wasabi824 is on a distinguished road
Send a message via AIM to wasabi824
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
__________________
"I am a boring person" - myself

"I am on Team 824" - myself

nope, i don't got any famous people quotes or love haikus or stuff like that.
  #2   Spotlight this post!  
Unread 07-02-2004, 15:45
phrontist's Avatar
phrontist phrontist is offline
Proto-Engineer
AKA: Bjorn Westergard
FRC #1418 (Vae Victus)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Falls Church, VA
Posts: 828
phrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond repute
Send a message via AIM to phrontist
Re: C programming problem...

Quote:
Originally Posted by wasabi824
and we've done the "#include <math.h>"
Where did you get this math.h library? Unless it was specifically written to adhere to the C18 standard, it won't work.
  #3   Spotlight this post!  
Unread 07-02-2004, 15:52
ShadowKnight's Avatar
ShadowKnight ShadowKnight is offline
Registered User
FRC #1719 (Umbrella Corporation)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Alexandria, VA
Posts: 142
ShadowKnight has a spectacular aura aboutShadowKnight has a spectacular aura about
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
__________________
Gracious Professionalism isn't simply courtesy or tradition, it's a way of life

I met her through FIRST...

We only are where we are by God's providence and by no other...
  #4   Spotlight this post!  
Unread 07-02-2004, 15:52
wasabi824 wasabi824 is offline
Jason. Another FIRST dude
#0824 (SWAT Robotics)
Team Role: College Student
 
Join Date: Jan 2004
Location: Seattle, WA
Posts: 19
wasabi824 is on a distinguished road
Send a message via AIM to wasabi824
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
__________________
"I am a boring person" - myself

"I am on Team 824" - myself

nope, i don't got any famous people quotes or love haikus or stuff like that.
  #5   Spotlight this post!  
Unread 07-02-2004, 23:43
KevinB's Avatar
KevinB KevinB is offline
Registered User
AKA: Alum
no team
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2001
Location: AL
Posts: 188
KevinB will become famous soon enoughKevinB will become famous soon enough
Send a message via ICQ to KevinB
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   Spotlight this post!  
Unread 08-02-2004, 01:04
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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