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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/30/03 23:12
Read: times


 
#61634 - RE: Atomic 16bit read
Responding to: ???'s previous message
All you really care about is reading "dirty" data (i.e., the ISR corrupting your read main loop's read), so have the ISR set a "dirty" bit when it increments the 16-bit counter, then when the main loop wants to read the counter, it first clears the "dirty" bit, then reads the 16-bit counter and checks the "dirty" bit again. If the bit is set, it loops back around to clear the bit and re-read; otherwise, if the bit remained clear, you've got a clean read. This way you don't have to disable interrupts and only use one bit of overhead. The JBC instruction works here too.

List of 32 messages in thread
TopicAuthorDate
Atomic 16bit read            01/01/70 00:00      
   RE: Atomic 16bit read            01/01/70 00:00      
      RE: Atomic 16bit read            01/01/70 00:00      
   RE: Atomic 16bit read            01/01/70 00:00      
      RE: Atomic 16bit read            01/01/70 00:00      
         RE: Atomic 16bit read            01/01/70 00:00      
            RE: Atomic 16bit read            01/01/70 00:00      
         RE: Atomic 16bit read            01/01/70 00:00      
   RE: Atomic 16bit read            01/01/70 00:00      
      RE: Atomic 16bit read            01/01/70 00:00      
         RE: Atomic 16bit read            01/01/70 00:00      
            RE: Atomic 16bit read            01/01/70 00:00      
               RE: Atomic 16bit read            01/01/70 00:00      
                  RE: Atomic 16bit read            01/01/70 00:00      
                  RE: Atomic 16bit read            01/01/70 00:00      
                     RE: Atomic 16bit read            01/01/70 00:00      
                        RE: Atomic 16bit read            01/01/70 00:00      
                           RE: Atomic 16bit read            01/01/70 00:00      
                              RE: Atomic 16bit read            01/01/70 00:00      
                                 RE: Atomic 16bit read            01/01/70 00:00      
                                    RE: Atomic 16bit read            01/01/70 00:00      
                                       RE: Atomic 16bit read            01/01/70 00:00      
                                          RE: Atomic 16bit read            01/01/70 00:00      
                                             RE: Atomic 16bit read            01/01/70 00:00      
                                                RE: Atomic 16bit read            01/01/70 00:00      
   RE: Atomic 16bit read            01/01/70 00:00      
      RE: Atomic 16bit read            01/01/70 00:00      
   RE: Atomic 16bit read            01/01/70 00:00      
      RE: Atomic 16bit read            01/01/70 00:00      
         RE: Atomic 16bit read            01/01/70 00:00      
            RE: Atomic 16bit read            01/01/70 00:00      
               RE: Atomic 16bit read            01/01/70 00:00      

Back to Subject List