Floating-point Math problem, MC9S08PT60

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

Floating-point Math problem, MC9S08PT60

584 Views
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.

Labels (1)
0 Kudos
Reply
3 Replies

389 Views
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 Kudos
Reply

389 Views
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 Kudos
Reply

389 Views
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 Kudos
Reply