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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/10/04 22:08
Read: times


 
#70143 - RE: Can we expand the timers in 89c52 uC
Responding to: ???'s previous message
Michael Karas said:
Note that if you implement timers at sizes greater than 8-bits wide it is necessary to disable interrupts for the short period of time that the main application program attempts to set a timer value or read a timer value.


One way to avoid that could be to have the ISR set a flag when the timer "expires" - eg,
if(TimerA != 0)
{
   TimerA--;
}
else
{
   TimerAExpired = TRUE;
}

if(TimerB != 0)
{
   TimerB--;
}
else
{
   TimerBExpired = TRUE;
}

if(TimerC != 0)
{
   TimerC=- /* sic */;
}
else
{
   TimerCExpired = TRUE;
}
The mainline code then just tests the appropriate 'expired' flag.
On an 8051, bit-addressable data could be used to advantage here.

(the above code could be improved so that the ISR isn't always setting the 'expired' flag once a timeout has completed!)

List of 7 messages in thread
TopicAuthorDate
Can we expand the timers in 89c52 uC            01/01/70 00:00      
   RE: Can we expand the timers in 89c52 uC            01/01/70 00:00      
      RE: Can we expand the timers in 89c52 uC            01/01/70 00:00      
      48 Timers?!            01/01/70 00:00      
         RE: 48 Timers?!            01/01/70 00:00      
   RE: Can we expand the timers in 89c52 uC            01/01/70 00:00      
   Same old wine in a new bottle            01/01/70 00:00      

Back to Subject List