00 to 99 minute timer using PIC16F628A microcontroller
Description: A source code for a simple PIC-based digital timer is provided. The hardware for the project is not available; however, it will be demonstrated using a DIY PIC16F628A breadboard module and I/O board. The complete circuit diagram and firmware developed using the mikroC Pro for PIC compiler are included in the article. The microcontroller utilized in this project is the PIC16F628A, operating at a 4.0 MHz clock frequency with an external crystal. An HD44780-based 16x2 character LCD serves as the main display unit, allowing users to view and set the timer duration using tact switch inputs. Three tact switches are connected to the RB0 (Start/Stop), RB1 (Unit), and RB2 (Ten) pins. The timer interval can be selected from 0 to 99 minutes using the Unit and Ten minute switches. The Start/Stop switch toggles the timer ON and OFF. When the timer is activated, a logic high signal appears on the RA3 pin, which can be used to switch on a relay. In this demonstration, the timer output (pin RA3) is connected to an LED, which turns ON when the timer starts and turns OFF when the timer duration elapses. Upon powering ON the device, the microcontroller initializes the LCD display and shows a message indicating that the timer is initially OFF, along with the LED or relay connected to the RA3 pin. Users can set the time duration between 00 and 99 minutes (in 1-minute increments) using the Unit and Ten tact switches. Each press of a switch increments the corresponding time digit. Once the desired time is set, pressing the Start/Stop switch turns ON the timer, causing the RA3 pin to go high (illuminating the LED) and initiating the countdown. While the timer is active, the remaining time is displayed on the LCD screen. When the time elapses, the timer stops, and the LED turns OFF. The timer can be interrupted and stopped at any time by pressing the Start/Stop switch again. The firmware for the PIC is developed using the mikroC Pro for PIC compiler, avoiding the use of hardware timers for simplicity; time delays are generated using the Delay_ms() function of mikroC, which provides reasonably accurate timing delays.
The digital timer circuit is designed around the PIC16F628A microcontroller, which is a popular choice for embedded applications due to its versatility and ease of use. The microcontroller's I/O pins are configured to interface with the LCD and tact switches, allowing for seamless user interaction. The HD44780 LCD is a widely utilized display module that provides a straightforward means of displaying alphanumeric characters, making it ideal for timer applications.
The tact switches connected to the RB0, RB1, and RB2 pins are utilized for controlling the timer. The RB0 pin acts as the Start/Stop control, while the RB1 and RB2 pins are designated for setting the unit and ten-minute values, respectively. The microcontroller's firmware processes the inputs from these switches, updating the timer settings accordingly.
The logic high signal from the RA3 pin is pivotal for controlling external devices such as relays or LEDs. In this implementation, an LED is used to provide a visual indication of the timer's status. When the timer is activated, the RA3 pin outputs a high signal, illuminating the LED to signify that the countdown is in progress. Upon completion of the timer duration, the LED is turned OFF, providing a clear indication to the user that the set time has elapsed.
The initialization routine for the LCD display is crucial for providing feedback to the user. Upon powering the device, the microcontroller initializes the display and provides a clear message indicating that the timer is OFF. This feedback is essential for user confidence in the operation of the timer.
The time setting mechanism is designed for simplicity, allowing users to increment the timer values easily. The use of the mikroC Pro for PIC compiler streamlines the development process, enabling the implementation of the Delay_ms() function to create timing delays without the complexity of hardware timer configurations. This approach ensures that the timer operates accurately while maintaining a straightforward design.
In summary, this PIC-based digital timer project showcases the integration of a microcontroller, LCD display, and user input through tact switches, resulting in a functional and user-friendly timer application. The design emphasizes simplicity and clarity, making it an excellent example for educational purposes and practical applications in embedded systems.A source code for a very simple PIC based digital timer. The actual hardware of the project isn`t with me anymore. I will rather demonstrate it using my DIY PIC16F628A breadboard module and I/O board. The complete circuit diagram along with the firmware developed using mikroC Pro for PIC compiler is provided in the article. As I mentioned earlier, the microcontroller used in this project is PIC16F628A running at 4. 0 MHz clock using an external crystal. An HD44780 based 16G—2 character LCD is the main display unit of the project where you can watch and set the timer duration using tact switch inputs. There are three tact switches connected to RB0 (Start/Stop), RB1 (Unit), and RB2 (Ten) pins. You can select the timer interval from 0-99 min using Unit and Ten minute switches. The Start/Stop switch is for toggling the timer ON and OFF. When the timer gets ON, a logic high signal appears on the RA3 pin, which can be used to switch on a Relay.
The circuit diagram of this project is described below. I am using my self-made breadboard module for PIC16F628A and experimenter`s I/O board here to demonstrate this project. Since there is no relay switch in the I/O board, I am connecting the timer output (pin RA3) to an LED.
When the timer starts, the LED is turned ON. As the timer duration is elapsed, the LED is turned OFF. When the device is powered ON, the microcontroller initializes the LCD display and shows the following message. The timer is initially OFF and so does the LED or relay, whichever is connected to RA3 pin. You can set time duration between 00-99 min (in step of 1 min) using the Unit and Ten tact switches. Each switch press will increment the corresponding time digit. When the desired time is set, press the Start/Stop switch to turn ON the timer. The RA3 pin goes high (LED glows) and the count down begins. When the timer is ON, the remaining time is also shown on the LCD screen. When the time elapsed, the timer stops and the LED turns OFF. You can interrupt and stop the timer at anytime by pressing the Start/Stop switch once more. The firmware for PIC is developed using mikroC Pro for PIC compiler. The use of Timers are avoided for simplicity. The time delays are created using the Delay_ms() function of mikroC, which seems to give reasonably accurate timing delays.
This circuit is specifically designed for individuals who frequently need to wake up early in the morning. Standard alarms in electronic watches are often insufficiently loud and frequently fail to wake users. The switch circuit described here will be useful;...
For those who prefer convenience, it is possible to turn the bedroom light on or off without leaving the bed simply by clapping hands. This concept inspired the design of a clap-activated light control system. Various clap switch projects can...
This circuit functions as the inverse of Repeating Timer No. 3. Its operation is constrained to the hours of darkness. The variable resistor (preset) allows for the selection of the darkness level at which the timer will activate.
The circuit is...
The time is set by potentiometer R2, which provides a range from 1 second to 100 seconds, using a timing capacitor C1 of 100 µF. The output at pin 3 is normally low, keeping the relay in the off state.
The...
Beginner's Tutorial 1: Building a Circuit on Breadboard - how to build a simple and easy circuit on a breadboard for beginners in electronics. Learn to use an LED and a resistor.
This tutorial serves as an introductory guide for individuals...
The project originated from a request by Tony Bowler, a member of the Long Eaton Club, who sought assistance in converting a "Golden Oldie" model to electric free-flight. He selected Vic Smeed's "Debutante" to be powered by seven AE size...
This up/down timer was designed to control a power antenna on a late-model vehicle. Normally, this vehicle uses a body computer to control the antenna. However, the owner intended to install a high-powered audio stereo system. The original stereo system...
This circuit utilizes a timer to produce pulses at a 5-ms clock rate. The pulses are sequentially shifted into a shift register, illuminating an LED. An auxiliary timer generates one pulse per second to activate the "go" LED and initiate...
Suitable for cutting off an appliance or other AC load, this timer will cut the AC power after a period determined by R1/C3, as shown, for about 40 minutes. K1 is a relay that should handle about 10 A. S1A...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more