Location not valid - Watch window
Without seeing any code I'd suspect that the variables might be assigned but their value actually never used so they are optimized away.
Did you try to search in these forums for previous discussions on this error message? I found these two threads that supports my assumption:
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
Without seeing any code I'd suspect that the variables might be assigned but their value actually never used so they are optimized away.
Or the optimization is putting them into registers. Either way, turning optimization off should correct this.
I can't use the watch windows in AVR Studio :(
I get this every time. Whats wrong ?
Very often the optimizer tries to keep variables in registers. If you move the cursor over the variable in the code window variables show their contents and if in register the registers are shown.
Also if that variable isn't global, e.g. a function local variable or a modul static variable, the definition scope of the variable may be violated.
Another way rather than turning off the optimisation for the entire program is to make the variables you are interested in looking at 'volatile'. This works because 'volatile' basically just means "turn off optimisation for any accesses to this particular variable".
Either way, whether you globally turn off optimisation or locally (with volatile) don't forget to switch this back when you've finished debugging though this will mean (and is epsecially true for complete program optimisation) that the behaviour of the program will now be QUITE different and new "bugs" may then crop up to be fixed.
Personally I very rarely use watch windows for this very reason. Instead I generally debug using a mixed C and Asm view (right click, "goto disassembly") and just see which registers the C compiler has put the variables into and watch their contents. You get a far better idea of how the program is working and it's also a VERY quick way to learn the assembler of the target CPU
Thank you all very much !
I know AVR assembler very well :) just started programming in C (AVR MCU) and bumped into that problem.
Watching register with particural variable is very good idea. Thank you.
I was having the same problem. I have the optimization set to 00 and it doesn't make any difference. I set one of the variables as volatile and now all of the varibales show up when in scope.
it's so helpful.
Thanks clawson