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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/07 08:02
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#133687 - latency compensation
Responding to: ???'s previous message
Chico,

you need to compensate for the time since the ISR started until reload - which you attempt to do - PLUS the time elapsed since the timer overrun occurred until the ISR actually started.

Unfortunately, the latter time (called latency) includes not only the "hardware call" of the ISR itself, but also finishing of the instruction which was executed when the timer overflow occured. As there are 1-, 2- and 4- cycle instructions in the standard 8051, latency is unfortunately variable.

However, you can compensate for this, as the timer at the time of ISR starts contains of course exactly the number of cycles elapsed since the overroll, so it can be used for the needed compensation - just add it to the reload value, compensated for the number of cycles while the counter is stopped during reload. For a nice example, see Peter Dannegger's tutorial (and the asm files linked from there).

Jan Waclawek


List of 9 messages in thread
TopicAuthorDate
Counting 1 second, its my code correct?            01/01/70 00:00      
   Code works. Total loop time = 1.025 secs            01/01/70 00:00      
      i think already 15535            01/01/70 00:00      
         JSIM.EXE stop watch gives loop time            01/01/70 00:00      
            JSIM            01/01/70 00:00      
               Probably the Keil will work perfectly...            01/01/70 00:00      
                  I tried Keil            01/01/70 00:00      
   latency compensation            01/01/70 00:00      
   double post            01/01/70 00:00      

Back to Subject List