Microcontroller_Project_report_final last
Microcontroller_Project_report_final last
Program
BEC405A Submitted by
4BD22EC089 Shravan B G
4BD22EC091 Shreyas M S
Engineering
2023-2024
SIMULTION OF REAL TIME CLOCK
INDEX
3 Explanation 4
4 Program 5
5 Algorithm/Flowchart 11
7 Applications 12
1. Introduction :
Proteus Software:
Proteus is a comprehensive suite of electronic design automation (EDA) tools used for
circuit simulation, PCB design, and microcontroller simulation. It is widely used by
engineers, designers, and hobbyists for designing and testing circuits before implementing
them in hardware. Developed by Labcentre Electronics, Proteus offers a range of features
that make it a powerful tool for both education and professional projects.
Keil µvision:
Keil µVision, often referred to as Keil uVision or simply Keil, is an integrated development
environment (IDE) specifically designed for embedded software development. Developed
by Keil, a division of ARM Holdings, it is widely used for programming and debugging
microcontrollers, especially those based on ARM Cortex-M, ARM7, ARM9, and other
ARM architecture processors. The Keil µVision environment combines project
management, code editing, compilation, and debugging in a single application, making it a
powerful tool for embedded developers.
2. Circuit Diagram
3. Explanation:
The provided circuit diagram shows the connections between an 80C51 microcontroller
(U1), an LCD display (LCD1), a DS1307 RTC module (U2), and a crystal oscillator (X1).
Pin 3 (VEE): This pin controls the contrast of the LCD. It is usually connected to
a variable resistor (not shown in the diagram) to adjust the contrast.
Pin 4 (RS): This is the Register Select pin. It is connected to P2.0 of the
microcontroller (U1).
Pin 5 (RW): This is the Read/Write pin. It is connected to P2.1 of the
microcontroller.
Pin 6 (E): This is the Enable pin. It is connected to P2.2 of the microcontroller.
Pins 7-14 (D0-D7): These are the data pins. Pins D0 to D3 are not connected,
and D4 to D7 are connected to P2.3 to P2.6 of the microcontroller.
XTAL1 (Pin 19) and XTAL2 (Pin 18): These pins are connected to a crystal
oscillator (not shown in the diagram) to provide the clock signal for the
microcontroller.
RST (Pin 9): This is the reset pin, connected to a reset circuit (not shown in the
diagram).
PSEN (Pin 29), ALE (Pin 30), EA (Pin 31): These pins are connected as per
standard 8051 microcontroller requirements. PSEN is connected to the Program
Store Enable pin, ALE to the Address Latch Enable, and EA to the External
Access Enable.
P3.0 (RXD): This pin is connected to the TXD pin of the RTC module (U2).
P3.1 (TXD): This pin is connected to the RXD pin of the RTC module (U2).
P3.2 (INT0), P3.3 (INT1): These pins are connected to external interrupt sources
(not shown in the diagram).
P3.4 (T0), P3.5 (T1): These pins are connected to the timer inputs.
P3.6 (WR), P3.7 (RD): These pins are connected to the write and read control
signals.
This setup is designed to interface the microcontroller with the LCD display for data
output and the RTC module for real-time clock functionality, using the standard 8051
microcontroller architecture.
4. Program :
#include <reg51.h>
// Main function
void main() {
// Initialize counter variables to 0
v1 = v2 = v3 = v4 = v0 = v5 = v6 = 0;
5. Algorithm/Flow Chart:
Step 1 : Start
Step 2 : Initialize counters v1, v2, v3, v4, v5, and v6 to 0.
Step 3 : Loop indefinitely:
Step 4 : Increment v1 by 1.
Step 6 : If v1 equals 10, reset v1 to 0 and increment v2.
Step 7 : Output the value of arr[v1] to port P2.
Step 8 : Delay for a short period
Step 9 : If v2 equals 6, reset v2 to 0 and increment v3.
Step 10:If v3 equals 10, reset v3 to 0 and increment v4.
Step 11:If v4 equals 6, reset v4 to 0 and increment v5.
Step 12:If v5 equals 3, reset v5 to 0 and increment v6.
Step 13: If v6 equals 1 and v5 equals 3, reset all counters to 0.
Step 14: Stop.
The simulation of the real-time clock (RTC) using Proteus software and an
embedded 'C' program yields successful results. The LCD and DS1307 RTC module
initialize correctly, with the LCD accurately displaying the current time in HH:MM
format, updating every second to reflect real-time changes. This continuous, error-free
operation is facilitated by proper I2C communication between the 80C51 microcontroller
and the RTC module. The project effectively demonstrates the integration of these
components, underscoring the importance of embedded systems in real-time applications
such as digital clocks and time-stamping systems.
In the discussion, it is evident that the effective use of the I2C protocol for data transfer is
crucial for the system's performance. The simulation highlights how embedded systems
can manage real-time data, providing a practical learning experience in microcontroller
programming, peripheral interfacing, and system simulation. Future work could focus on
enhancing the system with additional features like date display, alarms, and timers, testing
the design on physical hardware, implementing error-handling strategies, and developing
a user-friendly interface for setting time and date. This project lays a solid foundation for
developing more robust and feature-rich real-time clock systems.
7. Applications:
Real-time clocks (RTCs) have a wide range of applications across various fields due to
their ability to keep accurate time. Here are some notable applications:
Digital Clocks and Watches:
RTCs are essential components in digital clocks and watches, providing
accurate timekeeping.
Computers and Servers:
RTCs maintain system time and date, even when the computer is powered off,
ensuring correct timestamps for files and logs.
Embedded Systems:
In embedded systems, RTCs are used for scheduling tasks, time-stamping
events, and managing time-based operations.
Consumer Electronics:
Devices such as smartphones, tablets, and smart TVs use RTCs to keep track
of time for alarms, reminders, and scheduled recordings.
Automotive Industry:
RTCs are used in vehicles for timekeeping, managing maintenance schedules,
and in infotainment systems for time-based functions.
Industrial Automation In industrial applications, RTCs help in scheduling
maintenance, logging operational hours, and managing time-dependent processes.
Home Automation:
RTCs enable smart home devices to execute time-based tasks such as turning
on lights, adjusting thermostats, and activating security systems.
Data Logging:
In data loggers, RTCs provide accurate timestamps for recorded data, which is
crucial for analyzing trends and events over time.
Communication Systems:
RTCs are used in communication devices to timestamp messages and logs,
ensuring accurate sequencing and synchronization.
Healthcare Devices:
Medical devices such as infusion pumps and diagnostic equipment use RTCs to
maintain accurate records of patient data and treatment schedules.
Financial Systems:
RTCs ensure accurate timestamps for transactions, ensuring chronological
order and integrity in financial systems.
Power Management:
RTCs help in power management by scheduling the activation and
deactivation of devices to save energy.
By providing reliable timekeeping, RTCs play a critical role in the functionality and
efficiency of numerous applications across different industries.