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.
Software
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.
For more detail: 0-9999 seconds count down timer using PIC12F683 microcontroller