Floating-point Math problem, MC9S08PT60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Floating-point Math problem, MC9S08PT60

607 次查看
AndreiLuchuk
Contributor I

Having an issue I can't resolve, the following lines of code cause a reset

 

   FLOAT32 fPct100 = 100.00;   FLOAT32 fPct18  = 18.00;   FLOAT32 fPvPercent;    FLOAT32 fBarGraphPercent;   UINT32  nBarGraphSegment   = 0;   fPvPercent = gfPVPercent * fPct100;   fBarGraphPercent = (UINT32)(fPvPercent / NUM_BG_SEGENTS);      //fPvPercent = 20.0000;      fPvPercent = (fPvPercent / fPct100);      //problem here      fPvPercent = fPvPercent / fPct18;         //problem here

 it is possible to step through this statement and hit brakepoints at the end of main loop. however, running is not working. i can't catch the reset with Cpu_OnReset either. 

 

Using CWIDE 10.2 with the latest updates.

 

any suggestions are greatly appreciated.

标签 (1)
0 项奖励
回复
3 回复数

412 次查看
CompilerGuru
NXP Employee
NXP Employee

Make sure you are not running out of stack. Increase the STACKSIZE in the prm file

(not sure where to set the stack size with Processor Expert).

 

Daniel

 

0 项奖励
回复

412 次查看
AndreiLuchuk
Contributor I

Thanks for looking in, Daniel.

 

I've increased the stack from 0x0080 to 0x0500, but no solution. How much stack does this need?

0 项奖励
回复

412 次查看
CompilerGuru
NXP Employee
NXP Employee

Not that much :smileyhappy:.

Thought 0x80 feels a bit low when using floating point arithemtic.

 

To see how much stack it needs, search for STACKSIZE in the forums. Also one way:

https://community.freescale.com/message/115600#115600

 

Another cause might be the COP/watch dog timer, try disabling it temporarly to see.

 

Otherwise, I would recommend to create a small example app showing your issue.

 

Daniel

0 项奖励
回复