??? 03/17/05 13:50 Read: times |
#89867 - re explosive bytes Responding to: ???'s previous message |
sorry, could not help that after the previous post being "Atomic" (never heard the expression before, if interested, the definition is at http://www.webopedia.com/TERM/A/at...ation.html ). I have always been aware of the issue, just never knew the word.
Ian, it is nice that there is a word for it, will use in future. If the interrupt happens to occur during the mov a,mydatabyte instruction then it may put a new value in mydata byte my rule re ISR/main sharing of variables is if both can write to a byte or the variable is longer than a byte, it may only be accessed in main code with interrupts disabled. The problem here is that when coding in C, the variable may be hidden if that rule is observed. qwerty &= 0xf0; may seem "atomic" but is not, in assembly mov a,qwerty, and a,#0f0h, mov qwerty,a is easy to recognize as non-atomic. Erik |