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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Michael Karas
10/02/12 14:20
Read: 887 times
Beaverton Or

#188544 - Timer ISR Counter
Responding to: Erik Malund'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
Maximum possible delay using a Timer      Rosh Infy      10/02/12 12:46      
   are you sure?      Erik Malund      10/02/12 12:59      
      Timer ISR Counter      Michael Karas      10/02/12 14:20      
   The answer is chip dependant      Jim Granville      10/02/12 14:50      

Back to Subject List