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

Back to Subject List

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


 
#84373 - How do you reload?
Responding to: ???'s previous message
Your calculation is probably good, but how do you reload the timer?
If you simply do somting similar to
mov tl0,#LOW(timeconstant)
mov th0,#HIGH(timeconstant)

you make an error due to interrupt latency a and nonzero time needed for reloading.
Use either Timer2, if available, or you need to compensate for the time elapsed since the timer overrolled (and triggered an interrupt) until you update it - you need to add that time to your (and also a compensation constant for time elapsed since the timer is stopped).

Have a look at
http://www.8052.com/forum/read.phtml?id=73420
and maybe also other places - the tutorial is really wrong, as even the modification at the bottom does not account for interrupt latency.
Peter Dannegger has also the right solution, but I cannot access his page at the moment - Peter?

Jan Waclawek


List of 7 messages in thread
TopicAuthorDate
Verify the timer interval calculations            01/01/70 00:00      
   Why?            01/01/70 00:00      
      whops            01/01/70 00:00      
      Why don't you just measure it?            01/01/70 00:00      
         i am doing this            01/01/70 00:00      
            How do you reload?            01/01/70 00:00      
   only difficult way with timer 0            01/01/70 00:00      

Back to Subject List