maximum time delay using timer interrupt of timer 1 of 8051

Thread Starter

bobparihar

Joined Jul 31, 2014
93
i came to know that 8051 get interrupted whenever the timer overflows.. ie TF flag is set
so if i use MODE 1 timer one... the maximum delay after which MCU get interrupted comes out to be 71 ms approx(65535*1.085 micro sec)

so what if i need an interrupt delay more than 71 ms say i want an interrupt after 1sec? how it will possible?
 

GopherT

Joined Nov 23, 2012
8,009
i came to know that 8051 get interrupted whenever the timer overflows.. ie TF flag is set
so if i use MODE 1 timer one... the maximum delay after which MCU get interrupted comes out to be 71 ms approx(65535*1.085 micro sec)

so what if i need an interrupt delay more than 71 ms say i want an interrupt after 1sec? how it will possible?
Loop
Inside of a loop
Inside of a loop
And so on...
And so on...
And so on...

End
End
End
End
End
End
 

Papabravo

Joined Feb 24, 2006
22,064
A for loop is not the structure I would choose for using an interrupt. The idea is to count interrupts in the interrupt routine. This counter could be any number of bytes long, for a mind bendingly long delay. When the counter expires by reaching 0 or some prescribed value you set a flag(bit) in the interrupt routine. This bit is monitored by the non-interrupt code inside the "do forever" loop. Of course you also need a procedure for initializing the timer, the interrupt counter, and the done flag.
 
Top