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

Program malfunctions when adding a new variable

Hi All,
First of all, thanks for reading this and going through my problem.
As I am not a pro (not even the half way), its a little difficult to solve all problems myself.
- I tried to dig as much as I can withing my limit of knowledge.
- I also tried searching for this issue with a few different keywords on Google and this forum.

Just a brief about my work and code.
I am making a Graphical LCD base oscilloscope with LPC2148 board lying with me.
Things were moving nicely and I finish through 75% of my work with waveform and some measurements.

Then, around 4-5 days back, to add one more measurement, I created 2 unsigned short in type variable (and later on other types as well). This translated in change of other functionality which were not related to it at all.

To check, where the problem is,
-I moved back to my last working code and checked it. That worked fine.
-I just added one variable and then checked, it worked. (as that variable was not used, I think intelligent compiler didn't translate it to hex code.)
-I added just one statement so that variable translate in to code. Statement was "x = x+1;"

This made my scope go made.

I tried many ways to check this but didn't get anything,

To give a little more details
-I am using around 300 short int and around 30-40 other variables. It would need around 1k of RAM. Remaining 7k is still free.
-I am using keil demo version. And my code size is ~8k.
-I am using USB bootloader.
-If I declare variable outside function (global) it is not giving any issue.

Last thing, I feel that this may be issue with stack. As all variables are in main(), it would be going out of room but not sure about anything. Going ahead without proper knowledge would not be a good idea (though issues is solved half the way).

-any pointers to other literature would be welcomed.

Thanks for reading through this point.
Thanks for help.

Parents Reply Children
No data