cancel
Showing results for 
Search instead for 
Did you mean: 

Can ST7 do sine and square root caculation?

hg-chen
Associate II
Posted on November 02, 2006 at 09:13

Can ST7 do sine and square root caculation?

6 REPLIES 6
hg-chen
Associate II
Posted on October 13, 2006 at 06:56

Can ST7 do sine and square root caculation?

if yes, are the sample code subroutine available?

wolfgang2399
Associate II
Posted on October 13, 2006 at 07:29

Hi,

your C-compiler will offer you these math functions sin() and sqrt() and others.

Normally it's essential to include the math-lib (#include ).

For further information see the C-compiler manual.

Regards WoRo

hg-chen
Associate II
Posted on October 16, 2006 at 13:52

beside adding

#include

to the program.

What else do I need to take care in order to make it work?

ex. any compiler or linker option

pete3
Associate II
Posted on October 16, 2006 at 14:43

Set up the LIB search path for the compiler if you haven't already done so.

Project > Project Settings > General in STVD7.

wolfgang2399
Associate II
Posted on October 17, 2006 at 07:43

Sorry, but this message-handler mismanages angle-brackets, so the text has been garbled.

Hope they'll now present the text in the right view (?):

#include <math.h>

If not please add ''math.h'' enframed by angle brackets.

math.h defines more than twenty mathematic functions. You'll find them in ANSI-C descriptions as well as in C-compiler manuals.

Regards

WoRo

emmanuel23
Associate II
Posted on November 02, 2006 at 09:13

The easiest way in STVD7 to manage the libraries is to select ''float'' in the linker project settings

=> Menu Project / settings => select linker tab => select ''input'' category and check the float checkbox.

This will manage properly the libraries (depending also on memory model and it will link proper libraries in the proper order).

The other point you must keep in mind is that the ST7 does not integrate floating point instructions. Thus the compiler provides libraries to manage such needs, but it may be quite slow.

The alternative, if you know the range of value you'll have to manage is to pre compute a series of results and use a table to pick in it.

Emmanuel.