I’m trying to see if I can design a function to help calculate a trajectory for our robot. Does EasyC have the math libraries that I would need to do this such as sin, cos, and tan? The other programmers didn’t want to learn C this year (even though they had the opportunity) and seem to want to use EasyC but I would personally rather program it in regular C (MPLAB) especially if I will need to use it for what I want to do. Thanks
You can get all the standard math libraries which are described in the Microchip C18 Users Guide. To do this and not get compiler errors you must include <math.h> which can be done from the “File inclusion” dialog on the Options menu. Make sure to include the <> as part of the file name.
Where should we place the math.h file?
in the file where you use the mathematical functions. #includes are only useful for the file you put them in
The math header file is already included in the compiler. All you need to do is go to the File Inclusion Window in the options menu, and type in:
Then you will have access to the functions provided by that header file, such as sin, cos, tan, etc.
after I include the file I wiil be able to see it like that : #include <sdsdsd>
Or it will automaticlly put it in the main.h ?
Give it a try, just don’t forget that math.h uses radians to measure angles.
The actual include declaration gets inserted into the Main.h file as you said and the Main.h file is included in all the other files you create.
The only way to see it is to look at the “Project” tab on the left hand window. Then you can select Main.h and see the includes.