Summary of PIC12F675 based digital clock using LCD display (Code + Proteus simulation)
This article details a digital clock project built with a PIC12F675 microcontroller and an LCD display, programmed in C using MPLAB and the HI-TECH compiler. The system utilizes Timer0 to generate 1ms interrupts, driving counters for milliseconds, seconds, minutes, and hours, which reset after 24 hours. Simulation results are verified using Proteus software.Parts used in the Digital Clock:
- PIC12F675 microcontroller
- LCD display
- MPLAB v8.85 software
- HI-TECH C v9.83 compiler
- Proteus v7.10 simulation software
In this article, it is assumed that you know,
- How to interface LCD with PIC12F675 microcontroller. If you don't then please read this page.
- How to configure timer0 of PIC12F675 microcontroller. If you don't then please read this page.
The result of simulating the code in Proteus is shown below.
The above figure was taken after 1 minute and 13 seconds of code simulation in Proteus. In the code, timer0 is used as the base for digital clock generation. Timer0 is used here to generate 1msec interrupts. After every 1msec a global variable named msCounter increments. When msCounter reaches a value of 1000 then another global variable named secCounter increments and this process repeats itself. Similarly, when secCounter reaches 60, then minCounter increments. And when minCounter reaches 60 then hrCounter increments. This process continues until hrCounter reaches 24 then all of these variables reset their values. LCD is updated with the new values of hrCounter, minCounter and secCounter after every second.
Code
The main function code is shown below.
Downloads
Digital clock display code using PIC12F675 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.
For more detail: PIC12F675 based digital clock using LCD display (Code + Proteus simulation)
Quick Solutions to Questions related to Digital Clock:
- How is the time base generated?
Timer0 is configured to generate 1msec interrupts. - What happens when msCounter reaches 1000?
The secCounter increments by one. - When does the minCounter increment?
The minCounter increments when secCounter reaches 60. - How often is the LCD updated?
The LCD is updated with new values after every second. - What happens when hrCounter reaches 24?
All counter variables reset their values. - Which programming language was used?
The code was written in C language. - Which compiler was used for compilation?
HI-TECH C v9.83 compiler was used. - Can I view the simulation result?
Yes, simulation results are shown after 1 minute and 13 seconds of running.
Related projects
PIC 12F675 Programmable 12V Battery Monitor
Being an active outdoor guy, I have a few different types of 12V lights and a variety of battery types. - For...
Audio, Sound & Radio · PIC12F675Audio CRO using PIC12F675 Microcontroller
This project is a miniature Audio CRO. For those not familiar with the abbreviation "CRO," it means "Cathode Ray Oscilloscope" and this...
Development Boards & Kits · PIC12F675DIY $1 PIC 12f675 JDM Programmer (Cheap and Easy)
Hi EveryBody i am Again Doing something. and it is with PIC's! Almost Everybody do not want a Big Arduino in their...
LCD & Display ProjectsLeveraging Blockout Banners for Effective Electronics and Tech Product Displays
Blockout banners have become a popular and effective tool for displaying electronics and tech products in various settings, from trade shows and...
LCD & Display Projects · PIC18F4520Interfacing PIC18F4520 microcontroller with an HD44780 LCD
Introduction Being able to display data from a microcontroller visually has many advantages. It allows for menus, status indicators, and instructions to...
LCD & Display ProjectsVideo Project Development in the Midst of an Impromptu Online Semester
Receiving robot parts in the mail was an unexpected conclusion to the Winter 2020 semester for students. However, when faced with a...

