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.
Hi
I have an error that shows its ugly head now and then.... The µC I'm using is C8051F122.
When I debug I can locate the problem, but the bug does not show the same place in code all times.
What I see now is that when stepping over the following line:
SMB0CN = 0x44;
The register SMB0CN actually is set to 0xC4. This sets the BUSY bit in the register.
It can be resolved by removing the µC supply, but a RESET won't do. But after some time the problem shows again.....
Does anyone have an idea????
Best Regards....
"What you are saying is that you can not trust the data in the watch window"
No, that's not it at all.
The watch window will accurately display what's actually in the physical RAM.
The problem is that the Compiler optimisation may mean that the physical RAM may not actually be updated at the precise point of the specific source line.
You will have to look at the generated assembler to see precisely what's actually happening.
"I know that the compiler can keep it anywhere in memory"
That's not the point - see above.
"I surely would expect the watch window to reflect the value of the variable at all times"
No - you need to spend some time understanding how optimising compilers work!