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

Back to Subject List

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


 
#188544 - Timer ISR Counter
Responding to: ???'s previous message
So what if was want to generate a delay that's greater than 65 ms?
set the timer for e.g. 10ms and increment/decrement a counter in the Timers ISR


It is indeed the conventional way to do this. It is rather surprising how many times a question like this is asked!! A new user sees that a timer runs out of duration shorter than the total delay that they wanted and then almost think they need to find an MCU with a longer counter!!

If, as suggested by Erik, you set the timer ISR to fire off once each 10 milliseconds then a software manintained counter in the timer ISR that is 16-bits wide can indicate a time delay out to 65,535 * 10ms = 655.35 seconds. This is over 10 minutes!!

A 24-bit wide counter in the timer ISR could support a delay out to 16,777,215 * 10ms = 167,772.15 seconds. This is over 45 hours.

Michael Karas

List of 4 messages in thread
TopicAuthorDate
Maximum possible delay using a Timer            01/01/70 00:00      
   are you sure?            01/01/70 00:00      
      Timer ISR Counter            01/01/70 00:00      
   The answer is chip dependant            01/01/70 00:00      

Back to Subject List