0% found this document useful (0 votes)
117 views8 pages

Digital Clock 8051 Detailed Report

repot of digital clock 8051

Uploaded by

shivani.21ece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views8 pages

Digital Clock 8051 Detailed Report

repot of digital clock 8051

Uploaded by

shivani.21ece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Minor Project Report

on

Digital Clock Using 8051 Microcontroller

Shivani M
[email protected]

[email protected]

Embedded Systems and IOT Internship Training


Abstract
This project report explains the design and implementation of a Digital
Clock using the 8051 Microcontroller. The objective is to develop an
embedded system capable of displaying time accurately using LEDs or an
LCD. The project involves hardware interfacing, embedded C
programming, and circuit simulation. This document describes the project's
objectives, methodology, results, and future scope, accompanied by the
source code used.
Introduction
The 8051 Microcontroller, introduced by Intel, is a widely used platform in
embedded systems. This project demonstrates its application in building a
digital clock. Digital clocks are essential tools for timekeeping in everyday
life. This project aims to showcase the use of microcontrollers in
implementing precise and reliable timekeeping systems.
Objectives
The primary objectives of this project are:
- To design a digital clock system using the 8051 Microcontroller.
- To ensure accurate time display in hours, minutes, and seconds.
- To demonstrate hardware-software integration in embedded systems.

Hardware Components
The components used in this project include:
1. 8051 Microcontroller
2. Crystal Oscillator
3. LCD (16x2) Display or LEDs
4. Push Buttons for time adjustment
5. Resistors and Capacitors for stabilization
6. Power Supply Unit
Software Tools
The following tools were used for development:
1. Keil uVision: For writing and compiling the embedded C code.
2. Proteus Design Suite: For simulating the circuit design.
Implementation
The implementation involves the following steps:
1. Connecting the microcontroller to the haare components based on
the circuit diagram.
2. Writing the embedded C code to configure the 8051
Microcontroller for timekeeping.
3. Simulating the design using Proteus to verify the system
functionality.
4. Testing the hardware with the uploaded program for real-world
operation.
System Design
The digital clock system consists of a microcontroller interfaced
with a crystal oscillator, an LCD display, and push buttons. The
crystal oscillator ensures accurate timing, while the LCD displays
the time. The push buttons allow manual adjustments to the clock.
Source Code

#include <reg51.h>

sbit RS = P2^0; // Register Select pin for LCD


sbit EN = P2^1; // Enable pin for LCD
sbit UP = P3^0; // Push button for increasing time
sbit DOWN = P3^1; // Push button for decreasing time

void delay(unsigned int time) {


unsigned int i, j;
for (i = 0; i < time; i++)
for (j = 0; j < 1275; j++);
}

void lcd_cmd(unsigned char cmd) {


P1 = cmd;
RS = 0;
EN = 1;
delay(1);
EN = 0;
}
void lcd_data(unsigned char data) {
P1 = data;
RS = 1;
EN = 1;
delay(1);
EN = 0;
}

void lcd_init() {
lcd_cmd(0x38); // Initialize LCD in 8-bit mode
lcd_cmd(0x0C); // Display ON, Cursor OFF
lcd_cmd(0x01); // Clear Display
lcd_cmd(0x06); // Shift cursor to right
lcd_cmd(0x80); // Force cursor to the beginning
}

void lcd_print(char *str) {


while (*str) {
lcd_data(*str++);
}
}

void main() {
int hours = 0, minutes = 0, seconds = 0;
char time[9];
lcd_init();
while (1) {
sprintf(time, "%02d:%02d:%02d", hours, minutes,
seconds);
lcd_cmd(0x80);
lcd_print(time);
delay(1000);
seconds++;
if (seconds == 60) {
seconds = 0;
minutes++;
}
if (minutes == 60) {
minutes = 0;
hours++;
}
if (hours == 24) {
hours = 0;
}
}
}
Results
The digital clock was successfully implemented and displayed the
current time accurately on the LCD display. Push buttons allowed
manual adjustment of hours and minutes, ensuring functional
flexibility.
Conclusion
This project successfully demonstrated the application of the 8051
Microcontroller in implementing a digital clock. The system was
reliable and accurate. Future enhancements could include features
such as alarms, timers, or wireless time synchronization.

You might also like