Float compute error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Float compute error

902 Views
alonjun
Contributor I

PC: Windows XP

IDE: CodeWarrior for S12x V5.1

Chip: S12XEP100

Code:

156548_156548.jpgSnap5.jpg

When run this code, VTST_BattOverCurrTh1_A not equal VTST_BattOverCurrTh2_A and get a wrong value

156549_156549.jpgSnap6.jpg

So I view assembly code,

156550_156550.jpgSnap7.jpg

When execute SEX  A,X  JSR  _FUFLOAT, get a wrong value, it seems SEX  A,X  wrong, compiler's bug?

Original Attachment has been moved to: Project.zip

Labels (1)
0 Kudos
5 Replies

673 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

thanks for posting your questions.

can you please upload your entire demo project folder in zip format here. thus i can debug and check your problem directly. thanks!


Have a great day,
Jennie Zhang

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

0 Kudos

673 Views
alonjun
Contributor I

Have uploaded the project, thank you!

0 Kudos

673 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

I reproduced your problem. Will escalated it to development team.

for the moment please define HVSamples3_o2 as unsigned short as a workaround:

unsigned short HVSamples3_o2[8] = {0x0,0x0,0x10,0x0,0x10,0x0,0x0,0x0};

thus

both VTST_BattOverCurrTh1_A and VTST_BattOverCurrTh2_A will be 40.95996.

Have a great day,
Jennie Zhang

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

0 Kudos

673 Views
alonjun
Contributor I

Thanks, it is not the best way to fix this problem, my code generated by Simulink, I can not control all the code. If it is the compiler's bug, hope can fix it fast. It is also exists in CodeWarrior for S12x V5.2, thank you!

0 Kudos

673 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Alon.

this problem has been reported to development team. I will let you know if I get any update.


Have a great day,
Jennie Zhang

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

0 Kudos