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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/12/04 08:01
Read: times


 
#64584 - RE: Timer 2 in auto reload mode
Responding to: ???'s previous message
Hi,
2/
TH2 = (65535-1000)>>8; ?????
TL2= (65535-1000);

this is a more generic approach and using the compiler to do some calculation for us. The 1000 is the number of ticks we want to load but the timer is an up counter (normally) and interrupts when it overflows (65535). This explains the 65535 - 1000.


Ooops, general failure has been found!

Not 65535. A timer overflows at 65536!!! So (65535 - 1000) gives us not 1000 but 1001 ticks. The simplest check: how much ticks have you expected with reload value (65535-0)? Zero? No. The one is right answer.

Regards,
Oleg

List of 33 messages in thread
TopicAuthorDate
Timer 2 in auto reload mode            01/01/70 00:00      
   RE: Timer 2 in auto reload mode            01/01/70 00:00      
      RE: Timer 2 in auto reload mode            01/01/70 00:00      
         RE: Timer 2 in auto reload mode            01/01/70 00:00      
            RE: Timer 2 in auto reload mode            01/01/70 00:00      
               RE: Timer 2 in auto reload mode            01/01/70 00:00      
               RE: Timer 2 in auto reload mode            01/01/70 00:00      
                  RE: Timer 2 in auto reload mode            01/01/70 00:00      
                     RE: Timer 2 in auto reload mode            01/01/70 00:00      
                        RE: Timer 2 in auto reload mode            01/01/70 00:00      
                           RE: Timer 2 in auto reload mode            01/01/70 00:00      
   RE: Timer 2 in auto reload mode            01/01/70 00:00      
      RE: Timer 2 in auto reload mode            01/01/70 00:00      
         RE: Timer 2 in auto reload mode            01/01/70 00:00      
            RE: Timer 2 in auto reload mode            01/01/70 00:00      
               RE: Timer 2 in auto reload mode            01/01/70 00:00      
                  RE: Timer 2 in auto reload mode            01/01/70 00:00      
                     RE: Timer 2 in auto reload mode            01/01/70 00:00      
                        RE: Timer 2 in auto reload mode            01/01/70 00:00      
                        RE: Timer 2 in auto reload mode            01/01/70 00:00      
                           RE: Timer 2 in auto reload mode            01/01/70 00:00      
                              RE: Timer 2 in auto reload mode            01/01/70 00:00      
                           RE: Timer 2 in auto reload mode            01/01/70 00:00      
                  RE: Timer 2 in auto reload mode            01/01/70 00:00      
                     RE: Timer 2 in auto reload mode            01/01/70 00:00      
               RE: Timer 2 in auto reload mode            01/01/70 00:00      
                  RE: Timer 2 in auto reload mode            01/01/70 00:00      
                     RE: Timer 2 in auto reload mode            01/01/70 00:00      
                        RE: Timer 2 in auto reload mode            01/01/70 00:00      
                           RE: Timer 2 in auto reload mode            01/01/70 00:00      
                              RE: Timer 2 in auto reload mode            01/01/70 00:00      
                                 RE: Timer 2 in auto reload mode            01/01/70 00:00      
                                    RE: Timer 2 in auto reload mode            01/01/70 00:00      

Back to Subject List