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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/27/02 11:52
Read: times


 
#26401 - RE: help me for delay
Hope this Helps"
first read the datasheet to know how to use timers of the 8052.
points to consider:
instruction cycles( /12, /6, /4, /2, or /1)
lets say u r using /12 device.
timer tick time = 12/xtal = 12/10000000
= 1.2 uSec
so timer is incremented every 1.2 usec
If you use timer in 16 bit mode then maximum count time would be 65535 * 1.2uSec = 78 msec
so best thing to do is make timer interrupt every 50msec in this case.
Whenever timer interrupt occurs you increment a counter, if counter = 200 that is 200*50msec = 10 seconds.then you zero the counter ready for next 10seconds interval.
another point to consider is that when you reload the counter, you need to take into consideration the reload time of the timer, because the timer is not counting during load as well as the time the address of normal program pushed onto the stack, so u add 4 instruction cycles time to the reload value so that your timing is more accurate if u reload the timer value first thing in your timer ISR otherwise you need to add the timming of all other instruction in the ISR before reloading the timer.
Best Regards
mahmood


List of 6 messages in thread
TopicAuthorDate
help me for delay            01/01/70 00:00      
RE: help me for delay            01/01/70 00:00      
RE: help me for delay            01/01/70 00:00      
RE: help me for delay            01/01/70 00:00      
RE: help me for delay            01/01/70 00:00      
RE: help me for delay            01/01/70 00:00      

Back to Subject List