0-9999 seconds count down timer using PIC12F683 microcontroller
The goal of this project is to construct a simple 0-9999 seconds count down timer with an alarm and a display. The time is set through two tact switches and the count down seconds are displayed on a 4-digit seven segment LED display. The project uses PIC12F683 microcontroller for all I/O and timing operations and MAX7219 IC for driving the seven segment LED module. The time out condition is indicated by an audible alarm from a buzzer.
The complete circuit diagram of this project is shown below. Two tact switches (named INC and TSET) are used for setting time and turning the timer on. These switches are connected in parallel and their inputs are read through the AN3 ADC channel of PIC12F683 microcontroller. You can see from the circuit diagram how these two tact switches give rise to different analog voltages when pressed. When INC is pressed, the input voltage to AN3 pin is 0. But if TSET is pressed, the input to AN3 ADC channel would be around 2.5V (two 4.7K resistors make a voltage divider network). And if none of them are pressed the ADC input is pulled up close to 5V. Therefore, based on the value of 10-bit ADC count, it is possible to detect and identify if any of the two switches is pressed. The buzzer is driven by a PWM signal generated at the GP2 output pin of PIC12F683. The display part uses a 4-digit seven segment (common cathode type) LED module which is driven by the MAX7219 IC. If you are not familiar with MAX7219 device, please read my earlier project Serial four digit 7-segment LED display module for further detail on that.
The picture below shows the complete setup of the project. I am using my PIC12F project board and MAX7219 based seven segment LED display module for illustration. The buzzer and tact switches are wired on a breadboard but they can easily fit over the small prototyping area available on the PIC12F project board.
The firmware is developed in C and compiled with mikroC Pro for PIC compiler. The driver routine for MAX7219 is taken from my previous project Serial four digit 7-segment LED display module. A 5KHz PWM signal is generated at the CCP1 output pin for the audible alarm when the timer is out. The overall operation of this timer project is described in the next section. That will help you to understand how the firmware for this project works. Here’s the complete source code for this project. A download link for source and HEX files is also provided below.
For more detail: 0-9999 seconds count down timer using PIC12F683 microcontroller
For All Your PCB Need, One-stop PCB Solution Services Appear:
EasyEDA: free PCB design tool, 200,000+ engineers are using
PCBs: 10pcs 2-layer 10x10cm only $8.21, on-time global shipping
Components: save 50% on cost, save on freight if shipped with ordered PCBs
Current Project / Post can also be found using:
- count down timer code in mikroc
- mikroC source code for countdown timer
- pic12f683 mikroc code