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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/08/08 06:22
Modified:
  08/08/08 06:27

Read: times


 
#157314 - Try an egg timer
Responding to: ???'s previous message
Create a regular 10ms CTC timer interrupt.

The user sets the number of seconds.

Every 100'th IRQ, you decrement the second counter if still running.

e.g. ISR

if (++ms10 >= 100) {   // a whole second
    ms10 = 0;
    if (seconds) seconds--;
    else LED = off;
}


and setting the second count. You could disable IRQs while altering these variables, but not really necessary since ms10 is a char variable.

ms10 = 0;              // reset the jiffy count
seconds = 15;          // new countdown
LED = on;


David.

List of 14 messages in thread
TopicAuthorDate
timer            01/01/70 00:00      
   Try an egg timer            01/01/70 00:00      
      rather simple            01/01/70 00:00      
         so google for NE555 applications            01/01/70 00:00      
         More work with a 555            01/01/70 00:00      
         General Solution            01/01/70 00:00      
            One step too far            01/01/70 00:00      
         Don't overcomplicate!            01/01/70 00:00      
            Thanks            01/01/70 00:00      
   89C2051 fits the job            01/01/70 00:00      
      Count your LEDs again            01/01/70 00:00      
         I like the up/down switch idea but....            01/01/70 00:00      
      still there'll be 1 unused pin            01/01/70 00:00      
         Surplus 7-segment digits.            01/01/70 00:00      

Back to Subject List