Menu
Here is a LCD based Digital Clock project using only 8051. This digital clock is configured in a 12 hour mode and switches are given for set the hours, minutes, and AM/PM.
Use push on - push off switches here do not use toggle switches for set the hours, minute, am/pm and start. For reset of microcontroller use toggle switch.
Circuit Diagram :-
download and zoom in the photo so you can clearly all the connections.
Pink lines - 12 volt
Red lines - 5 volts
Black lines - ground
Blue lines - data
Components Required :-
330 0HM RESISTANCE - 2
10K OHM RESISTANCE - 2
10K OHM VARIABLE RESISTANCE - 1
33PF CAPACITOR - 2
10UF CAPACITOR - 1
1000UF CAPACITOR - 1
11.0592 MHZ CRYSTAL OSCILLATOR - 1
GREEN LED - 1
Process to set Time :-
Start button - 1st button
hour set - 2nd button
minute set - 3rd button
am-pm set - 4th button
Code :-
----------------------------------------------------------------------------------------------------------------------------------
// Program to make a digital clock using LCD
#include<reg51.h>
#define m_sec 10
sbit rs = P3^0;
sbit rw = P3^1;
sbit en = P3^2;
sbit hrs=P1^1;
sbit mns=P1^2;
sbit start=P1^0;
sbit am_pm=P1^3;
int hr ,hr1=0;
int min,min1=0;
int sec,sec1=0,ampm=0;
void delay(unsigned int msec) // Time delay funtion
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char item) // Function to send command on LCD
{
P2 = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
}
void lcd_data(unsigned char item) // Function to send data on LCD
{
P2 = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}
void lcd_data_string(unsigned char *str) // Function to send string on LCD
{
int i=0;
while(str[i]!='0')
{
lcd_data(str[i]);
i++;
delay(1);
}
return;
}
lcd_data_int(int time_val) // Function to send number on LCD
{
int int_amt;
int_amt=time_val/10;
lcd_data(int_amt+48);
int_amt=time_val%10;
lcd_data(int_amt+48);
}
void lcd(unsigned char str1[10]) // Function to initialize LCD
{
lcd_cmd(0x38); //2 LINE, 5X7 MATRIX
lcd_cmd(0x0e); //DISPLAY ON, CURSOR BLINKING
delay(m_sec);
lcd_data_string(str1);
}
void set_hr1() // Function to set hour
{
hr1++;
if(hr1>11)
hr1=0;
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
}
void set_min1() // Function to set minute
{
min1++;
if(min1>59)
min1=0;
lcd_cmd(0xc6);
lcd_data_int(min1);
}
void main()
{
int k;
start=1;
hrs=1;
mns=1;
lcd_cmd(0x01);
lcd_cmd(0x83);
lcd('SET TIMING');
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(start0)
delay(200);
if(hrs0)
set_hr1();
if(mns0)
set_min1();
}
if(am_pm0)
{
lcd_cmd(0xc8);
lcd_data_string('am');
ampm=0;
}
if(am_pm1)
{
lcd_cmd(0xc8);
lcd_data_string('pm');
ampm=1;
}
delay(200);
lcd_cmd(0x01);
while(1)
{
for(k=0;k<2;k++)
{
for(hr=hr1;hr<12;hr++)
{
for(min=min1;min<60;min++)
{
for(sec=0;sec<60;sec++)
{
lcd_cmd(0x82);
delay(1);
lcd_data_int(hr);
lcd_data(':');
lcd_data_int(min);
lcd_data(':');
lcd_data_int(sec);
if(ampm0)
{
lcd('am');
}
else
{
lcd('pm');
}
lcd_data_string(' ');
delay(100);
}
}
min1=0;
}
if(ampm0)
ampm=1;
else
ampm=0;
hr1=0;
}
}
}
---------------------------------------------------------------------------------------------------------------------------------
Calculations in this program are standard.
Pictures :-
Video :-
- 8051 Programming Board
- 8051 Microcontroller Applications
- Program For Digital Clock Using 8051 Microcontroller
2015 land cruiser owners manual. 8051 Microcontroller based Digital Alarm Clock with LCD Display. The required components of this 8051 microcontroller based digital clock circuit with LCD display mainly include LCD display, AT89C51 Microcontroller, Preset, piezo buzzer and speaker. The function of each and every component of this project is discussed below. Hello friends, hope you all are fine and having fun with your lives. In today's post, I am going to share Interrupt based Digital clock with 8051 Microcontroller. In the previous post, I have explained in detail How to use Timer Interrupt in 8051 Microcontroller.We have seen in that post that we can use two timers in 8051 Microcontroller which are Timer0 and Timer1. GitHub is where the world builds software. Neverwinter mmorpg guide. Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world. https://cdn.shopify.com/s/files/1/0524/1251/4482/files/download-parallels-15-for-mac.pdf. Danger high voltage slots free.
Keynote sets the stage for an impressive presentation. A simple, intuitive interface puts important tools front and center, so everyone on your team can easily add beautiful charts, edit photos, and incorporate cinematic effects. Download Keynote for macOS 10.15 or later and enjoy it on your Mac. Easily create gorgeous presentations with Keynote, featuring powerful yet easy-to-use tools and dazzling effects that will make you a very hard act to follow. The latest version of Keynote'09 is 5.0 on Mac Informer. It is a perfect match for Presentation in the Design & Photo category. The app is developed by Apple Inc. Download keynote 09 for mac.
Note :-Use push on - push off switches here do not use toggle switches for set the hours, minute, am/pm and start. For reset of microcontroller use toggle switch.
Circuit Diagram :-
download and zoom in the photo so you can clearly all the connections.
Pink lines - 12 volt
Red lines - 5 volts
Black lines - ground
Blue lines - data
7805 IC - 1
1N4007 diode - 1330 0HM RESISTANCE - 2
10K OHM RESISTANCE - 2
10K OHM VARIABLE RESISTANCE - 1
33PF CAPACITOR - 2
10UF CAPACITOR - 1
1000UF CAPACITOR - 1
11.0592 MHZ CRYSTAL OSCILLATOR - 1
GREEN LED - 1
RED LED - 116X2 LCD - 1
12 volt battery upto 1.5 amp. -1
P89V51RD2 MICROCONTROLLER - 1
TOGGLE BUTTON - 1
12 volt battery upto 1.5 amp. -1
P89V51RD2 MICROCONTROLLER - 1
TOGGLE BUTTON - 1
16x2 LCD - 1
Process to set Time :-
Start button - 1st button
hour set - 2nd button
minute set - 3rd button
am-pm set - 4th button
- push the start button. (start button off and clock do not start)
- now push the hour or minute buttons according to set time (do no push repeatedly push only one time).
- Now Push off the hour and minute buttons for stopping the time increasing.
- Push the am-pm button according to the am-pm
- Now push on the start button now for starting the clock.
Code :-
----------------------------------------------------------------------------------------------------------------------------------
// Program to make a digital clock using LCD
#include<reg51.h>
#define m_sec 10
sbit rs = P3^0;
sbit rw = P3^1;
sbit en = P3^2;
sbit hrs=P1^1;
sbit mns=P1^2;
sbit start=P1^0;
sbit am_pm=P1^3;
int hr ,hr1=0;
int min,min1=0;
int sec,sec1=0,ampm=0;
void delay(unsigned int msec) // Time delay funtion
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char item) // Function to send command on LCD
{
P2 = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
![8051 8051](/uploads/9/9/5/7/99570632/101754630.jpg)
void lcd_data(unsigned char item) // Function to send data on LCD
{
P2 = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}
void lcd_data_string(unsigned char *str) // Function to send string on LCD
{
int i=0;
while(str[i]!='0')
{
lcd_data(str[i]);
i++;
delay(1);
}
return;
}
lcd_data_int(int time_val) // Function to send number on LCD
{
int int_amt;
int_amt=time_val/10;
lcd_data(int_amt+48);
int_amt=time_val%10;
lcd_data(int_amt+48);
}
void lcd(unsigned char str1[10]) // Function to initialize LCD
{
lcd_cmd(0x38); //2 LINE, 5X7 MATRIX
lcd_cmd(0x0e); //DISPLAY ON, CURSOR BLINKING
delay(m_sec);
lcd_data_string(str1);
}
void set_hr1() // Function to set hour
{
hr1++;
if(hr1>11)
hr1=0;
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
}
void set_min1() // Function to set minute
{
min1++;
if(min1>59)
min1=0;
lcd_cmd(0xc6);
lcd_data_int(min1);
}
void main()
{
int k;
start=1;
hrs=1;
mns=1;
lcd_cmd(0x01);
lcd_cmd(0x83);
lcd('SET TIMING');
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(start0)
8051 Programming Board
{delay(200);
if(hrs0)
set_hr1();
if(mns0)
set_min1();
}
if(am_pm0)
{
lcd_cmd(0xc8);
lcd_data_string('am');
ampm=0;
}
if(am_pm1)
{
lcd_cmd(0xc8);
lcd_data_string('pm');
ampm=1;
}
delay(200);
lcd_cmd(0x01);
while(1)
{
for(k=0;k<2;k++)
{
for(hr=hr1;hr<12;hr++)
{
for(min=min1;min<60;min++)
{
for(sec=0;sec<60;sec++)
{
lcd_cmd(0x82);
delay(1);
lcd_data_int(hr);
lcd_data(':');
lcd_data_int(min);
lcd_data(':');
lcd_data_int(sec);
if(ampm0)
{
lcd('am');
}
else
{
lcd('pm');
}
lcd_data_string(' ');
delay(100);
}
}
min1=0;
}
if(ampm0)
ampm=1;
else
ampm=0;
hr1=0;
}
}
}
---------------------------------------------------------------------------------------------------------------------------------
Calculations in this program are standard.
Pictures :-
Video :-
8051 Microcontroller Applications
Proteus video :-Program For Digital Clock Using 8051 Microcontroller
IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.
GOOD LUCK