SISTec Major Project Report on Digital Calender With Embedded System
-
Upload
ukpandey25 -
Category
Documents
-
view
222 -
download
4
Transcript of SISTec Major Project Report on Digital Calender With Embedded System
AMajor Project Report on
Digital Calendar Using Embedded System
Submitted toRAJIV GANDHI TECHNICAL UNIVERSITY, BHOPAL (M.P)
In Partial fulfillment for award of degree ofBACHELOR OF ENGINEERING
INELECTRONICS & COMMUNICATION ENGINEERING
By RASHMI PATWA (0187EC101083) RAGINI RAWAT (0187EC101079) VAISHALI SHARMA (0187EC101113) GARIMA SHRIVASTAVA (0187EC113D01)
Under the Guidance of
Mr. PANKAJ VYASASSOCIATE PROFESSOR
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
SAGAR INSTITUTE OF SCIENCE &TECHNOLOGY (SISTec) GANDHI NAGAR, BHOPAL-462036 (M.P.)
MAY-2014
1
SAGAR INSTITUTE OF SCIENCE AND TECHNOLOGY(Approved by AICTE Delhi, Affiliated to RGTU Bhopal and Govt. of Madhya Pradesh)
NEAR AIRPORT, GANDHI NAGAR, BHOPAL-462036
Declaration
We hereby declare that the project entitled“DIGITAL CALENDAR &
TEMPERATURE INDICATOR USING EMBEDDED SYSTEM”is the actual
work carried out by us in the department of “ELECTRONICS & COMMUNICATION ENGINEERING” under the guidance of “Mr. PANKAJ VYAS, ASSOCIATE PROFESSOR.
Name Enrollment Number Signature
RASHMI PATWA 0187EC101083RAGINI RAWAT 0187EC101079VAISHALI SHARMA 0187EC101113GARIMA SHRIVASTAVA 0187EC113D01
SAGAR INSTITUTE OF SCIENCE AND TECHNOLOGY(Approved by AICTE Delhi, Affiliated to RGTU Bhopal and Govt. of Madhya Pradesh)
NEAR AIRPORT, GANDHI NAGAR, BHOPAL-462036
CERTIFICATE
This is to certify that the project entitled DIGITAL CALENDAR &
TEMPERATURE INDICATOR USING EMBEDDED SYSTEMhas been
carried out by RASHMI PATWA with (0187EC101083)
RAGINI RAWAT with (0187EC101079)
VAISHALI SHARMA with (0187EC101113)
GARIMA SHRIVASTAVA with (0187EC113D01)
Under my guidance in partial fulfillment for the award of (BACHELOR OF
ENGINEERING) in ELECTRONICS & COMMUNICATION ENGINEERING
by the Rajiv Gandhi Technical University, Bhopal (M.P.), during the academic
year 2013-14.
(Dr. Ravi Shankar Mishra) (Mr. PankajVyas)
Prof. &HeadofDepartment Associate Professor
Electronics & Communication Engineering Project Guide
(Dr. Manish Billore)Principal
ACKNOWLEDGEMENT
It gives me a great pleasure to express my deep sense of gratitude and indebtedness to
my guide Mr. PankajVyasfor their valuable support and encouraging mentally
throughout the project. I am highly obliged to them for providing me this opportunity to
carry out their ideas and work during my project period and helping me to gain the
successful completion of my Project.
My special thanks to Dr. Ravi Shankar Mishra ,Prof. &Head of the Department of
Electronics & Communication Engineering of my college, and to all of the faculties for
allowing me and encouraging me constantly to work hard in project.
I am highly grateful to Dr. Manish Billore, the Honorable principle of SISTec, for giving
me this golden opportunity to be a part of this organization for this period.
Name Enrollment Number Signature
RASHMI PATWA 0187EC101083RAGINI RAWAT 0187EC101079VAISHALI SHARMA 0187EC101113GARIMA SHRIVASTAVA 0187EC113D01
INDEX
Contents Page no.Abstract.........................................................................................................IList ofFigures..............................................................................................IIList of Tables................................................................................................III
1. INTRODUCTION
1.1 Introduction of Embedded System............................................1
1.2 Block Diagram …………………….............................................2
2. LITERATURE REVIEW
2.1 Review of Micro-controllers.........................................................8
3. METHODOLOGIES
3.1 Circuit Diagram.........................................................................12
3.2 LCD...........................................................................................13
3.3 Power Supply……….…………………………………….………..13
3.4 PIN Diagram
3.4.1 8051 PIN Diagram.........................................................14
3.4.2 ADC PIN Diagram……...................................................17
3.5 Component List
3.5.1 Micro-controller (AT89S52).............................................19
3.5.2 Temperature Sensor.......................................................19
3.5.3 ADC ………………………….………….……..…………….21
3.5.4 Voltage Regulator...................................................…...22
3.5.5LED..................................................................................23
3.5.6 Capacitor………..............................................................23
3.5.7Resistor ………………..…………….…….………………..…..24
3.5.8 Software Requirement...........................................................25
3.6Programming....................................................................................26
4. RESULT & DISCUSSION
4.1Result…………………………………………………………….…42
5. CONCLUSION & RECOMMENDATION
5.1 Conclusion......................................... ............................43
5.2 Future Scope..................................................................43
6. REFERENCES........................................................................................44
ABSTRACT
This project is developed for the users to use a digital calendar and temperature
indicator. Anembedded system is a computer system with a dedicated function within a
larger mechanical or electrical system, often with real-time computing constraints It is
embedded as part of a complete device often including hardware and mechanical parts.
By contrast, a general-purpose computer, such as a personal computer (PC), is
designed to be flexible and to meet a wide range of end-user needs. Embedded
systems control many devices in common use today.
The main parts of this project are key pad, microcontroller unit and LCD display. In
normal operation mode, the LCD display displays the Current time, date and day like an
ordinary calendar. Also indicatethe updatedtemperature. The user can set the time, date
and day using the key pad. When the user sets the timings, the settings will be
displayed in the LCD display. The settings are stored in the microcontroller memory.
The most commonly used set of microcontrollers belong to 8051 Family. 8051
Microcontrollers continue to remain a preferred choice for a vast community of
hobbyists and professionals. We used AT89S52 microcontroller of 8051 series and
LM35 IC for temperature indicator.
When the function key is turned on, the microcontroller sends data to the LCD display to
display the current time, date and day. If necessary, the user can modify the settings
using the key pad. This project is very cheap and compact. Since microcontroller is
used, the operations will be very accurate. The microcontroller program is written in
embedded c.
I
LIST OF FIGURES
Contents Page no.Fig 1.1..............................................................................................................2Fig 1.2..............................................................................................................5Fig 1.3..............................................................................................................6Fig 1.4..............................................................................................................7Fig 2.1..............................................................................................................8Fig 3.1............................................................................................................12Fig 3.2............................................................................................................13Fig 3.3............................................................................................................14Fig 3.4............................................................................................................17Fig 3.5............................................................................................................21Fig 3.6............................................................................................................22Fig 3.7............................................................................................................23Fig 3.8............................................................................................................24Fig 3.9............................................................................................................24
II
LIST OF TABLES
Contents Page no.Table no.2.1........................................................................................................9Table no.2.2.......................................................................................................10Table no.2.3.......................................................................................................11Table no. 2.4.....................................................................................................11Tablno.3.1.........................................................................................................18Table no.3.2......................................................................................................22
III
CHAPTER 1 INTRODUCTION
1.1 INTRODUCTION OF EMBEDDED SYSTEM
An embedded system is a computer system with a dedicated function within a larger
mechanical or electrical system, often with real-time computing constraints It is
embedded as part of a complete device often including hardware and mechanical parts.
By contrast, a general-purpose computer, such as a personal computer (PC), is
designed to be flexible and to meet a wide range of end-user needs. Embedded
systems control many devices in common use today.
Modern embedded systems are often based on microcontrollers (i.e. CPUs with
integrated memory and/or peripheral interfaces) but ordinary microprocessors (using
external chips for memory and peripheral interface circuits) are also still common,
especially in more complex systems. In either case, the processor(s) used may be types
ranging from rather general purpose to very specialized in certain class of
computations, or even custom designed for the application at hand. A common standard
class of dedicated processors is the digital signal processor (DSP).
The key characteristic, however, is being dedicated to handle a particular task. Since
the embedded system is dedicated to specific tasks, design engineers can optimize it to
reduce the size and cost of the product and increase the reliability and performance.
Some embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, and
largely complex systems like hybrid vehicles, MRI, and avionics. Complexity varies from
low, with a single microcontroller chip, to very high with multiple units, peripherals and
networks mounted inside a large chassis or enclosure.
1.2 BLOCK DIAGRAM
Fig.1.1
Description of Digital Calendar and Temperature Indicator
POWER SUPPLY
OSCILLATOR
ADC
TEMPERATURE SENSOR
8051 MICRO-CONTROLLER
LCD
KEYPAD
POWER SUPPLY
The Entire Project needs power for its operation. However, from the study of this project
it comes to know that we supposed to design 5v and 12v dc power supply. So by
utilizing the following power supply components required power has been gained.
(230/12v (1A and 500mA) – Step down transformers, full wave rectifier to converter ac
to dc, booster capacitor and +5v (7805) and +12v (7812) regulator to maintain constant
5v & 12 supply for the controller circuit and driver circuit.
MICROCONTROLLER
The Intel 8051 microcontroller is one of the most popular general purpose
microcontrollers in use today. The success of the Intel 8051 spawned a number of
clones which are collectively referred to as the MCS-51family of microcontrollers, which
includes chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments.
The Intel 8051 is an 8-bit microcontroller which means that most available operations
are limited to 8 bits.
There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and
Standard chips are often available in DIP (dual in-line package) form, but the Extended
8051 models often have a different form factor, and are not "drop-in compatible”. All
these things are called 8051 because they can all be programmed using 8051 assembly
language, and they all 64 KB on chip program memory.128 bytes on chip data memory
(RAM).
TEMPERATURE SENSOR
An analog temperature sensor is pretty easy to explain, it's a chip that tells you what the
ambient temperature. These sensors use a solid-state technique to determine the
temperature. That is to say, they don't use mercury (like old thermometers), bimetallic
Strips (like in some home thermometers or stoves), nor do they use thermostats.
Instead, they use the fact as temperature increases, the voltage across a diode
increases at a known rate.
Technically, this is actually the voltage drop between the base and emitter of a
transistor. By precisely amplifying the voltage change, it is easy to generate an analog
signal that is directly proportional to temperature. There have been some improvements
on the technique but, essentially that is how temperature is measured. Because these
sensors have no moving parts, they are precise, never wear out, don't need calibration,
work under many environmental conditions, and are consistent between sensors and
readings.
Moreover they are very inexpensive and quite easy to use. These stats are for the
temperature in the Ad fruit shop, the Analog Devices TMP36 (-40 to 150C). It’s very
similar to the LM35/TMP35 (Celsius output) and LM34/TMP34 (Fahrenheit output). The
reason we went with the '36 instead of the '35 or '34 is that this sensor has a very wide
range and doesn't require a negative voltage to read sub-zero temperatures. Otherwise,
the functionality is basically the same.
CRYSTAL OSCILLATOR
A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance
of a vibrating crystal of piezoelectric material to create an electrical signal with a very
precise frequency.
This frequency is commonly used to keep track of time (as in quartz wristwatches), to
provide a stable clock signal for digital integrated circuits, and to stabilize frequencies
for radio transmitters and receivers. The most common type of piezoelectric resonator
used is the quartz crystal, so oscillator circuits incorporating them became known as
crystal oscillators,[1] but other piezoelectric materials including polycrystalline ceramics
are used in similar circuits.
Fig 1.2
LCD (16*2)
A liquid-crystal display (LCD) is a flat panel display, electronic visual display, or video
display that uses the light modulating properties of liquid crystals. Liquid crystals do not
emit light directly. LCDs are available to display arbitrary images (as in a general-
purpose computer display) or fixed images which can be displayed or hidden, such as
preset words, digits, and 7-segment displays as in a clock. They use the same basic
technology, except that arbitrary images are made up of a large number of small pixels,
while other displays have larger elements.
LCDs are used in a wide range of applications including computer monitors, televisions,
instrument panels, aircraft cockpit displays, and signage. They are common in
consumer devices such as video players, gaming devices, clocks, watches, calculators,
and telephones, and have replaced cathode ray tube (CRT) displays in most
applications.
Fig 1.3
They are available in a wider range of screen sizes than CRT and plasma displays, and
since they do not use phosphors, they do not suffer image burn-in. LCDs are, however,
susceptible to image persistence.
ADC 0804
These are used to take analog input from sensors or dividers. Like a Sharp distance
sensor feeds μC with analog voltage corresponding to distance from obstacle.Analog to
digital converters find huge application as an intermediate device to convert the signals
from analog to digital form. These digital signals are used for further processing by the
digital processors. Various sensors like temperature, pressure, force etc. convert the
physical characteristics into electrical signals that are analog in nature.
ADC0804 is a very commonly used 8-bit analog to digital convertor. It is a single
channel IC, i.e., it can take only one analog signal as input. The digital outputs vary from
0 to a maximum of 255. The step size can be adjusted by setting the reference voltage
at pin9. When this pin is not connected, the default reference voltage is the operating
voltage, i.e., Vcc. The step size at 5V is 19.53mV (5V/255), i.e., for every 19.53mV rise
in the analog input, the output varies by 1 unit. To set a particular voltage level as the
reference value, this pin is connected to half the voltage. For example, to set a
reference of 4V (Vref), pin9 is connected to 2V (Vref/2), thereby reducing the step size
to 15.62mV (4V/255).
KEYPAD
In engineering, a switch is an electrical component that can break an electrical circuit,
interrupting the current or diverting it from one conductor to another. The most familiar
form of switch is a manually operated electromechanical device with one or more sets of
electrical contacts, which are connected to external circuits. Each set of contacts can be
in one of two states: either "closed" meaning the contacts are touching and electricity
can flow between them, or "open", meaning the contacts are separated and the switch
is non conducting.
The mechanism actuating the transition between these two states (open or closed) can
be either a "toggle" (flip switch for continuous "on" or "off") or "momentary" (push-for
"on" or push-for "off") type. An ideal switch would have no voltage drop when closed,
and would have no limits on voltage or current rating. It would have zero rise time and
fall time during state changes, and would change state without "bouncing" between on
and off positions.
Fig 1.4
CHAPTER 2 LITERATURE REVIEW
2.1 REVIEW OF MICROCONTROLLERS
A microcontroller is an economical computer-on-a-chip built for dealing with specific
tasks, such as displaying or receiving information through LEDs or remote controlled
devices. The most commonly used set of microcontrollers belong to 8051 Family. 8051
Microcontrollers continue to remain a preferred choice for a vast community of hobbyists
and professionals. Through 8051, the world became witness to the most revolutionary
set of microcontrollers.
Fig 2.1
8051 Family
Intel fabricated the original 8051 which is known as MCS-51. The other two
members of the 8051 family are:
8052 – This microcontroller has 256 bytes of RAM and 3 timers. In addition to
the standard features of 8051, this microcontroller has an added 128 bytes of
RAM and timer. It has 8K bytes of on chip program ROM. The programs written
for projects using 8051 microcontroller can be used to run on the projects using
8052 microcontroller as 8051 is a Subset of 8052.
8031 – This microcontroller has all the features of 8051 except for it to be ROM-
less. An external ROM that can be as large as 64 K bytes should be
programmed and added to this chip for execution. The disadvantage of adding
external ROM is that 2 ports (out of the 4 ports) are used. Hence, only 2 ports are
left for I/O operations which can also be added externally if required for
execution.
TABLE NO. 2.1
Features 8051 8052 8031
RAM(bytes) 128 256 128
ROM 4K 8K 0K
Timers 2 3 2
Serial port 1 1 1
I/O pins 32 32 32
Interrupt sources 6 8 6
VARIOUS 8051 MICROCONTROLLERS
8051 microcontrollers use two different kinds of memory such as UV- EPROM, Flash
and NV-RAM. Hence 8051 will not be seen in the part number even though it is the
most popular member of the 8051 family.
8751 – This microcontroller is the UV-EPROM version of 8051. This chip has only 4K
bytes of UV-EPROM. It is required to have access to the PROM burner and the UV-
EPROM eraser to erase the contents inside the chip before it is programmed again.The
disadvantage of using this memory is the waiting time of around 20 minutes to erase the
contents in order to program it again. Due to this limitation, manufacturers fabricated
flash and NV-RAM versions of 8051.
AT89C51 from Atmel Corporation – Atmel fabricated the flash ROM version of 8051
which is popularly known as AT89C51 (‘C’ in the part number indicates CMOS). The
flash memory can erase the contents within seconds which is best for fast growth.
Therefore, 8751 is replaced by AT89C51 to eradicate the waiting time required to erase
the contents and hence expedite the development time. To build up a microcontroller
based system using AT89C51, it is essential to have ROM burner that supports flash
memory. Note that in Flash memory, entire contents must be erased to program it
again. The contents are erased by the ROM burner.
TABLE NO. 2.2
Part Number
ROM RAM I/O pins
Timer Interrupt Vcc
Packaging
AT89C51 4K 128 32 2 6 5V 40
AT89C52 8K 256 32 3 8 5V 40
AT89C1051 1K 64 15 1 3 3V 20
AT89C2051 2K 128 32 3 8 3V 20
AT89LV51 4K 128 32 2 6 3V 40
AT89LV52 8K 128 32 3 8 3V 40
There are different versions of packaging and various speed of the products mentioned
in the above table.
TABLE NO. 2.3
Part Number Speed Pins Packaging Use
AT89C51-12PC 12MHz 40 DIP Plastic Commercial
AT89C51-16PC 16MHz 40 DIP Plastic Commercial
AT89C51-20PC 20MHz 40 DIP Plastic Commercial
DS5000 from Dallas Semiconductor – Dallas Semiconductor fabricated the NV-RAM
version of the 8051 which is known as DS5000. The PC serial port is utilized to load the
program onto the in-built ROM. The advantage of NV-RAM memory is the facility to
erase the contents one byte at a time.
TABLE NO 2.4
Part Number
RAM ROM Timers I/O pins
Interrupts Vcc Packaging
DS5000-8 128 8K 2 32 6 5V 40
DS5000-32 128 32K 2 32 6 5V 40
DS5000T-8 128 8K 2 32 6 5V 40
DS5000T-8 128 32K 2 32 6 5V 40
One - Time - Programmable (OTP) versions of the 8051 – This version of
microcontroller is cheaper and available from various manufacturers.
CHAPTER 3
METHODOLOGIES
3.1 CIRCUIT DIAGRAM
Fig 3.1
3.2 LCD
A liquid-crystal display (LCD) is a flat panel display, electronic visual display, or video
display that uses the light modulating properties of liquid crystals. Liquid crystals do not
emit light directly. LCDs are available to display arbitrary images (as in a general-
purpose computer display) or fixed images which can be displayed or hidden, such as
preset words, digits, and 7-segment displays as in a clock. They use the same basic
technology, except that arbitrary images are made up of a large number of small pixels,
while other displays have larger elements.
Fig 3.2
3.3 POWER SUPPLY
Low-power, high-performance CMOS 8-bit microcontroller with 8KB of ISP flash
memory. The device uses Atmel high-density, nonvolatile memory technology and is
compatible with the industry-standard 80C51 instruction set and pin out. On-chip flash
allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer.
3.4 PIN DIAGRAM
3.4.1 8051 PIN DIAGRAM
Fig. 3.3
Port0 (p0.0 to p0.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory
access, it functions as multiplexed data and low-order address busAD0-AD7.
Port 1 (p1.0 to p1.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic ‘1’ is written into
port latch then it works as input mode. It functions as simply I/O port and it don’t Have.
Port 2 (p2.0 to p2.7): It is 8-bit bi-directional I/O port. It is bit/ byte addressable.
Port 3(p3.0 to port 3.7):It is 8-bit I/O port. In an alternating function each pins can be Used as a special I/O pin.
P3.0-RxD:It is an Input signal. Through this I/P signal microcontroller receives serial data of serial
communication circuit.
P3.1-TxD:It is O/P signal of serial port. Through this signal data is transmitted.
P3.2- (INT0):It is external hardware interrupt I/P signal. Through this user, programmer or peripheral
interrupts to microcontroller.
P3.3-(INT1):It is external hardware interrupt I/P signal. Through this user, programmer or peripheral
Interrupt to microcontroller.
P3.4 - T0:
It is I/P signal to internal timer-0 circuit. External clock pulses can connects to timer-0I/P
signal.
P3.5-T1:It is I/P signal to internal timer-1 circuit . External clock pulses can connects to timer-1
through this I/P signal.
P3.6-[WR (bar)]:It is active low write O/P control signal. During External RAM (Data memory) access it is
generated by microcontroller. When [WR(bar)]=0, then performs write operation.
P3.7-[RD (bar)]:It is active low read O/P control signal. During External RAM (Data memory) access it is
generated by microcontroller. When [RD(bar)]=0, then performs read operation from
external RAM.
XTAL1 and XTAL2:These are two I/P line for on-chip oscillator and clock generator circuit. A resonant
network as quartz crystal is connected between these two pin. 8051 microcontroller also
drives from external clock.
[EA (bar)]/VPP:It is and active low I/P to 8051 microcontroller. When (EA)= 0, then 8051
microcontroller access from external program memory (ROM) only. When (EA) = 1.
[PSEN (bar)]: It is active low O/P signal. It is used to enable external program memory
(ROM) When [PSEN (bar)] = 0, then external program memory becomes enabled and
Microcontroller read content of external memory location. Therefore it is connected to
(OE) of external ROM. It is activated twice every external ROM memory cycle.
ALE:
Address latch enable: It is active high O/P signal. When it goes high, external address
latch becomes enabling and lower address of external memory (RAM or ROM) latched
into it. Thus it separates A0-A7 address from AD0-AD7. It provides properly timed signal
to latch lower byte address. The ALE is activated twice in every machine cycle. If
external RAM & ROM is not accessed, then ALE is activated at constant rate of 1/6
oscillator frequency, which can be used as a clock pulses for driving external devices.
RESET: It is active high I/P signal. It should be maintained high for at least two machine
cycles while oscillator is running then 8051 microcontroller resets.
3.4.2 ADC PIN DIAGRAM
PIN DIAGRAM
Fig 3.4
PIN DESCRIPTION
Table no 3.1
Pin No
Function Name
1 Activates ADC; Active low Chip select
2 Input pin; High to low pulse brings the data from internal
registers to the output pins after conversion
Read
3 Input pin; Low to high pulse is given to start the conversion Write
4 Clock Input pin; to give external clock. Clock IN
5 Output pin; Goes low when conversion is complete Interrupt
6 Analog non-inverting input Vin(+)
7 Analog inverting Input; normally ground Vin(-)
8 Ground(0V) Analog
Ground
9 Input pin; sets the reference voltage for analog input Vref/2
10 Ground(0V) Digital Ground
11
8 bit digital output pins
D7
12 D6
13 D5
14 D4
15 D3
16 D2
17 D1
18 D0
19 Used with Clock IN pin when internal clock source is used Clock R
20 Supply voltage; 5V Vcc
3.5 COMPONENT LIST
3.5.1 MICRO-CONTROLLER(AT89S52)
The 8051 microcontroller is an 8-bit microcontroller. Let us see the major components of
8051 microcontroller and their functions.
An 8051 microcontroller has the following 12 major components:
1. ALU (Arithmetic and Logic Unit)
2. PC (Program Counter)
3. Registers
4.Timers and counters5. Internal RAM and ROM
6.Four general purpose parallel input/output ports
7. Interrupt control logic with five sources of interrupt
8.Serial date communication
9. PSW (Program Status Word)
10. Data Pointer (DPTR)
This very post is related to the RPM meter project. In fact this is the description
of AT89S52 with reference to that context. You must first of all glance over the
project here. This is to mention here that this post is the work of all the same team
members mentioned in the project. 8051 is the name of a big family of microcontrollers.
The device which we used in our project was the 'AT89S52' which is a typical
8051 microcontroller manufactured by Atmel™. The block diagram provided by Atmel™
in their datasheet that showed the architecture of 89S52 device seemed a bit
complicated. A simpler architecture can be represented below.
The 89S52 has 4 different ports, each one having 8 Input/output lines providing a total
of 32 I/O lines. Those ports can be used to output DATA and orders do other devices, or
to read the state of a sensor, or a switch. Most of the ports of the 89S52 have 'dual
function' meaning that they can be used for two different functions.
The first one is to perform input/output operations and the second one is used to
implement special features of the microcontroller like counting external pulses,
interrupting the execution of the program according to external events, performing serial
data transfer or connecting the chip to a computer to update the software. Each port has
8 pins, and will be treated from the software point of view as an 8-bit variable called
'register', each bit being connected to a different Input/output pin.
There are two different memory types: RAM and EEPROM. Shortly, RAM is used to
store variable during program execution, while the EEPROM memory is used to store
the program itself, that's why it is often referred to as the 'program memory'. It
is clear that the CPU (Central Processing Unit) is the heart of the micro controllers. It is
the CPU that will Read the program from the FLASH and Execute it by interacting with
the different peripherals
3.5.2 TEMPERATURE SENSOR LM35
An analog temperature sensor is pretty easy to explain, it's a chip that tells you what the
ambient temperature. As temperature increases, the voltage across a diode increases
at a known rate.
Technically, this is actually the voltage drop between the base and emitter of a
transistor. By precisely amplifying the voltage change, it is easy to generate an analog
signal that is directly proportional to temperature. .
Moreover they are very inexpensive and quite easy to use. These stats are for the
temperature in the Ad fruit shop, the Analog Devices TMP36 (-40 to 150C). It’s very
similar to the LM35/TMP35 (Celsius output) and LM34/TMP34 (Fahrenheit output).
Fig. 3.5
3.5.3 ADC
These are used to take analog input from sensors or dividers. Like a Sharp distance
sensor feeds μC with analog voltage corresponding to distance from obstacle. Analog to
digital converters find huge application as an intermediate device to convert the signals
from analog to digital form. These digital signals are used for further processing by the
digital processors. Various sensors like temperature, pressure, force etc. convert the
physical characteristics into electrical signals that are analog in nature.
ADC0804 is a very commonly used 8-bit analog to digital convertor. It is a single
channel IC, i.e., it can take only one analog signal as input. The digital outputs vary from
0 to a maximum of 255. The step size can be adjusted by setting the reference voltage
at pin9. When this pin is not connected, the default reference voltage is the operating
voltage, i.e., Vcc. The step size at 5V is 19.53mV (5V/255), i.e., for every 19.53mV rise
in the analog input, the output varies by 1 unit. To set a particular voltage level as the
reference value, this pin is connected to half the voltage. For example, to set a
reference of 4V (Vref), pin9 is connected to 2V (Vref/2), thereby reducing the step size
to 15.62mV (4V/255).
3.5.4 VOLTAGE REGULATOR
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed
linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and
would not give the fixed voltage output. The voltage regulator IC maintains the output
voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is
designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable
values can be connected at input and output pins depending upon the respective
voltage levels.
Fig 3.6
PIN DESCRIPTION
Table no 3.2
Pin No
Function Name
1 Input voltage (5V-18V) Input
2 Ground (0V) Ground
3 Regulated output; 5V (4.8V-5.2V) Output
3.5.5 LED
A light-emitting diode (LED) is a two-lead semiconductor light source that resembles a
basic Pn-junction diode, except that an LED also emits light. When an LED's anode
lead has a voltage that is more positive than its cathode lead by at least the LED's
forward voltage drop, current flows. Electrons are able to recombine with holes within
the device, releasing energy in the form of photons. This effect is called
electroluminescence, and the color of the light (corresponding to the energy of the
photon) is determined by the energy band gap of the semiconductor. An LED is often
small in area (less than 1 mm2), and integrated optical components may be used to
shape its radiation pattern. Appearing as practical electronic components in 1962, the
earliest LEDs emitted low-intensity infrared light. Infrared LEDs are still frequently used
As transmitting elements in remote-control circuits, such as those in remote controls
for a wide variety of consumer electronics. The first visible-light LEDs were also of low
intensity, and limited to red. Modern LEDs are available across the visible, ultraviolet,
and infrared wavelengths, with very high brightness.
Fig 3.7
3.5.6 CAPACITOR
A capacitor is an electronic component that is able to hold or store an electric charge. It
consists of two or more metal conducting plates separated from one another by an
insulator. In general, capacitors are used to block direct current (dc) but pass alternating
current. The basic unit of capacitance is the Farad (F), but because this value is too
large for a practical work, the microfarad (uf) = 10-6F, nana Farad (nf) = 10-9F, and Pico
Farad (uf) = 10-12F are used
Fig 3.8
3.5.7 RESISTOR:
A resistor is a passive two-terminal electrical component that implements electrical
resistance as a circuit element. Resistors act to reduce current flow, and, at the same
time, act to lower voltage levels within circuits. Resistors may have fixed resistances or
variable resistances, such as those found in, trimmers, photo resistors and
potentiometers.
Fig 3.9
The current through a resistor is in direct proportion to the voltage across the resistor's
terminals. This relationship is represented by Ohm's law:
where I is the current through the conductor in units of amperes, V is the potential
difference measured across the conductor in units of volts, and R is the resistance of
the conductor in units of ohms (symbol: Ω).The ratio of the voltage applied across a
resistor's terminals to the intensity of current in the circuit is called its resistance, and
this can be assumed to be constant (independent of the voltage) for ordinary resistors
working within their ratings
3.5.8 SOFTWARE REQUIREMENT
KEILKEIL vision is the name of software dedicated to the development and testing of a
family of microcontrollers based on 8051 technology, which we are going to use along
this tutorial. You can download an evaluation version of KEIL. Most versions share
merely the same interface, this tutorial uses KEIL C51 vision 4 with the C51 compiler.
To create project, write and test the source code and also create hex file.
Open Kiel and Start a new project. You will prompt to choose a name for your new
project, chose a name and click save. Window will appear, where you will be asked to
select a device for Target ‘Target. From the list, select ATMEL and chose your
microcontroller .The AT89s52 will be called your ‘Target device’, which is the final
destination of your source code. You will be asked whether to copy standard 8051
startup code click no. Click File, New and similar to the following window should appear.
The blank space where your code should be written.
NOW, You have to click ‘File ‘,Save as and chose a file name for code ending with the
extension ‘.c’ and click save.After right-clicking on ‘source group 1‘, click on ‘Add files to group…‘, then you will be prompted to browse the file to add to ‘source group 1′,
chose the file that you just saved and add it to the source group. You will notice that the
file is added to the project tree at the left.
In some versions of this software you have to turn ON manually the option to generate
HEX files. make sure it is turned ON, by right-clicking on target 1, Options for target
‘target 1′, then under the ‘output‘ tab, by checking the box ‘generate HEX file‘. This step
is very important as the HEX file is the compiled output of your project that is going to
be transferred to the microcontroller.
3.6 PROGRAMMING
#include<reg51.h>
#include<math.h>
#include<stdio.h>
sfr lcddata=0x80;
sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
sbit cs=P1^4;
sbit rd=P1^7;
sbit wr=P1^6;
sbit intr=P1^5;
sbit dig_min1=P3^7;
sbit dig_hr1=P3^6;
sbit dig_date1=P3^5;
sbit dig_month1=P3^4;
sbit dig_year1=P3^3;
sbit start=P3^2;
int hr ,hr1=0;
int min,min1=0;
int sec,sec1=0;
int year,year1=1;
int month,month1=1;
int date,date1=1;
void delay(unsigned int time)
{
unsigned int a,b;
for (a=0;a<time;a++)
{
for(b=0;b<1275;b++)
{
}
}
}
void lcmd(unsigned char sdata)
{
rs=0;
delay(1);
rw=0;
delay(1);
en=1;
delay(1);
lcddata=sdata;
delay(1);
en=0;
}
void ldata(unsigned char ddata)
{
rs=1;
delay(1);
rw=0;
Delay (1);
En=1;
Delay (1);
Lcddata=ddata;
Delay (1);
En=0;
}
void init(void)
{
lcmd(0x38);
Delay (1);
lcmd(0x06); // to scroll 07 , stable 06
delay(1);
lcmd(0x0C);
delay(1);
lcmd(0x01);
Delay (1);
}
void ldisp(unsigned char location,unsigned char *d)
{
lcmd(location);
//delay(5);
while(*d)
{
ldata(*d++);
//delay(3);
}
}
lcd_data_int(int time_val) // Function to send number to LCD
{
int int_amt;
int_amt=time_val/10;
ldata(int_amt+48);
int_amt=time_val%10;
ldata(int_amt+48);
}
int ADC(void)
{
unsigned long DATA=0x00;
rd=1;
wr=0;
delay(1);
wr=1;
while(intr==1);
rd=0;
DATA=P2;
return DATA;
}
Void set_year1() // Function to set year
{Delay (15);
min1++;
year1++;
if(year1>99)
year1=0;
lcmd (0x88);
lcd_data_int(year1);
}
void set_month1() // Function to set set month of clock
{delay(15);
min1++;
month1++;
if(month1>12)
month1=1;
lcmd(0x83);
lcd_data_int(month1);
ldata('/');
}
Void set_date1() // Function to set set date of clock
{Delay (15);
Min1++;
Date1++;
if(date1>31)
date1=1;
lcmd(0x80);
lcd_data_int(date1);
ldata('/');
}
Void set_hr1() // Function to set set hours digit of clock
{delay(15);
min1++;
hr1++;
if(hr1>23)
hr1=0;
lcmd(0xC0);
lcd_data_int(hr1);
ldata(':');
}
Void set_min1() // Function to set set minutes digit of clock
{delay(15);
Min1++;
If (min1>59)
min1=0;
lcmd(0xC3);
lcd_data_int(min1);
}
Void shape() // Function to create the shape of degree
{
lcmd(64);
ldata(2);
ldata(5);
ldata(2);
ldata(0);
ldata(0);
ldata(0);
ldata(0);
ldata(0);
lcmd(0xCE);
ldata(0);
Delay (1);
}
Void main ()
{
Unsigned int m,i,temp=0,volt;
Unsigned char abc[21];
cs=0;
init();
rw=0;
start=1;
dig_hr1=1;
dig_min1=1;
dig_year1=1;
dig_month1=1;
dig_date1=1;
Shape ();
ldata('C');
ldisp(0x8A,"|TEMP");
lcmd(0xCA);
ldata('|');
//ldisp(0x80,"TEMPRATURE IS:");
While (1)
{
lcmd(0x80);
delay(1);
lcd_data_int(date);
ldata('/');
lcd_data_int(month);
ldata('/');
ldata('2');
ldata('0');
lcd_data_int(year);
lcmd(0xC0);
Delay (1);
lcd_data_int(hr);
data (':');
lcd_data_int(min);
Data (':');
lcd_data_int(sec);
//temp=0xFF;
While (start==0)
{
delay (10);
If (dig_year1==0)
set_year1 ();
if(dig_month1==0)
set_month1 ();
If (dig_date1==0)
set_date1 ();
If (dig_hr1==0)
set_hr1 ();
If (dig_min1==0)
set_min1 ();
Year=year1;
Month=month1;
Date=date1;
Hr=hr1;
Min=min1;
}
m=year%4;
If (sec==59)
{Sec=0;
If (min==59)
{Min=0;
if (hr==23)
{Hr=0;
if (date==31)
{
rr:
If (dates==0)
{
}
Else
{ Date=1;
}
if(month==12)
{Month=1;
if(year==99)
{Year=0;
}
Else
{Year++;
}
}
Else
{Month++;
}
}
Else
{Date++;
}
}
Else
{Hr++;
}
}
Else
{
Min++;
}
}
Else
{Sec++;
Temp=ADC();
Volt=temp*1.7;
Delay (23);
ldisp(0xCB," ");
sprint(abc,"%d",volt);
ldisp(0xCB,abc);
if(m==0)
{if (month==2 && date==29 && hr==23 && min==59 && sec==59)
{
Date=0;
Month=3;
}
}
Else
{if(month==2 && date==28 && hr==23 && min==59 && sec==59)
{
Date=0;
Month=3;
}
}
If (month==4 || month==6 || month==8 || month==9 || month==11 )
{
If (date==30 && hr==23 && min==59 && sec==59)
{
Date=0;
go to rr;}
}
/*else if(month==1 || month==3 || month==5 || month==6 || month==8 ||
month==10 || month==12 && date==31 && hr==23 && min==59 && sec==59)
{
date=0;
month=month+1;
}*/
}
}
}
CHAPTER 4
RESULT & DISCUSSION
4.1 RESULT
The System was operated successfully. It is successfully tested in the laboratory.
Controller takes the information successfully from digital time clock and sends the
information successfully to LCD and successfully displays the output.
By external 5 switch keys we can set the year, month ,day, hours, minutes, to display
our output on LCD .Once we can set these push start button on then display on LCD will
start to gives an output . The display of year will show the display up to year 2099.
There is a reset button to reset our data on LCD .If we can switch off the display we can
again set the data to display. We can also add to display temperature on LCD.
When we set the data and push the button on to start the will automatically display on
screen. It will also display the body temperature if we touch the temperature sensor. Our
project model were specially used in colleges, building, school, houses, hospitals,
stations, mall etc. to display date, time, temperature.
CHAPTER 5
CONCLUSION
5.1 CONCLUSION
The project we have undertaken has helped us gain a better perspective on various
aspects related to our course of study as well as practical knowledge of electronic
equipment’s and communication. We became familiar with software analysis, designing,
implementation, testing and maintenance concerned with our project. The extensive
capabilities of this system are what make it so interesting. Our project are specially used
in colleges, building, campus, hostel, hospital, station, mall etc. to display
time ,date ,temperature .
5.2 FUTURE SCOPE
This project is used to display the updated time, date and temperature even switch off
the power supply.
In future this can be extending to control the temperature and monitor the weather
condition.
CHAPTER 6
REFERENCES
[1] “ C programming for embedded systems” , Kirk Zurell , 2000 .
[2] “ Embedded Microcomputer system” , onathan w.Valvano , 2000.
[3] “8051 microcontroller & embedded systems” , Md Ali Mazidi , 2009.
[4] “ Microprocessor & interfacing” , Douglas V.Hall , 2006.