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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/09/09 09:30
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#168272 - Extend the timer with software....
Responding to: ???'s previous message
Depending on which timer you are trying to use, (and if you look at your message post you did not specify @^@) the reload capability will only be an 8-bits or 16-bits value. These will count to duration and overflow much sooner than the 45 seconds you are looking for. So what you have to do is set the timer registers to make a timer interrupt time that is some sub multiple of 45 seconds. Lets say, for sake of discussion, that you can set the timer for an interrupt period of 45 milliseconds. Inside the timer interrupt service routine you will now need to manage a software counter variable that steps by one each interrupt. After the counter has stepped 1000 times you will have achieved a period of 45 seconds.

If you have to ask about how to set the timer reload registers for some value like 45 milliseconds then I would suggest right now that you read the MCU data sheet and look into the chapters of the document that has become known as the "bible" that describes in detail how the timers work. This document can be found in the Links section of this web site. Look there for the "The '51 "Bible"".

Michael Karas


List of 2 messages in thread
TopicAuthorDate
Timer in atmel 89c52            01/01/70 00:00      
   Extend the timer with software....            01/01/70 00:00      

Back to Subject List