HI all. I am developing a programm with the demo version of the keill compiler.The µ-Controller is a cygnal 8051(c8051f124). I have faced a very strange behavior: int Pack_Counter=0; ... if(Pack_Counter>0){ ...//I set a breakpoint here } when i run the program it sometimes(strange again)stops at the breakpoint.When i watch the value of the variable it is 0 as it should->The Comparison is false->The program should not interrupt. BTW:I have some ISRs but there is none that changes the value of the variable. Does anyone have an idea?
In several cases I have seen similar occurrences when using data type variables. Using a Hitex emulator I ahave stepped through assignment of a value to a variable ( register was used by the compiler for the data variable in this case) and the assignment did not work. The variable did not get the value and the register used did not change to the assigned value. Using indirect addressing worked correctly in thes cases so where the problem showed up I am now using idata or xdata variables. It takes more memory and execution time, but at least works correctly