Using sqrt() function in Codewarrior 6.2

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using sqrt() function in Codewarrior 6.2

ソリューションへジャンプ
3,178件の閲覧回数
jreyes085
Contributor I

Hello,

 

Im trying to use this function but it doesnt works...i put this in the header of the file that i want to use the function:

 

#include "math.h"       /* include math functions */

 

What i want to do is this....

 

irms=sqrt(sum2corriente/NUM_MCICLO);

 

//they are defined like (copy&paste from my main.c):

//#define NUM_MCICLO  100

//

//#pragma DATA_SEG DEFAULT

//static  dword sum2corriente=0;

//static  dword irms=0;

 

How could i do this? i know that sqrt(double variable), is this going to work? i want it to tried but i compile the file and it gives no errro, but when i pressed the debug button then it shows this error:

 

Error #1> Link error: Undefined: "sqrt"
              Referenced from "TPM1_ISR" in main.c
Error #2> Link Failed.

 

Im using the irms calc in a Interruption subroutine....

 

Please help! how can i get this to work?

 

Thanks!

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,183件の閲覧回数
stanish
NXP Employee
NXP Employee

Seems the floating point library (e.g. ansif.lib) is not included in your project. I'd suggest you to see this thread

 

Attached is the list of libraries available in CodeWarrior for MCUs v6.2.

 

Stanish

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,184件の閲覧回数
stanish
NXP Employee
NXP Employee

Seems the floating point library (e.g. ansif.lib) is not included in your project. I'd suggest you to see this thread

 

Attached is the list of libraries available in CodeWarrior for MCUs v6.2.

 

Stanish

0 件の賞賛
返信
1,183件の閲覧回数
jreyes085
Contributor I

Thanks man! Gracias!

 

it works, i only create a new project and activate the floating point support...and it works!

 

Thanks, i was thinking of implement an asm algorithm to do the sqrt() function...

 

Thanks again!

0 件の賞賛
返信