float operations problems MC9S08LC60

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

float operations problems MC9S08LC60

ソリューションへジャンプ
1,044件の閲覧回数
augustolopez
Contributor I

Hi everybody, i'm quite new with freescale/nxp mcu's and i'm having a problem using flaoting point arithmetic. The problem is that some float operations are writing trash over some other variables that i don't want to modify. The operations are done well and fast with good results but they write trash in some memory adresses that are occuped by other variables. This happens, for example with theese operations:

 

f1=floor(bufferTX); f2=fabs(bufferTX - f1); i1=(int)f1; i2=(int)10*f2; 

or with:

t/=10; t=0.000006*pow(t,3)-0.00081*pow(t,2)+0.3*t-20;

f1,f2, bufferTX and t are floats, i1 and i2 ints.

 

What could be happening? I've added ansis.lib to the project and i'm using CodeWarrior 6.1with DEMO9S08LC60 kit.

 

Any suggestion will be very helpful.

 

Thanks!

ラベル(1)
1 解決策
753件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Normally this issue may because of the stack overflow. please increase the stack size in prm file then test it again.

If the problem persists, please upload your demo project here, I can check it directly from my side. thanks!


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

3 返答(返信)
754件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Normally this issue may because of the stack overflow. please increase the stack size in prm file then test it again.

If the problem persists, please upload your demo project here, I can check it directly from my side. thanks!


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

753件の閲覧回数
augustolopez
Contributor I

Hi Jennie Zhang, thank you very much for the answer!

I've duplicated the Stack size and now everything works fine!

Regards

0 件の賞賛
返信
753件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

You are welcome!

Have a great day,

Jennie Zhang

0 件の賞賛
返信