Are you a beginner in micro controller projects?and are you stuck where to start from?if yes,then this is one of the simplest mini projects that you can start from . This mini project will give you a clear understanding of programming your micro controller. we sometimes look at our watch and wonder ” how does this thing work”. Well, in this digital clock project, you will gain some insight on how micro controller can be used to make it work as a Digital Clock.
Components required:
- 1 microcontroller 89C52(89S52 will also do)
- 2 ceramic capacitors-22pF
- 1 switch(button for reset purpose)
- 1 electrolytic capacitor-10uF,25V
- 1 crystal oscillator-11.0592MHz
- 16×2 LCD display
- 1 resistor-10k
Software you will need
This project has been done in proteus software.If you are new to proteus software, the tutorials given below may get you started with the software.note:if you are familiar with proteus you can skip this part.
The programming of the microcontroller is done using keil compiler.port 2 of 89C52 is used as the output port.whereas port 1 is used as the input port.when P1_4 is grounded the 12 hr mode is activated and when P1_5 is grounded the 24 hr mode is activated.
#include “REGX52.H”
#include “delay.h”
#include “lcd.h”
void main(void)
{int hr=0; /*initiate hour=0 */
int min=0; /*initiate minutes=0 */
int sec=0; /*initiate seconds=0 */
P1=0xff; /*set port 1 as input port */
P2=0x00; /*set port 2 as output port*/
while(1)
{ LCD_INIT(); /*initialize LCD*/
if (P1_4==0)/*if P1_4 is grounded enter the 12hr loop */{
For more detail: Digital Clock Using Microcontroller 89C52 89S52
Current Project / Post can also be found using:
- led clock making using pic
- pic clock project
- digital clock microcontroller code pic16f877a
- pic project clock
The post Digital Clock Using Microcontroller 89C52/89S52 appeared first on PIC Microcontroller.