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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Jerson Fernandes
12/10/12 09:52
Read: 939 times

#188977 - the variable will get corrupted
Responding to: Mehdi'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
disable interrupts while changing the variable in main loop, thus making the operation atomic.


List of 6 messages in thread
32bit variables in interrupt      MEHDI      12/10/12 09:23      
   the variable will get corrupted      Jerson Fernandes      12/10/12 09:52      
      Thanks      MEHDI      12/10/12 10:30      
         Not 8051-specifc      Andy Neil      12/11/12 01:32      
   Exactly the same question just appeared on Keil!      Andy Neil      12/13/12 01:37      
      Probably!       Richard Erlacher      12/13/12 09:10      

Back to Subject List