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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/02/09 14:50
Read: times


 
#171400 - Just use a software counter.
Responding to: ???'s previous message
Your 8051 runs at 4MHz/12 so you have a basic 3.33us clock tick.
65536 x 3.33us is 218235us or 0.22 seconds.

So you only want your LED to toggle after 23 IRQs. 5.019 seconds.

if (++ctr >= 23) {
    ctr = 0;
    // toggle LED
} 

 


If you want an exact 5.000 seconds then you need to adjust your Timer reload value.

David.


List of 6 messages in thread
TopicAuthorDate
Maximum Timer interrupt-89S52??            01/01/70 00:00      
   Use a variable to count number of overflows            01/01/70 00:00      
      Yes, the counter works!            01/01/70 00:00      
   Just use a software counter.            01/01/70 00:00      
      Search terms            01/01/70 00:00      
         Traditional to keep track of timer reloads for slow events            01/01/70 00:00      

Back to Subject List