Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/10/12 16:52
Read: times


 
#188977 - the variable will get corrupted
Responding to: ???'s previous message
This is the classic case when you should make use of atomic operations. If you change the variable in main loop and interrupt writes the same variable, you can have undefined values in the variable. To avoid this, you should,
ensure that the variable is the lowest width for single cycle(atomic) operation by the controller
or
disable interrupts while changing the variable in main loop, thus making the operation atomic.

Regards

List of 6 messages in thread
TopicAuthorDate
32bit variables in interrupt            01/01/70 00:00      
   the variable will get corrupted            01/01/70 00:00      
      Thanks            01/01/70 00:00      
         Not 8051-specifc            01/01/70 00:00      
   Exactly the same question just appeared on Keil!            01/01/70 00:00      
      Probably!             01/01/70 00:00      

Back to Subject List