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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/26/05 03:52
Read: times


 
#95929 - No Code ,,, But an Idea
Responding to: ???'s previous message
Program a timer for a fixed interrupt period of 10 msec. This is same as 100 Hz frequency.

OK note that in 5 minutes there are 5*60 = 300 seconds. In 300 seconds there will the 300 * 100 = 30000 of the timer interrupts.

The number 30000 fits nicely in to a two byte sized variable.

3 minutes and 1 minute are counts of 3*60*100 and 1*60*100 or 18000 and 6000 respectively.

So have your program setup the timer interrupt to decrement a two byte counter starting from 30000 and going down to 0. At each time the count goes to zero reset it back to 30000 so you can repeat the cycle. At each interrupt time check the decremented count value for equality to 18000 and 6000 and at these times trigger your desired port bit.

Michael Karas


List of 17 messages in thread
TopicAuthorDate
Countdown with 8051            01/01/70 00:00      
   No Code ,,, But an Idea            01/01/70 00:00      
   Tutorials            01/01/70 00:00      
      Hi.            01/01/70 00:00      
   Third way            01/01/70 00:00      
   I have a part of code...            01/01/70 00:00      
      Delays.....            01/01/70 00:00      
         Countdown            01/01/70 00:00      
            Show us the code !            01/01/70 00:00      
            "The" code...            01/01/70 00:00      
               What ?            01/01/70 00:00      
                  R1 and R2            01/01/70 00:00      
               binary-decimal            01/01/70 00:00      
                  Another trick            01/01/70 00:00      
                     It's working...            01/01/70 00:00      
   Start your count decimal            01/01/70 00:00      
   count down with 8051            01/01/70 00:00      

Back to Subject List