floating point in HC908QY4

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

floating point in HC908QY4

Jump to solution
1,054 Views
damiandesiderio
Contributor I

Hi everythere... I'm using a QY4 to make a voltage/current mesurement, all the code is compiled in codewarrior 6.3 and made in C. The problem is when I multiply and divide to get the result in a floating point variable to show it in a LCD the program stops in the library RTSHC08.C in the sub-rutine _FMUL_Common instruction JSR _UNPACK_k_to_K; and the compiler sends this error:

Error: Attempt to push or pop with SP out of allowed range

 

Any idea??

 

Sorry for my bad english. I read better than I write. jeje

 

Thanks

Damian

 

Labels (1)
Tags (4)
0 Kudos
Reply
1 Solution
844 Views
bigmac
Specialist III

Hello Damian,

With the device you are using, I doubt that you will have sufficient resources for floating point calculations.  With a RAM capacity of 128 bytes, you will likely not be able to make the stack sufficiently large.  The 4K limit for flash memory might also be problematic for the floating point library functions.

These tiny devices were never intended to support floating point.

Depending on your application, it may be feasible to alternatively use integer calculations for your processing.  Otherwise you will need to choose another MCU with considerably more RAM (and flash memory) resources.  This should be from the MC9S08 family, rather than the now obsolete MC908 family.

Regards,

Mac

View solution in original post

0 Kudos
Reply
4 Replies
845 Views
bigmac
Specialist III

Hello Damian,

With the device you are using, I doubt that you will have sufficient resources for floating point calculations.  With a RAM capacity of 128 bytes, you will likely not be able to make the stack sufficiently large.  The 4K limit for flash memory might also be problematic for the floating point library functions.

These tiny devices were never intended to support floating point.

Depending on your application, it may be feasible to alternatively use integer calculations for your processing.  Otherwise you will need to choose another MCU with considerably more RAM (and flash memory) resources.  This should be from the MC9S08 family, rather than the now obsolete MC908 family.

Regards,

Mac

0 Kudos
Reply
844 Views
damiandesiderio
Contributor I

The flash memory and the ram memory is enough, and the calculations are not too large, I think I will try increase the stack size.

Thank you!

0 Kudos
Reply
844 Views
kef
Specialist I

What is exact compiler message? Is this message really generated at compile time?

Did you try increasing stack size setting in PRM file?

844 Views
damiandesiderio
Contributor I

is not a compiler message, it's a simulator message. I will try increase the stack size, I didn't know that I can that.

Thank you!

0 Kudos
Reply