0% found this document useful (0 votes)
2 views7 pages

Project Report

The project report details the design and implementation of a digital clock using the 8051 microcontroller, which manages timekeeping and displays the current time on a 7-segment display or LCD. It includes hardware requirements, circuit design, programming in C, and testing procedures. The clock features a user interface for setting time using push buttons and achieves accurate timekeeping through timer interrupts.

Uploaded by

Viyan Singh
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)
2 views7 pages

Project Report

The project report details the design and implementation of a digital clock using the 8051 microcontroller, which manages timekeeping and displays the current time on a 7-segment display or LCD. It includes hardware requirements, circuit design, programming in C, and testing procedures. The clock features a user interface for setting time using push buttons and achieves accurate timekeeping through timer interrupts.

Uploaded by

Viyan Singh
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/ 7

Project Report: Digital Clock Using 8051 Microcontroller

1. Title Page
• Title: Digital Clock Using 8051 Microcontroller

• Subtitle: Implementation and Documentation


• Author: [Your Name]

• Institution/Company: [Your Internship Organization]

• Date: [Submission Date]

2. Table of Contents
• Introduction

• Project Requirements

o Hardware Components

o Software Tools

• System Overview and Block Diagram


• Circuit Design and Explanation

• Flowchart and Working Principle

• Programming in C for 8051

o Code Explanation

• Testing and Simulation

• Conclusion

• References

3. Introduction
This project involves designing and implementing a digital clock using the 8051 microcontroller.
The microcontroller will manage timekeeping through timers and interrupts, while the current
time is displayed on a 7-segment display or LCD. The clock can be configured using push
buttons to set the hours and minutes.
Objectives:

• Design a digital clock using the 8051 microcontroller.

• Display hours, minutes, and seconds.

• Implement time-setting functionality using push buttons.

4. Project Requirements
4.1 Hardware Components
• 8051 Microcontroller (AT89C51)

• 7-Segment Display or 16x2 LCD

• Push Buttons for setting time (Increment Hours/Minutes)

• Crystal Oscillator (11.0592 MHz) for accurate timing

• Capacitors (33pF) for stabilizing the oscillator

• Resistors (10kΩ) for pull-up purposes

• Power Supply (5V)


• Wires, Breadboard/PCB

4.2 Software Tools

• Keil uVision IDE for C programming and compiling

• Proteus for circuit simulation (optional)


• ISP Programmer for loading code onto the microcontroller

5. System Overview and Block Diagram


System Overview:

The system is built around the 8051 microcontroller, which is responsible for timekeeping and
managing user inputs. The clock will use a crystal oscillator for accurate timing and timers for
managing second, minute, and hour counts. Push buttons allow users to set the time.

Block Diagram:
• 8051 Microcontroller: Central control unit, managing time and user input.

• Push Buttons: Used to set hours and minutes.

• Display: Shows the current time (hours, minutes, seconds).

6. Circuit Design and Explanation


Circuit Diagram:
The circuit diagram represents the connections between the 8051 microcontroller, display, and
input buttons. The microcontroller will handle the time updates and display the current time on a
7-segment display or LCD.

Connections:

• Display: Connect each segment of the 7-segment display to the appropriate


microcontroller port pins.

• Push Buttons: Connect to the microcontroller's input pins with pull-up resistors to avoid
floating states.

• Oscillator: Connect the crystal oscillator to the XTAL1 and XTAL2 pins of the 8051 for
clock pulses.

• Power Supply: Provide a stable 5V DC supply to power the microcontroller and display.
7. Flowchart and Working Principle
Flowchart:

1. Start: Initialize the microcontroller.

2. Initialize Timer: Set up the timer to generate a 1-second interrupt.

3. Display Initial Time: Display 00:00:00 on the display.

4. Wait for Timer Interrupt: Wait for the timer to overflow.

5. Increment Time: When the interrupt triggers, increment seconds, minutes, and hours as
needed.

6. Update Display: Refresh the display with the new time values.
7. Check for Button Presses: If a button is pressed, enter the time-setting mode.
8. Set Time: Adjust hours and minutes based on user input.

9. Return to Display Mode.


Working Principle:

• Timekeeping: The microcontroller uses its internal timer to generate an interrupt every
second. When the timer overflows, it triggers an interrupt service routine that increments
the seconds counter. If the seconds reach 60, minutes are incremented, and the seconds
reset to 0. Similarly, when minutes reach 60, hours are incremented, and minutes reset to
0. When hours reach 24, they reset to 0.

• Display: The current time is displayed on a 7-segment display or LCD. The


microcontroller continuously updates the display with the current time.

• Time Setting: Push buttons allow the user to adjust the hours and minutes. When a
button is pressed, the microcontroller enters a time-setting mode where the user can
increment hours or minutes.

8. Programming in C for 8051


Code Overview:

The code is written in C and compiled using the Keil uVision IDE. The microcontroller is
programmed to handle timekeeping via timer interrupts and update the display accordingly. The
push buttons are used for setting the time.

Code:

#include <reg51.h> // Include 8051 header file

// Define pins for LCD or 7-segment display


sbit RS = P2^0;
sbit EN = P2^1;

unsigned char seconds = 0, minutes = 0, hours = 0;

void timer0_isr() interrupt 1 { // Timer interrupt service routine


TH0 = 0xFC; // Reload Timer value for 1 second delay
TL0 = 0x66;
seconds++;
if(seconds == 60) {
seconds = 0;
minutes++;
if(minutes == 60) {
minutes = 0;
hours++;
if(hours == 24) {
hours = 0;
}
}
}
update_display(); // Update the display with the new time
}

void update_display() {
// Code to update the 7-segment display or LCD with the current time
}

void timer_init() {
TMOD = 0x01; // Timer0 in mode 1 (16-bit timer)
TH0 = 0xFC; // Load timer high byte for 1 second delay
TL0 = 0x66; // Load timer low byte
IE = 0x82; // Enable Timer0 interrupt
TR0 = 1; // Start Timer0
}

void main() {
timer_init(); // Initialize timer
while(1) {
// Main loop: clock update handled in the interrupt
// Handle button input for setting the time
}
}

Code Explanation:

• Timer Initialization: Timer 0 is configured in 16-bit mode to generate a 1-second


interrupt.

• Interrupt Handling: The timer0_isr() function increments the time variables and calls
update_display() to refresh the display.

• Main Loop: The main loop continuously runs, with most of the time management
handled by interrupts.

9. Testing
Hardware Testing

• Physical Setup: Describe the physical connections on your breadboard or PCB.

• Test Cases: Explain the tests you performed, such as:


o Verifying time increments correctly.
o Checking if time can be set accurately using the buttons.

o Observing display behavior under different conditions.

10. Conclusion
Summarize the outcome of the project:

• Successfully implemented a digital clock using the 8051 microcontroller.

• Accurate timekeeping achieved through timer interrupts.

• Functional user interface using push buttons for time setting.

• Reflect on any challenges and how they were overcome (e.g., timing issues, display
refresh).

You might also like