Venu G
Venu G
Venu G
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATIONS ENGINEERING
By
GURIJALA VENUGOPAL REDDY
Regd. No.: 21781A0474
Under Supervision of
Mr. MAHEEN RASHEED
(Duration: 14TH September ,2023 to 26th October, 2023)
CERTIFICATE
Dr.T.SOMASSOUNDARAM,
Head of the Department,
ECE.
2
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
CERTIFICATE OF INTERNSHIP
3
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
ACKNOWLEDGEMENT
4
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Organization Information:
Internshala is an internship and online training
platform, based in Gurgaon, India. Founded by Sarvesh Agarwal, an IIT
Madras alumunus, in 2011, the website helps students find internships
with organisations in India
About Training:
The Embedded Systems Training by Internshala is a 6-
week online training program in which Internshala innovation aim to
provide you with a comprehensive introduction to Embedded systems.
In this training program, you will learn the basics of embedded
systems , basic microprossers,8086 micro processer,8051
microcontroller, embedded C. This training program has video
tutorials and is packed with assignments, assessment tests, and
practice exercises for you to get a hands-on learning experience.
5
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Modules
Module-1 : Introduction to Embedded systems.
1.1-History of embedded systems.
1.2-Definition of Embedded Systems.
1.3-Components of Embedded Systems.
1.4-Characteristics and Constraints.
1.5-Applications and Industry Relevance.
Module-2: Overview of Architecture of 8051 microcontroller.
2.1-CPU (Central Processing Unit)& Registers
2.2-I/O Ports
2.3-Timers and Counters, Clock Circuitry
2.4-Serial communication
2.5-Interrupts,Instruction Set
Module-3: Memory Organization.
3.1-Internal RAM
3.2-Special function registers
3.3-Program memory(ROM)
3.4-Data memory access, Stack memory
3.5-Addressing modes
Module-4:Addressing modes
4.1-Direct Addressing Mode
4.2-Register Addressing Mode
4.3- Indirect Addressing Mode
4.4- Indexed Addressing Mode
4.5- Bit Addressing Mode
Module-5: Developing and debugging
5.1- Assembly Language Programming
5.2- Integrated Development Environment (IDE)
5.3- Programming Tools and Simulators
5.4- Peripheral Interfacing, Real-Time Debugging
5.5- Emulation and Testing, Code Optimization
5.6- Documentation and Version Control
5.7- Hardware Debugging, Error Handling and Exception Handling
6
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Module-6:Embedded C
6.1- Low-level Programming
6.2- Memory Management
6.3- Data Types and Bitwise Operations
6.4- I/O Handling & Interrupt Handling
6.5- Use of Pointers & Optimization Techniques
Minor Project : Architecture of 8051 Microcontroller
Final Project : Digital Clock using 8051 Microcontroller
7
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
8
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
9
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Final Project
Digital Clock Using 8051 Microcontroller
10
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
12
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
13
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
6. Stack Memory: The 8051 has a hardware stack used for subroutine call and return operations.
The stack pointer (SP) points to the current top of the stack. Stack memory uses the
internal RAM space.
Module-4:Addressing modes
Immediate Addressing Mode: Allows direct specification of data withi the
instruction.
For example, MOV A, #25H loads the accumulator with the immediate
value 25H.
Direct Addressing Mode: Uses a memory address directly in the
instruction.
For instance, MOV A, 30H loads the accumulator with the content of
memory location 30H.
Register Addressing Mode:involves using registers within the
microcontroller.
For instance, MOV A, R0 loads the accumulator with the content of
Register R0.
For example, MOV A, @R0 accesses the data stored at the address
specified in the R0 register.
Indexed Addressing Mode: Allows addressing using a base register plus
an offset.
For instance, MOV A, 20H+DPTR accesses the data at the address formed
by adding 20H to the value in the DPTR (Data Pointer) register.
Bit Addressing Mode:
Used for instructions involving bit manipulation.
For example, CLR C clears the carry flag in the PSW (Program
Status Word) register.
Module-5: Developing and debugging Assembly Language Programming: Understand the 8051
assembly language to write low- level code for the microcontroller. Learn about registers,
memory organization, anc instruction set architecture.
2. Integrated Development Environment (IDE): Utilize an appropriate IDE such as
Keil uVision or SDCC Small Device C Compiler) for coding, assembling, anc
debugging programs.
3. Programming Tools and Simulators: Use programming tools such as ISP (In-System
Programming) or serial programmer to load code onto the 8051. -everage simulators
to test and debug code without using physical hardware, ensuring code accuracy and
functionality.
4. Peripheral Interfacing: Understand how to interface external devices like sensors,
displays, keypads, etc., with the 8051 microcontroller. Learn protocols such as UART,
SPI, 12C for communication with external peripherals.
5. Real-Time Debugging: Employ debugging tools available in the IDE for real- time
debugging of code Use breakpoints, watch variables, step-by-step execution, and
memory inspection for effective debugging.
6. Emulation and Testing: Emulate different scenarios and edge cases to ensure the
robustness of the code Thoroughly test the code for handling various input conditions
and error scenarios.
7. Code Optimization: Optimize code for size and speed to make efficient use of
limited resources in the 8051 microcontroller. Utilize efficient algorithms and
programming techniques to reduce code size and execution time.
8. Documentation and Version Control: Maintain proper documentation for the
codebase including comments and descriptive variable/function names. Implement
version control systems like Git to track changes and manage code versions.
15
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Module-6:Embedded C
Low-level Programming: Embedded C is specifically tailored for embedded systems, allowing
direct interaction with hardware and peripherals, making it a low-level programming language.
2. Memory Management: Understanding memory allocation and management is
crucial due to limited resources in embedded systems. Efficient use of memory is
essential for optimal performance
3. Data Types and Bitwise Operations: Utilization of various data types and bitwise
operations for efficient handling of bits and bytes, which is vital in embedded
programming for tasks like device control and communication
4. 1/0 Handling: Direct manipulation of input/output operations to interface with
external devices, sensors, actuators, etc., using specific registers and ports.
5. Interrupt Handling: Dealing with interrupts efficiently for timely response to
external events, ensuring real-time responsiveness in embedded systems.
6. Optimization Techniques: Writing code that is space- efficient and time-efficient is
critical in embedded systems due to limited resources. Techniques like code
optimization are highly emphasized
7. Use of Pointers: Proficiency in using pointers to access memory locations,
manipulate data, and optimize code for embedded applications.
8. Real-time Constraints: Adhering to real-time constraints and meeting deadlines in
time-sensitive applications ensuring tasks are executed within specified time limits.
16
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
EVOLUTION OF MICROCONTROLLER :
First, microcontroller were developed in the mid-1970s. These were basically calculator-
based processors with small ROM program memories, very limited RAM data memories and a handful
of input/output ports.
The 8051 family was introduced in the early 1980s by Intel. Since its introduction, The
8051 has been one of the most popular microcontrollers and has been second - sourced by the
manufactures. The 8051 currently has many different versions and some types included on-chip
analogue-to-digital converters, a considerable large size of program and data memories.
The Intel MCS-51 ( commonly referred to as 8051 ) is a Harvard architecture, single chip
microcontroller (μ-C) series which was developed by Intel in 1980 for use in embedded systems.
The 8051 architecture provides many functions (CPU, RAM, ROM, I/O, Interrupt Logic, timer, etc.) in
a single package.
17
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
BLOCK DIAGRAM :
18
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
R0 TO R7
REGISTER BANK
10H-17H 2
R0 TO R7 32
Bytes
REGISTER BANK
1 STACK
08H-0FH
R0 TO R7
00H-07H
REGISTER BANK
0
R0 TO R7
19
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
The lower 32 bytes are divided into 4 separate banks. Each register bank has 8 registers of one byte
each . A register bank is selected depending upon two bank select bit in the PSW register as shown
in the above tabular .
Next 16 bytes are bit addressable . In total,128 bits (16X8) are available in
addressable area . Each bit can be accessed and modified by suitable instructions.
The bit addresses are from 00H(LSB of the first byte in 20H) to 2FH(MSB of the
last byte in 2FH).
Remaining 80 bytes of RAM (30H TO 7FH) are available for general purpose.
ACCUMULATOR(ACC) :
Operand register
Implicit or specified in the instruction
20
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
A F R R O - P
C C 0 S S V
Y 1 0 R
Purpose.
R
E
G A
I D
S D
R R
T R
S S
E E
1 0
R S
B S
A
N
K
0
0
H
0 0 0 –
0
7
H
0
8
H
0 1 1 –
0
F
H
1
0
1 0 2 H
–
1
22
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
7
H
1
8
H
1 1 3 –
1
F
H
BITS OF PSW REGISTER
Timer Registers :
for Timer 0(16 bit register - TLO & THO) and for timer 1 (16 bit register- TL1 &TH1)
Four addresses allotted in SFR.
Control Registers :
Control register are IP,IE,TMOD,TCON,SCON ,and PCON .These register contain
control and status information for interrupts ,timer /counters and serial port. Allowed separated
address in SFR .
Instruction Register :
Decodes the opcode and gives information to timing and control unit .
RAM & RAM ADDRESS REGISTER :
provide internal 128 bytes RAM and a mechanism to address internally .
ALU : perform 8 bit arithmetic and logical operation over the operands held by
TEMP1 TEMP 2. User cannot access temporary registers.
Drivers :
23
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Each I/O port allotted a latch and a driver Latches allotted address in SFR
. User can communicate via these ports P0,P1,P2,andP3 .
ARCHITECTURE
ALU : perform 8 bit arithmetic and logical operation over the operands held by
TEMP1 TEMP 2. User cannot access temporary registers.
PINS 1 TO 8 :
These pins are known as port 1. This port doesn’t serve any other functions .It is
internally pulled up ,bi-direction I/O port.
PIN 9 :
25
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
It is a RESET pin ,which is used to reset the microcontroller to its initial values .
PINS 10 TO 17 :
These pins are known as port 3. This port serve some alternate functions like
interrupts , timer input ,control signals, serial communication signals Rx D and Tx D etc.
P3.0 Rx D 10
P3.1 Tx D 11
P3.2 INT0 12
P3.3 INT1 13
P3.4 T0 14
P3.5 T1 15
P3.6 WR 16
P3.7 RD 17
PINS 18 & 19 :
These pins are used for interfacing an external crystal to get system clock.
PIN 20 :
These pin the power supply to the circuit .
PIN 21 to 28 :
26
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
These pins are known as port2 . It serves as I/O port. Higher order address bus signals are also
multiplexing using this port .
PIN 29 :
This is PSEN pin which stands for program store Enable . It is used to read a signal from the
external program memory.
PIN 30 :
This is EA pin which stands for External Access input . it is used to enable/disable the external
memory interfacing.
PIN 31 :
This is ALE pin which stands for address latch Enable . It is used to demultiplex the address
– data signal of port.
PINS 32 TO 39 :
These pins are known as port 0.It serves as I/O port .Lower order address and data bus signals
are multiplexed using this port.
PIN 40 :
This pin is used to provide power supply to the circuit.
In our last tutorial, we were seen How to Interface LED and Switch. So today
we are going to see LCD interfacing with an 8051 Microcontroller. Before
Interfacing, we should know something about that module. Let’s start.
We always use devices made up of Liquid Crystal Displays (LCDs) like
computers, digital watches, and also DVD and CD players. They have
become very common and have taken a giant leap in the screen industry by
clearly replacing the use of Cathode Ray Tubes (CRT). CRT draws more
power than LCD and is also bigger and heavier. All of us have seen an LCD,
but no one knows the exact working of it. Let us take a look at the working of
27
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
an LCD.
Here we are using alphanumeric LCD 16×2. A 16×2 LCD display is a very
basic module and is very commonly used in various devices and circuits.
These modules are preferred over seven segments and other
multi-segment LEDs. The reasons being: LCDs are economical; easily
programmable; have no limitation of displaying special & even custom
characters (unlike in seven segments), animations, and so on. A 16×2 LCD means it
can display 16 characters per line and there are 2
such lines. In this LCD each character is displayed in a 5×7 pixel matrix. This
LCD has two registers, namely, Command and Data. The command register
stores the command instructions given to the LCD.
A command is an instruction given to LCD to do a predefined task like
initializing it, clearing its screen, setting the cursor position, controlling
display, etc. The data register stores the data to be displayed on the LCD.
28
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
The data is the ASCII value of the character to be displayed on the LCD.
The LCD display module requires 3 control lines as well as either 4 or 8 I/O
lines for the data bus. The user may select whether the LCD is to operate
with a 4-bit data bus or an 8-bit data bus.
If a 4-bit data bus is used the LCD will require a total of 7 data lines (3
control lines plus the 4 lines for the data bus). If an 8-bit data bus is used the
LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the
29
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
data bus).
The LCD display module requires 3 control lines as well as either 4 or 8 I/O
lines for the data bus. The user may select whether the LCD is to operate
with a 4-bit data bus or an 8-bit data bus.
If a 4-bit data bus is used the LCD will require a total of 7 data lines (3
control lines plus the 4 lines for the data bus). If an 8-bit data bus is used the
LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the
data bus).
The RS line is the “Register Select” line. When RS is low (0), the data is to
be treated as a command or special instruction (such as clear screen,
position cursor, etc.). When RS is high (1), the data being sent is text data
which should be displayed on the screen. For example, to display the letter
“T” on the screen you would set RS high.
The line is the “Read/Write” control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high
(1), the program is effectively querying (or reading) the LCD. Only one
instruction (“Get LCD status”) is a read command. All others are write
30
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
31
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Firstly circuit will be initialized by declaring ports as inputs or outputs. P1, P2 are
used as output ports. P3 lower bits are used as outputs while upper bits as
32
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
inputs.
All columns are given high logic and all rows are given low logic.
col1=1;
col2=1;
col3=1;
row1=row2=row3=row4=0;
Externally, when any keypad button is pressed, specific column output goes low.
Check each column for it.
row1=row2=row3=row4=1;
row1=0;
delay(5000000); led = 0;
row1=1;
row2=0;
delay(5000000); led
row2=1;
row3=0;
led = 0;
row3=1;
row4=0;
34
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
led = 0;
row4=1;
8051 microcontrollers have two timers/counters which work on the clock frequency.
Timer/counter can be used for time delay generation, counting external events, etc.
Timer/Counter
Clock
Every Timer needs a clock to work, and 8051 provides it from an external crystal
which is the main clock source for Timer. The internal circuitry in the 8051
microcontrollers provides a clock source to the timers which is 1/12th of the
frequency of crystal attached to the microcontroller, also called Machine cycle
frequency.
Timer/Counter
8051 has a Timer Mode Register and Timer Control Register for selecting a mode of
operation and controlling purpose.
Both Timer 0 and Timer 1 use the same register to set the various timer operation
modes. It is an 8-bit register in which the lower 4 bits are set aside for Timer 0 and
the upper four bits for Timers. In each case, the lower 2 bits are used to set the timer
35
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
mode in advance and the upper 2 bits are used to specify the location. Two methods of serial
communication are
8051 has built-in UART with RXD (serial data receive pin) and TXD (serial
data transmit pin) on PORT3.0 and PORT3.1 respectively.
START bit: It is a bit with which serial communication starts and it is always
low.
Data bits packet: Data bits can be 5 to 9 bits packet. Normally we use 8
data bit packet, which is always sent after the START bit.
STOP bit: This is one or two bits. It is sent after the data bits packet to
indicate the end of the frame. The stop bit is always logic high.
In User mode, a restricted form of the CPSR called the Application Program
Status Register (APSR) is accessed instead.
The current processor state, that is, ARM, Thumb, ThumbEE, or Jazelle.
The endianness.
Many programmers writing at the application level have little need to code in
assembly language. However, knowledge of assembly code can be useful in
cases where highly optimized code is required, when writing compilers, or
where low level use of features not directly available in C is required.
37
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
8051 microcontrollers have two timers/counters which work on the clock frequency.
Timer/counter can be used for time delay generation, counting external events, etc.
Timer/Counter
Clock
Every Timer needs a clock to work, and 8051 provides it from an external crystal
which is the main clock source for Timer. The internal circuitry in the 8051
microcontrollers provides a clock source to the timers which is 1/12th of the
frequency of crystal attached to the microcontroller, also called Machine cycle
frequency.
Timer/Counter
8051 has a Timer Mode Register and Timer Control Register for selecting a mode of
operation and controlling purpose.
Both Timer 0 and Timer 1 use the same register to set the various timer operation
modes. It is an 8-bit register in which the lower 4 bits are set aside for Timer 0 and
the upper four bits for Timers. In each case, the lower 2 bits are used to set the timer
38
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
mode in advance and the upper 2 bits are used to specify the location.
Assembly language is a low-level programming language. There is in
general a one-to-one relationship between assembly language instructions
(mnemonics) and the actual binary opcode executed by the processor.
Many programmers writing at the application level have little need to code in
assembly language. However, knowledge of assembly code can be useful in
cases where highly optimized code is required, when writing compilers, or
where low level use of features not directly available in C is required.
8051 MICRONTOLLER IC
39
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
A PROJECT REPORT ON
40
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
ABSTRACT
This project aims to design and implement a digital clock using the 8051 microcontroller. The digital
clock displays the current time in hours, minutes, and seconds on a set of 7-segment displays. It includes
functionality for setting the time using push buttons and accurately keeps track of time using timer
interrupts.
INTRODUCTION
The primary objective of this project is to create a functional digital clock using the 8051 microcontroller.
The clock should display the current time, allow for time adjustment through push buttons, and maintain
accurate timekeeping.
A digital clock using a microcontroller is a modern timekeeping device that utilizes a microcontroller, a
small computing device, to accurately display and update the current time. Here's a brief explanation of
how it works.
Microcontroller: The heart of the digital clock is a microcontroller, such as an Arduino or PIC, which is
programmed to perform specific tasks, including timekeeping.
41
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Real-Time Clock (RTC) Module: To maintain accurate time, the clock often employs an RTC module. This
module includes a dedicated clock crystal and circuitry to track time independently of the
microcontroller.
Display: Digital clocks commonly use LED, LCD, or OLED displays to show the time in a
userfriendly format, such as hours and minutes. Some may also display seconds, date, or other
information.
User Interface: Depending on the design, the clock may feature buttons, a touchscreen, or even voice
commands to set the time and customize settings.
Programming: The microcontroller is programmed to read the time from the RTC module and update the
display accordingly. It also manages other functionalities, like alarm settings, time formats, and daylight-
saving adjustments.
Power Supply: The clock is typically powered by a battery or an external power source, depending on
whether it's intended for portable or stationary use.
Accuracy: Thanks to the RTC module, digital clocks can maintain precise timekeeping, even in the
absence of a continuous power supply. Some clocks synchronize with internet time servers for even
greater accuracy.
8051 Microcontroller
42
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Push Buttons
Jumper Wires
Battery or Adapter
REAL-TIME CLOCK
BLOCK DIAGRAM
43
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
REGULATED
POWER SUPPLY
REAL TIME
CLOCK
8051
LCD
MICROCONTROLLER DISIPLAY
PUSH
BUTTONS
44
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
CIRCUIT DIAGRAM
PROGRAM
45
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
#include<reg51.h>
#include<absacc.h>
#define dataport P2
#define port P1 #define lcdport P3 sbit reset = port^0; sbit rs = port^1; sbit rw = port^2;
sbit e = port^3; sbit dig_hr1 = port^4; sbit dig_min1 = port^5; sbit start = port^6; int min1
= 0, hr1 = 0; int min0 = 60, hr0 = 25; unsigned char temp = 60 , hr , min , sec , num[ 60]
0X03 , 0X04 , 0X05 , 0X06 , 0X07 , 0X08 , 0X09 , 0X10 , 0X11 , 0X12,
0X13 , 0X14 , 0X15 , 0X16 , 0X17 , 0X18 , 0X19 , 0X2O , 0X21 , 0X22,
0X33, 0X34 , 0X35 , 0X36 , 0X37 , 0X38 , 0X39 , 0X40 , 0X41 , 0X42,
0X53 , 0X54 , 0X55 , 0X56 , 0X57 , 0X58 , 0X59}; void delay(unsigned int msec
{
Int i , j ; for (i=0 ; i < msec ;
i++)
{ dataport = item ; rs =
0; rw = 0 ; e=1;
delay(1) ; e =0 ; return
46
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
{ dataport = item ; rs = 1 ; rw = 0 ; e =
! = ‘\ 0’)
{ lcd_data (str [ i ]
); i++ ; delay
( 1) ; } return ;
} lcd_int(int time_val)
time_val/10 ;
lcd_data(int_amt+48); int_amt =
lcd_cmd(0x38);
delay ( 5 ) ;
; lcd_cmd(0x80) ; delay
47
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
} void set_hr 1( )
{ hr1++;
if(hr1>23) hr 1
= 0 ;
lcd_cmd(0xc3); lcd_int(hr
1) ; lcd_data( ‘:’)
set_min1( )
{ min1++ ; if
(min1>59) min1 = 0 ;
lcd_cmd(0xc6) ; lcd_int(min1)
; min0 = min 1 ;
{ lcd_cmd(0x01);
if
(start==0);
{
lcd_string(“ SET TIMING”) ; lcd_cmd(0xc3) ;
lcd_int(hr 1)
lcd_data(‘:’) ; lcd_int(min1);
while(start==0)
{ delay(10);
if(dig_hr 1 == 0) set_hr1( ) ;
if(dig_min1==0) set_min1( )
48
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
} }
lcd_cmd(0x01) ; hr = num [ hr 1]
set_rtc_time( ) ; lcd_cmd(0x80) ;
lcd_string(“TIME : ”) ; hr0 = 25 ;
min = 60 ;
}
bcdconv( unsigned char mybyte )
lcd_data( y) ; lcd_data
( x) ;
}
void read_rtc_display( )
{
XBYTE[ 11]=0x02 ; hr =
XBYTE[ 4] ; lcd_cmd(0x85);
{ bcdconv(hr) ;
lcd_data(‘:’) ; hr0 = hr ;
} min = XBYTE [ 2 ]; {
bcdconv( min) ;
lcd_data( ‘:’ ) ; } sec=
= 1; lcd ( ) ;
XBYTE[ ] = 0x20 ;
XBYTE[ ] = 0xFF ;
XBYTE[ ] = 0xFF ;
49
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
XBYTE[ ] = 0xFF ;
XBYTE[ ] = 0x02 ;
lcd_cmd(0x01) ; IE = 0x84 ;
lcd_cmd(0x80) ; lcd_string(“
TIME”) ; while ( 1 )
{
read_rtc_display( ) ;
}
PROCEDURE :
1. Initially burn the program to the 8051 microcontroller
2. Now give the connections as per the circuit diagram.
3. Switch on the board supply.
4. Now you can observe the time on LCD. If you want to set the time make the start pin low and
press the push button connected to the P3.3.
5. LCD shows set time message. Now use push button which is connected to P1.4 to set hours
and use other push button to set minutes.
6. Now make start pin high to run the clock.
APPLICATIONS
Home Automation: Use the digital clock to control lights, thermostats, and appliances at specific times,
making it an integral part of a home automation system.
Public Transportation: Digital clocks at bus stops or train stations can display arrival and departure times,
helping commuters plan their journeys.
Sports Timing: Digital clocks are commonly used in sports events to time races, matches, and games
accurately.
Industrial Control: In manufacturing environments, digital clocks are crucial for synchronizing
operations and scheduling production runs.
Laboratories: Digital clocks in research laboratories help scientists and researchers time experiments and
record data.
50
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
Public Spaces: Digital clocks in parks, airports, and other public spaces provide a convenient way for
people to check the time.
Traffic Management: Digital clocks can be integrated into traffic light systems to synchronize traffic flow
and control signals.
Public Safety: In emergency response centers, digital clocks are used to coordinate responses and track
the timing of critical event .
We can also set the Alarm , Countdown timer , Stopwatch , Date display , Temperature and
Humidity , Remainders , etc.., in this project with little modification .
CONCLUSION
The project of designing a digital clock using the 8051
microcontroller has provided a valuable learning experience and a practical application
of microcontroller programming and electronics. This project has successfully
demonstrated .
51
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
CONCLUSION
During this internship, I engaged deeply with embedded systems, gaining practical
experience in coding, debugging, and optimizing code for resource-constrained
environments. I successfully contributed to real-world projects, applying theoretical
knowledge to solve challenges effectively. The internship provided an invaluable
platform to enhance my understanding of hardware-software interactions and
embedded system intricacies. Through collaborative efforts and mentorship, I refined
my skills in firmware development, testing methodologies, and troubleshooting
techniques. Overall, this internship solidified my passion for embedded systems,
equipping me with practical skills and a comprehensive understanding essential for
future endeavors in this dynamic field.
An internship in embedded systems has been an illuminating journey, providing a
hands-on experience and an in-depth understanding of the intricate world of hardware
and software integration. This internship has been a comprehensive immersion into
the practical applications of embedded systems, allowing me to grasp
fundamentalconcepts and employ them in real-world scenarios Throughout this
internship, I engaged in diverse tasks that sharpened my technical prowess. From
coding low-level functionalities to designing efficient algorithms, I've grown adept at
optimizing embedded systems for performance and reliability. Working on various
projects, I honed my skills in debugging, testing, and troubleshooting, crucial facets
in ensuring the robustness of embedded systems. Moreover, collaborating within
multidisciplinary teams exposed me to different perspectives, fostering adaptability
and enhancing my communication skills. Understanding the synergy between
hardware and software components,I learned to synchronize their functionalities to
achieve seamless operations, reflecting a holistic approach essential in embedded
system development. The challenges faced during this internship were invaluable
lessons. Addressing complex problems and devising innovative solutions instilled
resilience and resourcefulness. These challenges were opportunities for growth,
pushing me to think critically and creatively, ultimately enhancing my problem-
solving abilities.
As I reflect on this internship, I recognize the exponential growth in my technical
acumen and the invaluable insights gained into the realm of embedded systems. The
hands-on experience, coupled with theoretical knowledge, has fortified my foundation
52
DEPARTMENT OF ECE SVCET(A),CHITTOOR
EMBEDDED SYSTEMS
and fueled my passion to pursue a career in this dynamic field. 'm eager to leverage
these experiences and contribute meaningfully to the innovative landscape of
embedded systems in the future.
REFERENCES
• https://www.geeksforgeeks.org/introduction-of-
embeddedsystems-set-1/?id=discuss
• https://www.tutorialspoint.com/microprocessor/microcontrollers
_8051_architecture.htm#:~:text=8051%20microcontroller%20is
%20designed%20by,addressable%20as%20per%20the%20requi
rement.
• http://download.mikroe.com/documents/compilers/mikroc/8051/
help/8051_memory_organization.htm#:~:text=The%208051%2
0microcontroller's%20memory%20is,keeping%20intermediate
%20results%20and%20variables.
• https://embetronicx.com/tutorials/microcontrollers/8051/8051ua
rt-tutorial-serial-communication/
• https://www.electronicwings.com/8051/4x4-keypad-
interfacingwith-8051
• https://en.wikipedia.org/wiki/Embedded_system
53
DEPARTMENT OF ECE SVCET(A),CHITTOOR