This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data memory distortion

The situation happens when the spaces of "data memory" get to be full, as the output window shows

Program Size: data=230.0 xdata=13 code=30790

Under these situations some "variables" I used originally would be affected accidently.

For example :
//////////////////
unsigned int idata out,i;

for(i=0;i<=256;i++)
{
out=i
}
///////////////////

We could use the "Debug Session" to monitor variable "i" and it could easily find the variable "i" may abnormally increase like

i= 0 -> 1 -> 2 -> 200 --> 201

It seems that variable "i" is written by another data.

Do anybody face with such condition as me?

Thank you for your valuable information.

  • The situation happens when the spaces of "data memory" get to be full

    I'd guess stack overflow

    If you read up on parameter transfer, you will see that if you are one of those that like to transfer 47 variables in a function call, it does not take much to overflow the stack. Look in the M51 file to see where the stack pointer get set at startup, and compare that to your mximum call depth.

    Erik