We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a function in which I declare two variables as follows: unsigned char voltage = 0; unsigned char test = 0; When I run the code in the debugger, these variables are initialized to random numbers. What is the problem?
"Okay - my next guess would be to suggest that they are possibly being over written by something else." I that's the case, you should be able to see it happening in the debugger: use the disassembler view, and you'll be able to see where your local variables are initialised. Step through the code at the assembler level, and see where it goes wrong. This should give you some more clues. Other possible causes could be: Errant pointers; Overlay problems (especially if you're using function pointers, or calling functions recursively); Stack problems.