0% found this document useful (0 votes)
9 views

Microcontroller_Project_report_final last

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

Microcontroller_Project_report_final last

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

Bapuji Educational Association®

BAPUJI INSTITUTE OF ENGINEERING AND


TECHNOLOGY,DAVANGERE 577004

Course Project Report on

Simulation of Real Time Clock using Proteus Software &


Embedded 'C'

Program

Course : Microcontroller Course Code :

BEC405A Submitted by
4BD22EC089 Shravan B G

4BD22EC091 Shreyas M S

4BD22EC101 Sudarshan M Kadekar

4BD22EC105 T E Jyothi Theertha

Dr. Leela G.H. Dr. G.S. Sunitha


Course Project Guide Program Coordinator

Department of Electronics& Communication

Engineering

2023-2024
SIMULTION OF REAL TIME CLOCK

INDEX

Sl.No Content Page No


1 Introduction 2

2 Circuit diagram and Pin diagram 3

3 Explanation 4

4 Program 5

5 Algorithm/Flowchart 11

6 Results and Discussion 12

7 Applications 12

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

1. Introduction :

Real Time Clock:


A Real-Time Clock (RTC) is a critical component in modern electronic devices, responsible
for keeping accurate and precise time and date information. Found in everything from
smartphones and computers to embedded systems and IoT devices, RTCs play a vital role in
synchronizing and coordinating various system functions, ensuring that events occur at the
correct moment. With the ability to maintain timekeeping even when power is turned off,
RTCs have become an indispensable element in today's technology landscape. In this
[article/section], we will delve into the world of Real-Time Clocks, exploring their
functionality, applications, and importance in our increasingly time- dependent world

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.

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

2. Circuit Diagram

Fig.1.1: Real time clock circuit

Pin Diagram of 80C51

Fig 1.2:Pin diagram of 8051 Microcontroller

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

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).

Here's a detailed explanation of the connections:

LCD Display (LCD1) Connections:


 Pins 1 (VSS) and 2 (VDD): These are the power supply pins for the LCD. VSS
is connected to ground, and VDD is connected to +5V.

 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.

Microcontroller (U1) Connections :

 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).

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

 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.

RTC Module (U2) Connections:


 Pin 1 (SCL): This is the Serial Clock pin, connected to the SCL line of the I2C bus.
 Pin 2 (SDA): This is the Serial Data pin, connected to the SDA line of the I2C bus.
 Pins 3-4 (SOUT, VBAT): These pins are connected to the battery and serial
output (not shown in the diagram).
 Pin 5 (GND): Connected to ground.
 Pin 6 (VCC): Connected to +5V.
 Pin 7 (TXD): Connected to the RXD pin of the microcontroller (P3.0).
 Pin 8 (RXD): Connected to the TXD pin of the microcontroller (P3.1).

Crystal Oscillator (X1) Connections:


 Pin 1: Connected to XTAL1 (Pin 19) of the microcontroller.
 Pin 2: Connected to XTAL2 (Pin 18) of the microcontroller.

Resistors (R1 and R2):


 R1 and R2 (4.7k ohms): Pull-up resistors connected to the I2C lines (SCL and
SDA) to ensure proper logic levels.

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.

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

4. Program :

#include <reg51.h>

// Define constants for delay and counter values


#define DELAY_COUNT 100
#define COUNTER_MAX 10

// Declare an array with byte-sized values


unsigned char arr[10] = {0x40, 0xF9, 0x24, 0x30, 0x19, 0x12, 0x02, 0xF8, 0x00, 0x10};

// Declare single-bit variables (sbit) for accessing specific bits on port P1


sbit d4 = P1^0; // Bit 0 on port P1
sbit d3 = P1^1; // Bit 1 on port P1
sbit d2 = P1^2; // Bit 2 on port P1
sbit d1 = P1^3; // Bit 3 on port P1
sbit d0 = P1^4; // Bit 4 on port P1
sbit d = P1^5; // Bit 5 on port P1

// Declare unsigned integer variables for counter values


unsigned int v1, v2, v3, v4, v0, v5, v6;

// Define a delay function with a single parameter 'count'


void delay(unsigned int count) {
unsigned int j;
for (j = 0; j < count; j++) {
// Busy-wait loop with a fixed number of iterations
unsigned int k;
for (k = 0; k < 100; k++);
}
}

// Main function
void main() {
// Initialize counter variables to 0

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

v1 = v2 = v3 = v4 = v0 = v5 = v6 = 0;

// Infinite loop with a break condition


while (1) {
// Increment v0 and check if it reaches COUNTER_MAX
v0++;
if (v0 >= COUNTER_MAX) {
// Reset v0 to 0 and increment v1
v0 = 0;
v1++;
}

// Set port P2 to all 1s (0xFF)


P2 = 0xFF;
// Set bit d to 1, and clear other bits on port P1
d = 1;
d3 = d2 = d4 = d0 = d1 = 0;
// Output value of arr[v1] to port P2 (cast to byte)
P2 = (unsigned char)arr[v1];
// Call delay function with DELAY_COUNT as argument
delay(DELAY_COUNT);

// Check if v1 reaches COUNTER_MAX, and if so, reset v1 and increment v2


if (v1 >= COUNTER_MAX) {
v1 = 0; v2+
+;
}

// Repeat similar logic for v2 to v6, with some variations


// ...

// Special condition to reset all counters when v6 reaches 1 and v5 reaches

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

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.

6. Results and discussions:

Fig.1.3:Result circuit pannel of Real Time Clock

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

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:

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

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.

Dept. of E&CE, BIET, Davangere


SIMULTION OF REAL TIME CLOCK

Dept. of E&CE, BIET, Davangere

You might also like