Saturday, October 24, 2009

Countdown Timer

This is a simple countdown-timer-on-a-chip project - you program the PIC, attach some buttons and a pair of 2-segment LEDs, and you are done.

I used this timer for one of my projects, but I tried to make that timer as generic as possible, so it can have other applications. On this site I describe only the timer itself - code, pinout, and operation. If you want to see something built with the timer, check my Air Sampler project.


Specification

  • Two digit LED display with maximum count time of 99 units (units are configurable and can be seconds, minutes, or hours).
  • Start/Stop/Increment/Decrement buttons working in press and press-and-hold mode.
  • Optional Increment-by-ten/Decrement-by-ten buttons.
  • Pause and resume.
  • Add or subtract time while timer is running.
  • One output to control an external device or signal time state.
  • One unused pin - you can customize the code to make use of it as an either input or output.
  • Works with a cheap 3.579545 MHz (NTSC) crystal, easily adjustable to other frequencies.

You can give it a try right now - the widget on the right is a fully-operational simulation of the timer, configured to count seconds. Adjust the time using the +1, -1, +10, and -10 buttons. Start the timer with the SET button. Pause, stop, or clear timer by pressing RST. Pressing and holding a button works as you would expect from any timer. The green LED will show you when the timer is working - in real life, instead of the LED you will most likely have some device controlled by the timer.

No comments:

Post a Comment