You are on page 1of 118

ABSTRACT

Now a day's every system is automated in order to face new challenges in the
present day situation. Automated systems have less manual operations, so that the
flexibility, reliabilities are high and accurate. Hence every field prefers automated control
systems. Especially in the field of electronics automated systems are doing better
performance.
Probably the most useful thing to know about the global system for mobile
communication is that it is an international standard. If you travel in parts of world, GSM
is only type of cellular service available. Instead of analog services, GSM was developed
as a digital system using TDMA technology.
The main aim of this project is to detect the fire in the Trains and also control the
fire using water pump. L293D is used as a Driver IC for Motor and LCD is used for
Display. Fire is detected by using IR Receiver. Whenever Fire is detected water pump
will be turned on.
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 (LCs). LCs
does not emit light directly.When ever the fire will be detected in the trains and then
automatically engine will be totally stop and by sending message using GSM .
This project uses regulated 5V, 500mA & 12V, 500mA power supply. 7805 and
7812 three terminal voltage regulators are used for voltage regulation. Bridge type full
wave rectifier is used to rectify the ac output of secondary of 230/12V step down
transformer.

Block Diagram: Rx

MAX232

Power
Supply
Micro Controller

Water
pump

Fire
Sensor
LCD

GSM

INTRODUCTION
An embedded system is a combination of software
and hardware to perform a dedicated task.
Some of the main devices used in embedded
products are Microprocessors and Microcontrollers.
Microprocessors are commonly referred to as
general purpose processors as they simply accept the
inputs, process it and give the output.
In contrast, a microcontroller not only accepts the
data as inputs but also manipulates it, interfaces the
data with various devices, controls the data and thus
finally gives the result. In this project we use RF module
as well as the DTMF decoder for communication. Now
when we dial the numbers in the mobile phone from the
controlling side then it automatically recognizes which
number has been recorded and it follows with the
corresponding next step to be taken i.e., movement of
the robot in water.

Introduction of Embedded System:


An Embedded System is a combination of computer
hardware and software, and perhaps additional mechanical
or other parts, designed to perform a specific function. A
good

example

is

the

microwave

oven.

Almost

every

household has one, and tens of millions of them are used


everyday, but very few people realize that a processor and
software are involved in the preparation of their lunch or
dinner.
This is in direct contrast to the personal computer in
the family room. It too is comprised of computer hardware
and software and mechanical components (disk drives, for
example). However, a personal computer is not designed to
perform a specific function rather; it is able to do many
different things. Many people use the term general-purpose
computer to make this distinction clear. As shipped, a
general-purpose computer is a blank slate; the manufacturer
does not know what the customer will do wish it. One
customer may use it for a network file server another may
use it exclusively for playing games, and a third may use it
to write the next great American novel.

Frequently, an embedded system is a component


within some larger system. For example, modern cars and
trucks contain many embedded systems. One embedded
system controls the anti-lock brakes, other monitors and
controls the vehicle's emissions, and a third displays
information

on

the dashboard.

In

some

cases,

these

embedded systems are connected by some sort of a


communication

network,

but

that

is

certainly

not

requirement.
At the possible risk of confusing you, it is important
to point out that a general-purpose computer is itself made
up of numerous embedded systems. For example, my
computer consists of a keyboard, mouse, video card,
modem, hard drive, floppy drive, and sound card-each of
which is an embedded system. Each of these devices
contains a processor and software and is designed to
perform a specific function. For example, the modem is
designed to send and receive digital data over analog
telephone line. That's it and all of the other devices can be
summarized in a single sentence as well.
If an embedded system is designed well, the
existence of the processor and software could be completely
unnoticed by the user of the device. Such is the case for a
microwave oven, VCR, or alarm clock. In some cases, it

would even be possible to build an equivalent device that


does not contain the processor and software. This could be
done by replacing the combination with a custom integrated
circuit that performs the same functions in hardware.
However, a lot of flexibility is lost when a design is hardcooled in this way. It is mush easier, and cheaper, to change
a few lines of software than to redesign a piece of custom
hardware.

History and Future:


Given the definition of embedded systems earlier is this
chapter; the first such systems could not possibly have
appeared before 1971. That was the year Intel introduced
the world's first microprocessor. This chip, the 4004, was
designed for use in a line of business calculators produced
by the Japanese Company Busicom. In 1969, Busicom asked
Intel to design a set of custom integrated circuits-one for
each of their new calculator models. The 4004 was Intel's
response rather than design custom hardware for each
calculator, Intel proposed a general-purpose circuit that
could be used throughout the entire line of calculators.
Intel's idea was that the software would give each calculator
its unique set of features.
The microcontroller was an overnight success, and
its use increased steadily over the next decade. Early

embedded applications included unmanned space probes,


computerized

traffic

lights,

and

aircraft

flight

control

systems. In the 1980s, embedded systems quietly rode the


waves

of

the

microcomputer

age

and

brought

microprocessors into every part of our kitchens (bread


machines, food processors, and microwave ovens), living
rooms (televisions, stereos, and remote controls), and
workplaces (fax machines, pagers, laser printers, cash
registers, and credit card readers).
It seems inevitable hat the number of embedded
systems will continue to increase rapidly. Already there are
promising new embedded devices that have enormous
market potential; light switches and thermostats that can be
central computer, intelligent air-bag systems that don't
inflate when children or small adults are present, pal-sized
electronic organizers and personal digital assistants (PDAs),
digital cameras, and dashboard navigation systems. Clearly,
individuals who possess the skills and desire to design the
next generation of embedded systems will be in demand for
quite some time.

Real Time Systems:


One subclass of embedded is worthy of an introduction
at this point. As commonly defined, a real-time system is a
computer system that has timing constraints. In other words,

a real-time system is partly specified in terms of its ability to


make certain calculations or decisions in a timely manner.
These important calculations are said to have deadlines for
completion. And, for all practical purposes, a missed
deadline is just as bad as a wrong answer.
The issue of what if a deadline is missed is a crucial
one. For example, if the real-time system is part of an
airplane's flight control system, it is possible for the lives of
the passengers and crew to be endangered by a single
missed deadline. However, if instead the system is involved
in satellite communication, the damage could be limited to a
single

corrupt

data

packet.

The

more

severe

the

consequences, the more likely it will be said that the


deadline is "hard" and thus, the system is a hard real-time
system.

Real-time

systems

at

the

other

end

of this

discussion are said to have "soft" deadlines.


All of the topics and examples presented in this book are
applicable to the designers of real-time system who is more
delight in his work. He must guarantee reliable operation of
the software and hardware under all the possible conditions
and to the degree that human lives depend upon three
system's proper execution, engineering calculations and
descriptive paperwork.
Application Areas

Nearly 99 per cent of the processors manufactured end up in


embedded systems. The embedded system market is one of
the highest growth areas as these systems are used in very
market segment- consumer electronics, office automation,
industrial

automation,

biomedical

engineering,

wireless

communication,Data communication, telecommunications,


transportation, military and so on.
Consumer appliances:At home we use a number of
embedded systems which include digital camera, digital
diary, DVD player, electronic toys, microwave oven, remote
controls for TV and air-conditioner, VCO player, video game
consoles, video recorders etc. Todays high-tech car has
about 20 embedded systems for transmission control, engine
spark

control,

air-conditioning,

wristwatches are now

navigation

etc.

Even

becoming embedded systems. The

palmtops are powerful embedded systems using which we


can carry out many general-purpose tasks such as playing
games and word processing.
Office automation:The office automation products using
em embedded systems are copying machine, fax machine,
key telephone, modem, printer, scanner etc.
Industrial

automation:Today

lot

of

industries

use

embedded systems for process control. These include

pharmaceutical, cement, sugar, oil exploration, nuclear


energy,

electricity

generation

and

transmission.

The

embedded systems for industrial use are designed to carry


out specific tasks such as monitoring the temperature,
pressure, humidity, voltage, current etc., and then take
appropriate action based on the monitored levels to control
other devices or to send information to a centralized
monitoring station. In hazardous industrial environment,
where human presence has to be avoided, robots are used,
which are programmed to do specific jobs. The robots are
now becoming very powerful and carry out many interesting
and complicated tasks such as hardware assembly.
Medical electronics:Almost every medical equipment in
the hospital is an embedded system. These equipments
include diagnostic aids such as ECG, EEG, blood pressure
measuring devices, X-ray scanners; equipment used in blood
analysis,

radiation,

colonscopy,

endoscopy

etc.

Developments in medical electronics have paved way for


more accurate diagnosis of diseases.
Computer
such

as

networking:Computer
bridges,

routers,

networking

Integrated

Services

products
Digital

Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25


and frame relay switches are embedded systems which
implement the necessary data communication protocols. For
example, a router interconnects two networks. The two

networks may be running different protocol stacks. The


routers function is to obtain the data packets from incoming
pores, analyze the packets and send them towards the
destination after doing necessary protocol conversion. Most
networking

equipments,

other

than

the

end

systems

(desktop computers) we use to access the networks, are


embedded systems.
Telecommunications:In the field of telecommunications,
the embedded systems can be categorized as subscriber
terminals and network equipment. The subscriber terminals
such as key telephones, ISDN phones, terminal adapters,
web

cameras

are

embedded

systems.

The

network

equipment includes multiplexers, multiple access systems,


Packet Assemblers Dissemblers (PADs), sate11ite modems
etc. IP phone, IP gateway, IP gatekeeper etc. are the latest
embedded

systems

that

provide

very

low-cost

voice

communication over the Internet.


Wireless

technologies:Advances

communications are

paving way

for

in

mobile

many interesting

applications using embedded systems. The mobile phone is


one of the marvels of the last decade of the 20h century. It
is a very powerful embedded system that provides voice
communication while we are on the move. The Personal
Digital Assistants and the palmtops can now be used to
access multimedia services over

the Internet. Mobile

communication

infrastructure

such

as

base

station

controllers, mobile switching centers are also powerful


embedded systems.
Insemination:Testing

and

measurement

are

the

fundamental requirements in all scientific and engineering


activities. The measuring equipment we use in laboratories
to measure parameters such as weight, temperature,
pressure, humidity, voltage, current etc. are all embedded
systems. Test equipment such as oscilloscope, spectrum
analyzer,

logic

analyzer,

protocol

analyzer,

radio

communication test set etc. are embedded systems built


around powerful processors. Thank to miniaturization, the
test and measuring equipment are now becoming portable
facilitating easy testing and measurement in the field by
field-personnel.
Security:Security of persons and information has always
been a major issue. We need to protect our homes and
offices; and also the information we transmit and store.
Developing embedded systems for security applications is
one of the most lucrative businesses nowadays. Security
devices at homes, offices, airports etc. for authentication
and verification are embedded systems. Encryption devices
are nearly 99 per cent of
the processors that are manufactured end up in~ embedded
systems. Embedded systems find applications in . every

industrial segment- consumer electronics, transportation,


avionics, biomedical engineering, manufacturing, process
control and industrial automation, data communication,
telecommunication, defense, security etc. Used to encrypt
the data/voice being transmitted on communication links
such as telephone lines. Biometric systems using fingerprint
and face recognition are now being extensively used for user
authentication in banking applications as well as for access
control in high security buildings.
Finance:Financial dealing through cash and cheques are
now slowly paving way for transactions using smart cards
and ATM (Automatic Teller Machine, also expanded as Any
Time Money) machines. Smart card, of the size of a credit
card, has a small micro-controller and memory; and it
interacts with the smart card reader! ATM machine and acts
as an electronic wallet. Smart card technology has the
capability of ushering in a cashless society. Well, the list goes
on. It is no exaggeration to say that eyes wherever you go,
you can see, or at least feel, the work of an embedded
system!

Overview of Embedded System Architecture

Every embedded system consists of custom-built hardware


built around a Central Processing Unit (CPU). This hardware
also contains memory chips onto which the software is
loaded. The software residing on the memory chip is also
called the firmware. The embedded system architecture

can be represented as a layered architecture as shown in Fig.


The operating system runs above the hardware, and the
application software runs above the operating system. The
same architecture is applicable to any computer including a
desktop

computer.

However,

there

are

significant

differences. It is not compulsory to have an operating system


in every embedded system. For small appliances such as
remote control units, air conditioners, toys etc., there is no
need for an operating system and you can write only the
software

specific

to

that

application.

For

applications

involving complex processing, it is advisable to have an


operating system. In such a case, you need to integrate the
application software with the operating system and then

transfer the entire software on to the memory chip. Once the


software is transferred to the memory chip, the software will
continue to run for a long time you dont need to reload new
software.
Now, let us see the details of the various building blocks of
the hardware of an embedded system. As shown in Fig. the
building blocks are;
Central Processing Unit (CPU)
Memory (Read-only Memory and Random Access Memory)
Input Devices
Output devices
Communication interfaces
Application-specific circuitry

Central Processing Unit (CPU):


The Central Processing Unit (processor, in short) can be any
of the following: microcontroller, microprocessor or Digital

Signal Processor (DSP). A micro-controller is a low-cost


processor. Its main attraction is that on the chip itself, there
will be many other components such as memory, serial
communication interface, analog-to digital converter etc. So,
for small applications, a micro-controller is the best choice as
the number of external components required will be very
less. On the other hand, microprocessors are more powerful,
but you need to use many external components with them.
D5P

is

used

mainly

for

applications

in

which

signal

processing is involved such as audio and video processing.


Memory:
The memory is categorized as Random Access 11emory
(RAM) and Read Only Memory (ROM). The contents of the
RAM will be erased if power is switched off to the chip,
whereas ROM retains the contents even if the power is
switched off. So, the firmware is stored in the ROM. When
power is switched on, the processor reads the ROM; the
program is program is executed.
Input devices:
Unlike the desktops, the input devices to an embedded
system have very limited capability. There will be no
keyboard or a mouse, and hence interacting with the
embedded system is no easy task. Many embedded systems
will have a small keypad-you press one key to give a specific
command. A keypad may be used to input only the digits.

Many embedded systems used in process control do not


have any input device for user interaction; they take inputs
from sensors or transducers 1fnd produce electrical signals
that are in turn fed to other systems.
Output devices:
The output devices of the embedded systems also have very
limited capability. Some embedded systems will have a few
Light Emitting Diodes (LEDs) to indicate the health status of
the system modules, or for visual indication of alarms. A
small Liquid Crystal Display (LCD) may also be used to
display some important parameters.

Communication interfaces:
The embedded systems may need to, interact with other
embedded systems at they may have to transmit data to a
desktop. To facilitate this, the embedded systems are
provided with one or a few communication interfaces such as
RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394,
Ethernet etc.

Application-specific circuitry:

Sensors, transducers, special processing and control circuitry


may be required fat an embedded system, depending on its
application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware has to be
given power supply either through the 230 volts main supply
or through a battery. The hardware has to design in such a
way that the power consumption is minimized.

Conclusions:
Embedded Systems plays a vital role in our day today
life. They are used for household appliances like microwave
oven to the satellite applications. They provide good man to
machine interface.
Automation

is

the

further

step

in

the

world

of

Embedded Systems, which includes the elimination of the


human being in the mundane applications.

They are cost

effective, accurate and can work in any conditions and round


the clock.

MICROCONTROLLERS:

Microprocessors and microcontrollers are widely used in embedded


systems products. Microcontroller is a programmable device. A microcontroller has a
CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on
a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in
microcontrollers makes them ideal for many applications in which cost and space are
critical.
The Intel 8051 is Harvard architecture, single chip microcontroller (C) which
was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s
and early 1990s, but today it has largely been superseded by a vast range of enhanced
devices with 8051-compatible processor cores that are manufactured by more than 20
independent manufacturers including Atmel, Infineon Technologies and Maxim
Integrated Products.
8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data
at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the
CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NVRAM.
The present project is implemented on KeilUvision. In order to program the
device, proload tool has been used to burn the program onto the microcontroller.
The features, pin description of the microcontroller and the software tools used
are discussed in the following sections.
FEATURES OF AT89C51:
4K Bytes of Re-programmable Flash Memory.
RAM is 128 bytes.
2.7V to 6V Operating Range.
Fully Static Operation: 0 Hz to 24 MHz.

Two-level Program Memory Lock.


128 x 8-bit Internal RAM.
32 Programmable I/O Lines.
Two 16-bit Timer/Counters.
Six Interrupt Sources.
Programmable Serial UART Channel.
Low-power Idle and Power-down Modes.

Description:
The AT89C51 is a low-voltage, high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash programmable memory. The device is manufactured using
Atmels high-density nonvolatile memory technology and is compatible with the
industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer, which provides a
highly flexible and cost-effective solution to many embedded control applications.
In addition, the AT89C51 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode
stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system
to continue functioning. The power-down mode saves the RAM contents but freezes the
oscillator disabling all other chip functions until the next hardware reset.

Pin diagram

Fig: Block diagram

PIN DESCRIPTION:
Vcc
Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND
Pin 20 is the ground.
XTAL1 and XTAL2
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that
can be configured for use as an on-chip oscillator, as shown in Figure 11. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an external clock
source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in the
below figure. There are no requirements on the duty cycle of the external clock signal,
since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but
minimum and maximum voltage high and low time specifications must be observed.

Fig: Oscillator Connections

C1, C2 = 30 pF 10 pF for Crystals


= 40 pF 10 pF for Ceramic Resonators

Fig: External Clock Drive Configuration

RESET
Pin9 is the reset pin. It is an input and is active high. Upon applying a high pulse to this
pin, the microcontroller will reset and terminate all the activities. This is often referred to
as a power-on reset.
EA (External access)
Pin 31 is EA. It is an active low signal. It is an input pin and must be connected to either
Vcc or GND but it cannot be left unconnected.
The 8051 family members all come with on-chip ROM to store programs. In
such cases, the EA pin is connected to Vcc. If the code is stored on an external ROM, the
EA pin must be connected to GND to indicate that the code is stored externally.
PSEN (Program store enable)
This is an output pin.
ALE (Address latch enable)

This is an output pin and is active high.


Ports 0, 1, 2 and 3
The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports
upon RESET are configured as input, since P0-P3 have value FFH on them.
Port 0(P0)
Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data.
ALE indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when
ALE=1, it has address A0-A7. Therefore, ALE is used for demultiplexing address and
data with the help of an internal latch.
When there is no external memory connection, the pins of P0 must be connected
to a 10K-ohm pull-up resistor. This is due to the fact that P0 is an open drain. With
external pull-up resistors connected to P0, it can be used as a simple I/O, just like P1 and
P2. But the ports P1, P2 bnnsssssssand P3 do not need any pull-up resistors since they
already have pull-up resistors internally. Upon reset, ports P1, P2 and P3 are configured
as input ports.
Port 1 and Port 2
With no external memory connection, both P1 and P2 are used as simple I/O. With
external memory connections, port 2 must be used along with P0 to provide the 16-bit
address for the external memory. Port 2 is designated as A8-A15 indicating its dual
function. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits
A8-A15 of the address.
Port 3
Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3
does not need any pull-up resistors, the same as port 1 and port 2. Port 3 has an additional
function of providing some extremely important signals such as interrupts.

Table: Port 3 Alternate Functions


Machine cycle for the 8051
The CPU takes a certain number of clock cycles to execute an instruction. In the 8051
family, these clock cycles are referred to as machine cycles. The length of the machine
cycle depends on the frequency of the crystal oscillator. The crystal oscillator, along with
on-chip circuitry, provides the clock source for the 8051 CPU.
The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and
manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make
the 8051 based system compatible with the serial port of the IBM PC.
In the original version of 8051, one machine cycle lasts 12 oscillator periods. Therefore,
to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the crystal
frequency and its inverse is taken.
The assembly language program is written and this program has to be dumped into the
microcontroller for the hardware kit to function according to the software. The program
dumped in the microcontroller is stored in the Flash memory in the microcontroller.
Before that, this Flash memory has to be programmed and is discussed in the next
section.

ALE/PROG
Address Latch Enable is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the
oscillator frequency and may be used for external timing or clocking purposes. If desired,
ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set,
ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external
execution mode.

PSEN (Program Store Enable)


It is the read strobe to external program memory. When the AT89S8252 is executing code
from external program memory, PSEN is activated twice each machine cycle, except that
two PSEN activations are skipped during each access to external data memory.

EA/VPP (External Access Enable)


EA must be strapped to GND in order to enable the device to fetch code from external
program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit
1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC

for internal program executions. This pin also receives the 12-volt programming enable
voltage (VPP) during Flash programming when 12-volt programming is selected.

Ports 0, 1, 2 and 3
The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports
upon RESET are configured as input, since P0-P3 have value FFH on them.

Port 0(P0)
Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data.
ALE indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when
ALE=1, it has address A0-A7. Therefore, ALE is used for demultiplexing address and
data with the help of an internal latch.
When there is no external memory connection, the pins of P0 must be connected
to a 10K-ohm pull-up resistor. This is due to the fact that P0 is an open drain. With
external pull-up resistors connected to P0, it can be used as a simple I/O, just like P1 and
P2. But the ports P1, P2 and P3 do not need any pull-up resistors since they already have
pull-up resistors internally. Upon reset, ports P1, P2 and P3 are configured as input ports.
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current because of the internal pull-ups.

Some Port 1 pins provide additional functions. P1.0 and P1.1 can be configured to be the
timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input
(P1.1/T2EX), respectively. Furthermore, P1.4, P1.5, P1.6, and P1.7 can be configured as
the SPI slave port select, data input/output and shift clock input/output pins. Port 1 also
receives the low-order address bytes during Flash programming and verification.

Table: Port1 Alternate functions

Programmable Clock Out:


A 50% duty cycle clock can be programmed to come out on P1.0. This pin, besides being
a regular I/0 pin, has two alternate functions. It can be programmed to input the external
clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4
MHz (for a 16-MHz operating frequency).

Port 2
With no external memory connection, P2 are used as simple I/O. With external
memory connections, port 2 must be used along with P0 to provide the 16-bit address for
the external memory. Port 2 is designated as A8-A15 indicating its dual function. While
P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the
address.
Port 2 also receives the high-order address bits and some control signals during
Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that
are externally being pulled low will source current because of the pull-ups. Port 3
receives some control signals for Flash programming and verification.
Port 3 also serves the functions of various special features of the AT89S8252, as
shown in the following table.

Table: Port 3 Alternate functions

8051 Microcontroller Memory Organisation


The microcontroller memory is divided into Program Memory and Data Memory.
Program Memory (ROM) is used for permanent saving program being executed, while
Data Memory (RAM) is used for temporarily storing and keeping intermediate results
and variables. Depending on the model in use (still referring to the whole 8051
microcontroller family) at most a few Kb of ROM and 128 or 256 bytes of RAM can be
used. However
All 8051 microcontrollers have 16-bit addressing bus and can address 64 kb memory. It is
neither a mistake nor a big ambition of engineers who were working on basic core
development. It is a matter of very clever memory organization which makes these
controllers a real programmers tidbit.

Program Memory
The oldest models of the 8051 microcontroller family did not have any internal program
memory. It was added from outside as a separate chip. These models are recognizable by
their label beginning with 803 (for ex. 8031 or 8032). All later models have a few Kbytes
ROM embedded, Even though it is enough for writing most of the programs, there are
situations when additional memory is necessary. A typical example of it is the use of so
called lookup tables. They are used in cases when something is too complicated or when
there is no time for solving equations describing some process. The example of it can be
totally exotic (an estimate of self-guided rockets meeting point) or totally common
(measuring of temperature using non-linear thermo element or asynchronous motor speed
control). In those cases all needed estimates and approximates are executed in advance
and the final results are put in the tables (similar to logarithmic tables).

How does the microcontroller handle external memory depend on the pin EA logic state?

EA=0In this case, internal program memory is completely ignored, only a program stored
in external memory is to be executed.
EA=1In this case, a program from built-in ROM is to be executed first (to the last
location). Afterwards, the execution is continued by reading additional memory.
in both cases, P0 and P2 are not available to the user because they are used for data and
address transmission. Besides, the pins ALE and PSEN are used too.

Data Memory

As already mentioned, Data Memory is used for temporarily storing and keeping data and
intermediate results created and used during microcontrollers operating. Besides, this
microcontroller family includes many other registers such as: hardware counters and
timers, input/output ports, serial data buffers etc. The previous versions have the total
memory size of 256 locations, while for later models this number is incremented by
additional 128 available registers. In both cases, these first 256 memory locations
(addresses 0-FFh) are the base of the memory. Common to all types of the 8051
microcontrollers. Locations available to the user occupy memory space with addresses
from 0 to 7Fh. First 128 registers and this part of RAM is divided in several blocks.
The first block consists of 4 banks each including 8 registers designated as R0 to R7.
Prior to access them, a bank containing that register must be selected. Next memory
block (in the range of 20h to 2Fh) is bit- addressable, which means that each bit being
there has its own address from 0 to 7Fh. Since there are 16 such registers, this block
contains in total of 128 bits with separate addresses (The 0th bit of the 20h byte has the
bit address 0 and the 7th bit of the 2Fh byte has the bit address 7Fh). The third groups of
registers occupy addresses 2Fh-7Fh (in total of 80 locations) and does not have any
special purpose or feature.
Additional Memory Block of Data Memory
In order to satisfy the programmers permanent hunger for Data Memory, producers have
embedded an additional memory block of 128 locations into the latest versions of the
8051 microcontrollers. Naturally, its not so simpleThe problem is that electronics
performing addressing has 1 byte (8 bits) on disposal and due to that it can reach only the
first 256 locations. In order to keep already existing 8-bit architecture and compatibility
with other existing models a little trick has been used.
Using trick in this case means that additional memory block shares the same addresses
with existing locations intended for the SFRs (80h- FFh). In order to differentiate
between these two physically separated memory spaces, different ways of addressing are
used. A direct addressing is used for all locations in the SFRs, while the locations from
additional RAM are accessible using indirect addressing.

Fig: Microcontroller internal structure

How to extend memory?


In case on-chip memory is not enough, it is possible to add two external memory chips
with capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data
transmission.

From the users perspective, everything functions quite simple if properly connected
because the most operations are performed by the microcontroller itself. The 8051
microcontroller has two separate reading signals RD#(P3.7) and PSEN#. The first one is
activated byte from external data memory (RAM) should be read, while another one is
activated to read byte from external program memory (ROM). These both signals are

active at logical zero (0) level. A typical example of such memory extension using special
chips for RAM and ROM is shown on the previous picture. It is called Hardward
architecture.
Even though the additional memory is rarely used with the latest versions of the
microcontrollers, it will be described here in short what happens when memory chips are
connected according to the previous scheme. It is important to know that the whole
process is performed automatically, i.e. with no intervention in the program.

When the program during execution encounters the instruction which resides in
external memory (ROM), the microcontroller will activate its control output ALE
and set the first 8 bits of address (A0-A7) on P0. In this way, IC circuit
74HCT573 which "lets in" the first 8 bits to memory address pins is activated.

A signal on the pin ALE closes the IC circuit 74HCT573 and immediately
afterwards 8 higher bits of address (A8-A15) appear on the port. In this way, a
desired location in additional program memory is completely addressed. The only
thing left over is to read its content.

Pins on P0 are configured as inputs, the pin PSEN is activated and the
microcontroller reads content from memory chip. The same connections are used
both for data and lower address byte.

Similar occurs when it is a needed to read some location from external Data Memory.
Now, addressing is performed in the same way, while reading or writing is performed via
signals which appear on the control outputs RD or WR.
Addressing
While operating, processor processes data according to the program instructions. Each
instruction consists of two parts. One part describes what should be done and another part
indicates what to use to do it. This later part can be data (binary number) or address
where the data is stored. All 8051 microcontrollers use two ways of addressing depending
on which part of memory should be accessed:

Direct Addressing
On direct addressing, a value is obtained from a memory location while the address of
that location is specified in instruction. Only after that, the instruction can process data
(how depends on the type of instruction: addition, subtraction, copy). Obviously, a
number being changed during operating a variable can reside at that specified address.
For example:
Since the address is only one byte in size ( the greatest number is 255), this is how only
the first 255 locations in RAM can be accessed in this case the first half of the basic
RAM is intended to be used freely, while another half is reserved for the SFRs.
Indirect Addressing
On indirect addressing, a register which contains address of another register is specified
in the instruction. A value used in operating process resides in that another register. For
example:
Only RAM locations available for use are accessed by indirect addressing (never in the
SFRs). For all latest versions of the microcontrollers with additional memory block
(those 128 locations in Data Memory), this is the only way of accessing them. Simply,
when during operating, the instruction including @ sign is encountered and if the
specified address is higher than 128 (7F hex.), the processor knows that indirect
addressing is used and jumps over memory space reserved for the SFRs.
On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit
addresses. Since only 8 bits are available, it is possible to access only registers of internal
RAM in this way (128 locations in former or 256 locations in latest versions of the
microcontrollers). If memory extension in form of additional memory chip is used then
the 16-bit DPTR Register (consisting of the registers DPTRL and DPTRH) is used for
specifying addresses. In this way it is possible to access any location in the range of 64K.

SFRs (Special Function Registers)


SFRs are a kind of control table used for running and monitoring microcontrollers
operating. Each of these registers, even each bit they include, has its name, address in the
scope of RAM and clearly defined purpose ( for example: timer control, interrupt, serial
connection etc.). Even though there are 128 free memory locations intended for their
storage, the basic core, shared by all types of 8051 controllers, has only 21 such registers.
Rest of locations areintensionally left free in order to enable the producers to further
improved models keeping at the same time compatibility with the previous versions. It
also enables the use of programs written a long time ago for the microcontrollers which
are out of production now.

Register

(Accumulator)

This is a general-purpose register which serves for storing intermediate results during
operating. A number (an operand) should be added to the accumulator prior to execute an
instruction upon it. Once an arithmetical operation is preformed by the ALU, the result is
placed into the accumulator. If a data should be transferred from one register to another, it
must go through accumulator. For such universal purpose, this is the most commonly
used register that none microcontroller can be imagined without (more than a half 8051
microcontroller's instructions used use the accumulator in some way).

B Register

B register is used during multiply and divide operations which can be performed only

upon numbers stored in the A and B registers. All other instructions in the program can
use this register as a spare accumulator (A).

During programming, each of registers is called by name so that their exact address is not
so important for the user. During compiling into machine code (series of hexadecimal
numbers recognized as instructions by the microcontroller), PC will automatically,
instead of registers name, write necessary addresses into the microcontroller.

R Registers (R0-R7)

This is a common name for the total 8 general purpose registers (R0, R1, R2 ...R7). Even
they are not true SFRs, they deserve to be discussed here because of their purpose. The
bank is active when the R registers it includes are in use. Similar to the accumulator, they
are used for temporary storing variables and intermediate results. Which of the banks will
be active depends on two bits included in the PSW Register. These registers are stored in
four banks in the scope of RAM.
Description:
The AT89C51 is a low-voltage, high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash programmable memory. The device is manufactured using
Atmels high-density nonvolatile memory technology and is compatible with the
industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer, which provides a
highly flexible and cost-effective solution to many embedded control applications.
In addition, the AT89C51 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode
stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system

to continue functioning. The power-down mode saves the RAM contents but freezes the
oscillator disabling all other chip functions until the next hardware reset.
Machine cycle for the 8051
The CPU takes a certain number of clock cycles to execute an instruction. In the 8051
family, these clock cycles are referred to as machine cycles. The length of the machine
cycle depends on the frequency of the crystal oscillator. The crystal oscillator, along with
on-chip circuitry, provides the clock source for the 8051 CPU.
The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and
manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make
the 8051 based system compatible with the serial port of the IBM PC.
In the original version of 8051, one machine cycle lasts 12 oscillator periods. Therefore,
to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the crystal
frequency and its inverse is taken.

Light-emitting diode (LED)


Light-emitting diodes are elements for light signalization in electronics. They are
manufactured in different shapes, colors and sizes. For their low price, low consumption
and simple use, they have almost completely pushed aside other light sources- bulbs at
first place. They perform similar to common diodes with the difference that they emit
light when current flows through them.

It is important to know that each diode will be immediately destroyed unless its current is
limited. This means that a conductor must be connected in parallel to a diode. In order to
correctly determine value of this
conductor, it is necessary to know
diodes voltage drop in forward
direction, which depends on what
material a diode is made of and what
colour it is. Values typical for the most
frequently used diodes are shown in
table below: As seen, there are three
main types of LEDs. Standard ones get
ful brightness at current of 20mA. Low Current diodes get ful brightness at ten times
lower current while Super Bright diodes produce more intensive light than Standard ones.
Since the 8051 microcontrollers can provide only low input current and since their pins
are configured as outputs when voltage level on them is equal to 0, direct connectining to
LEDs is carried out as it is shown on figure (Low current LED, cathode is connected to
output pin).
Switches and Pushbuttons
There is nothing simpler than this! This is the simplest way of controlling appearance of
some voltage on microcontrollers input pin. There is also no need for additional
explanation of how these components operate.

Nevertheless, it is not so simple in practice... This is about something commonly


unnoticeable when using these components in everyday life. It is about contact bounce- a
common problem with m e c h a n i c a l switches. If contact switching does not happen
so quickly, several consecutive bounces can be noticed prior to maintain stable state. The
reasons for this are: vibrations, slight rough spots and dirt. Anyway, whole this process
does not last long (a few micro- or miliseconds), but long enough to be registered by
themicrocontroller. Concerning pulse counter, error occurs in almost 100% of cases!

The simplest solution is to connect simple RC circuit which will suppress each quick
voltage change. Since the bouncing time is not defined, the values of elements are not
strictly determined. In the most cases, the values shown on figure are sufficient.
If complete safety is needed, radical measures should be taken! The circuit, shown on the
figure (RS flip-flop), changes logic state on its output with the first pulse triggered by
contact bounce. Even though this is more expensive solution (SPDT switch), the problem
is definitely resolved! Besides, since the condensator is not used, very short pulses can be
also registered in this way. In addition to these hardware solutions, a simple software
solution is commonly applied too: when a program tests the state of some input pin and
finds changes, the check should be done one more time after certain time delay. If the
change is confirmed it means that switch (or pushbutton) has changed its position. The
advantages of such solution are obvious: it is free of charge, effects of disturbances are
eliminated too and it can be adjusted to the worst-quality contacts.
SWITCH INTERFACING:
CPU accesses the switches through ports. Therefore these switches are connected
to a microcontroller. This switch is connected between the supply and ground terminals.

A single microcontroller (consisting of a microprocessor, RAM and EEPROM and


several ports all on a single chip) takes care of hardware and software interfacing of the
switch.
These switches are connected to an input port. When no switch is pressed, reading
the input port will yield 1s since they are all connected to high (Vcc). But if any switch is
pressed, one of the input port pins will have 0 since the switch pressed provides the path
to ground. It is the function of the microcontroller to scan the switches continuously to
detect and identify the switch pressed.
The switches that we are using in our project are 4 leg micro switches of
momentary type.
Vcc

R
P2.0

Gnd
Fig: Interfacing switch with the microcontroller
Thus now the two conditions are to be remembered:
1. When the switch is open, the total supply i.e., Vcc appears at the port pin P2.0
P2.0 = 1
2. When the switch is closed i.e., when it is pressed, the total supply path is
provided to ground. Thus the voltage value at the port pin P2.0 will be zero.
P2.0 = 0

By reading the pin status, the microcontroller identifies whether the switch is
pressed or not. When the switch is pressed, the corresponding related to this switch press
written in the program will be executed.

Alphanumeric LCD
Liquid Crystal Display also called as LCD is very helpful in providing user interface as
well as for debugging purpose. The most commonly used Character based LCDs are
based on Hitachi's HD44780 controller or other which are compatible with HD44580.
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line
LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs
supporting more than 80 characters make use of 2 HD44780 controllers.
Pin Description

Pin No.

Name

Description

VSS

Power supply (GND)

VCC

Power supply (+5V)

VEE

RS

Contrast adjust
0 = Instruction input

R/W

1 = Data input
0 = Write to LCD module
1 = Read from LCD module

EN

Enable signal

D0

Data bus line 0 (LSB)

D1

Data bus line 1

D2

Data bus line 2

10

D3

Data bus line 3

11

D4

Data bus line 4

12

D5

Data bus line 5

13

D6

Data bus line 6

14

D7

Data bus line 7 (MSB)

15

LED+

Back Light VCC

16

LED-

Back Light GND

DDRAM - Display Data RAM


Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its
extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM
(DDRAM) that is not used for display can be used as general data RAM. So whatever
you send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16
characters are visible, so whatever you write after 16 chars is written in DDRAM but is
not visible to the user.
CGROM - Character Generator ROM
Now you might be thinking that when you send an ASCII value to DDRAM, how the
character is displayed on LCD? So the answer is CGROM. The character generator ROM
generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes. It can
generate 208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns.
CGRAM - Character Generator RAM
As clear from the name, CGRAM area is used to create custom characters in LCD. In the
character generator RAM, the user can rewrite character patterns by program. For 5 x 8

dots, eight character patterns can be written, and for 5 x 10 dots, four character patterns
can be written.
BF - Busy Flag
Busy Flag is a status indicator flag for LCD. When we send a command or data to the
LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed
successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount
of delay for the LCD processing.
To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the
LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept
next command or data and BF = 0 means LCD is ready for the next command or data to
process.
Instruction Register (IR) and Data Register (DR)
There are two 8-bit registers in HD44780 controller Instruction and Data register.
Instruction register corresponds to the register where you send commands to LCD e.g.
LCD shift command, LCD clear, LCD address etc. and Data register is used for storing
data which is to be displayed on LCD. When send the enable signal of the LCD is
asserted, the data on the pins is latched in to the data register and data is then moved
automatically to the DDRAM and hence is displayed on the LCD. Data Register is not
only used for sending data to DDRAM but also for CGRAM, the address where you want
to send the data, is decided by the instruction you send to LCD.
Commands and Instruction set
Only the instruction register (IR) and the data register (DR) of the LCD can be controlled
by the MCU. Before starting the internal operation of the LCD, control information is
temporarily stored into these registers to allow interfacing with various MCUs, which
operate at different speeds, or various peripheral control devices. The internal operation
of the LCD is determined by signals sent from the MCU. These signals, which include

register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7),
make up the LCD instructions (Table 3). There are four categories of instructions that:

Designate LCD functions, such as display format, data length, etc.

Set internal RAM addresses

Perform data transfer with internal RAM

Perform miscellaneous functions

Although looking at the table you can make your own commands and test them. Below is
a brief list of useful commands which are used frequently while working on the LCD.

No.

Instruction

Hex

Decimal

1
2
3
4
5

Function Set: 8-bit, 1 Line, 5x7 Dots


Function Set: 8-bit, 2 Line, 5x7 Dots
Function Set: 4-bit, 1 Line, 5x7 Dots
Function Set: 4-bit, 2 Line, 5x7 Dots
Entry Mode
Display off Cursor off

0x30
0x38
0x20
0x28
0x06

48
56
32
40
6

(clearing display without clearing DDRAM

0x08

7
8
9
10
12
13
14
15

content)
Display on Cursor on
Display on Cursor off
Display on Cursor blinking
Shift entire display left
Shift entire display right
Move cursor left by one character
Move cursor right by one character
Clear Display (also clear DDRAM content)
Set DDRAM address or cursor position on

0x0E
0x0C
0x0F
0x18
0x1C
0x10
0x14
0x01

14
12
15
24
30
16
20
1

0x80+add

128+add

16

display

17

Set CGRAM address or set pointer to CGRAM


location

Sending Commands to LCD

0x40+add

64+add

To send commands we simply need to select the command register. Everything is same as
we have done in the initialization routine. But we will summarize the common steps and
put them in a single subroutine. Following are the steps:

move data to LCD port

select command register

select write operation

send enable signal

wait for LCD to process the command

Sending Data to LCD


To send data we simply need to select the data register. Everything is same as the
command routine. Following are the steps:

move data to LCD port

select data register

select write operation

THEORY OF DC MOTOR
The speed of a DC motor is directly proportional to the supply voltage, so if we reduce
the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can
this be achieved when the battery is fixed at 12 Volts? The speed controller works by
varying the average voltage sent to the motor. It could do this by simply adjusting the
voltage sent to the motor, but this is quite inefficient to do. A better way is to switch the
motor's supply on and off very quickly. If the switching is fast enough, the motor doesn't
notice it, it only notices the average effect.
When you watch a film in the cinema, or the television, what you are actually seeing is a
series of fixed pictures, which change rapidly enough that your eyes just see the average
effect - movement. Your brain fills in the gaps to give an average effect.

Now imagine a light bulb with a switch. When you close the switch, the bulb goes on
and is at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts).
Now if you close the switch for a fraction of a second, then open it for the same amount
of time, the filament won't have time to cool down and heat up, and you will just get an
average glow of 50 Watts. This is how lamp dimmers work, and the same principle is
used by speed controllers to drive a motor. When the switch is closed, the motor sees 12
Volts, and when it is open it sees 0 Volts. If the switch is open for the same amount of
time as it is closed, the motor will see an average of 6 Volts, and will run more slowly
accordingly. The graph below shows the speed of a motor that is being turned on and off

H-BRIDGE:
An H-bridge is an electronic circuit which enables DC electric motors to be run forwards
or backwards. These circuits are often used in robotics. H-bridges are available as
integrated circuits, or can be built from discrete components.

The two basic states of a H-bridge.The term "H-bridge" is derived from the typical
graphical representation of such a circuit. An H-bridge is built with four switches (solid-

state or mechanical). When the switches S1 and S4 (according to the first figure) are
closed (and S2 and S3 are open) a positive voltage will be applied across the motor. By
opening S1 and S4 switches and closing S2 and S3 switches, this voltage is reversed,
allowing reverse operation of the motor.
Using the nomenclature above, the switches S1 and S2 should never be closed at the
same time, as this would cause a short circuit on the input voltage source. The same
applies to the switches S3 and S4. This condition is known as shoot-through.
Operation
The H-Bridge arrangement is generally used to reverse the polarity of the motor, but can
also be used to 'brake' the motor, where the motor comes to a sudden stop, as the motors
terminals are shorted, or to let the motor 'free run' to a stop, as the motor is effectively
disconnected from the circuit. The following table summarizes operation.

S
1

S2

S
3

S4

1 0 0 1

0 1 1 0

Result

Motor moves
right

Motor moves
left

0 0 0 0 Motor free runs

0 1 0 1 Motor brakes

H-Bridge Driver:
The switching property of this H-Bridge can be replace by a Transistor or a Relay or a
Mosfet or even by an IC. Here we are replacing this with an IC named L293D as the
driver whose description is as given below.

Features:

600mA OUTPUT CURRENT CAPABILITY

PER CHANNEL

1.2A PEAK OUTPUT CURRENT (non repetitive)

PER CHANNEL

ENABLE FACILITY

OVERTEMPERATURE PROTECTION

LOGICAL "0" INPUT VOLTAGE UP TO 1.5 V

(HIGH NOISE IMMUNITY)

INTERNAL CLAMP DIODES

DESCRIPTION
The Device is a monolithic integrated high voltage, high current four channel driver
designed toaccept standard DTL or TTL logic levels and drive inductive loads (such as
relays solenoides, DCand stepping motors) and switching power transistors. To simplify
use as two bridges each pair of channels is equipped with an enable input. A separate
supply input is provided for the logic, allowing operation at a lower voltage and internal
clamp diodes are included. This device is suitable for use in switching applications at
frequencies up to 5 kHz. The L293D is assembled in a 16 lead plastic packaage which has
4 center pins connected together and used for heatsinkingThe L293DD is assembled in a
20 lead surface mount which has 8 center pins connected together and used for
heatsinking.

BLOCK DIAGRAM

ABSOLUTE MAXIMUM RATINGS

PIN CONNECTIONS

FIRE SENSOR:
Flame detection is the technology for detecting flames, using a flame
detector. Flame detectors are optical equipment for the detection of flame
phenomena of a fire. There are two categories of flame detection:

Flame detector for the detection of a fire in a fire alarm system

Flame scanner for monitoring the condition of a flame in a burner

Several different methods of flame detection are possible.


Contents
1 Spectrum
o

1.1 Ultraviolet

1.2 Visible light

1.3 Near Infrared

1.4 Wideband infrared

2 Emission of radiation

3 Sunlight

4 Heat radiation

5 Cone of vision

6 The detection range

7 The square law


Spectrum

Spectrum

Ultraviolet
An ultraviolet (UV) sensor is often sensitive for radiation in the 185 to
260 nm range. This frequency range is the least sensitive for
natural background radiation sources like cosmic radiation and especially
sunlight. The sunlight is, in the higher frequencies, absorbed by almost all
vapours and gases; especially by ozone and smoke but also by an oil or
grease film on the window of a flame detector. Almost every fire
radiates UV light, and the UV sensor is a good all round flame detector. A
disadvantage is that quite a few artificial false-alarm sources occur;
like halogen and quartz lighting (without regular glass), electrical welding,
corona and static arcs.
Visible light
A visible light sensor (for example a camera: 0.4 to 0.7 m) is able to
present an image, which can be understood by a human being. Furthermore
complex image processing analysis can be executed by computers, which
can recognize a flame or even smoke. Unfortunately, a camera can be
blinded, like a human, by heavy smoke and by fog. It is also possible to mix
visible light information (monitor) with UV or Infrared information, which
in this case is made visible. The corona camera is an example of this
equipment. In this equipment the information of an UV camera mixed with
visible image information. It is used for tracing defects in high
voltage equipment and fire detection over high distances.
Near Infrared
A near Infrared(IR) sensor (0.7 to 1.1 m) is especially able to monitor
flame phenomena, without too much hindrance from water and water
vapour. Pyroelectric sensors operating at this wavelength can be relatively
cheap. Multiple channel or pixel array sensors monitoring flames in the near

IR band are arguably the most reliable technologies available for detection
of fires. Light emission from a fire forms an image of the flame at a
particular instant. Digital image processing can be utilized to recognize
flames through analysis of the video created from the near IR images.
Wideband infrared
A wideband infrared sensor (1.1 m and higher) monitors especially the heat
radiation of a fire. A special frequency range is 4.3 to 4.4 m. This is a
resonance frequency of [[CO2]]. During burning of ahydrocarbon (for
example, wood or fossil fuels such as oil and natural gas) much heat and
CO2 is released. The hot CO2 emits much energy in its resonance frequency
of 4.3 m. This causes a peak in the total radiation emission and can be well
detected. Moreover, the "cold" CO2 in the air is taking care that the sunlight
and other IR radiation is filtered. This makes the sensor in this frequency
"Solar blind", however sensitivity is reduced by sunlight. By observing the
flicker frequency of a fire (1 to 20 Hz) the detector is made less sensitive to
false alarms, caused by heat radiation, for example caused by hot machinery.
Multi-Infrared detectors make use of algorithms to suppress the effects of
background radiation (blackbody radiation), again sensitivity is reduced by
this radiation.
A severe disadvantage is that almost all radiation can be absorbed by water
or water vapour, but particularly this is valid for infrared flame detection in
the 4.3 to 4.4 m region. From approx. 3.5 m and higher the absorption by
water or ice is practically 100%. This makes the infrared sensor for use in
outdoor applications very unresponsive to fires. The biggest problem is our
ignorance, some infrared detectors have an (automatic) detector window self
test, but this self test only monitors the occurrence of water or ice on the
detector window.
A salt film is also harmful, because salt absorbs water. However, water
vapour, fog or light rain also makes the sensor almost blind, without the user
knowing. The cause is similar to what a fire fighter does if he approaches a
hot fire: he protects himself by means of a water vapour screen against the
enormous infrared heat radiation. The presence of water vapor, fog, or light
rain will then also "protect" the monitor causing it to not see the fire. Visible
light will, however be transmitted through the water vapour screen, as can
easily been seen by the fact that a human can still see the flames through the
water vapour screen.
Emission of radiation

Emission of radiation
A fire emits radiation, which human eye experiences as the visible yellow
red flames and heat. In fact, during a fire, relatively sparsely UV energy and
visible light energy is emitted, as compared to the emission of Infrared
radiation. A non-hydrocarbon fire, for example, one from hydrogen, does not
show a CO2 peak on 4.3 m because during the burning of hydrogen no
CO2 is released. The 4.3 m CO2 peak in the picture is exaggerated, and is in
reality less than 2% of the total energy of the fire. A multi-frequencydetector with sensors for UV, visible light, near IR and/or wideband IR thus
have much more "sensor data" to calculate with and therefore are able to
detect more types of fires and to detect these types of fires better:
hydrogen, methanol, ether orsulphur. It looks like a static picture, but in
reality the energy fluctuates, or flickers. This flickering is caused by the fact
that the aspirated oxygen and the present combustible are burning and
concurrently aspirate new oxygen and new combustible material. These little
explosions cause the flickering of the flame.
Sunlight

Sunlight transmission

The sun emits an enormous amount of energy, which could be harmful to


human beings if not for the vapours and gases in the atmosphere, like water
(clouds), ozone, and other vapours and gases in the air, through which the
sunlight is filtered. In the figure it can well be seen that "cold" CO 2 filters
the solar radiation around 4.3 m. The Infrared detector which uses this
frequency is therefore solar blind. Not all manufacturers of flame detectors
use sharp filters for the 4.3 m radiation and thus still pick up quite an
amount of sunlight. These cheap flame detectors are hardly usable for
outdoor applications. Between 0.7 m and approx. 3 m there is relatively
large absorption of sunlight. Hence, this frequency range is used for flame
detection by a few flame detector manufacturers (in combination with other
sensors like ultraviolet, visible light, or near infrared. The big economical
advantage
is,
that
no
expensive sapphire detector
windows
but quartz windows
can
be
applied.
These electro-optical
sensor combinations also enable the detection of none-hydrocarbons like
hydrogen fires without the risk of false alarms, caused by artificial light or
electrical welding.
Heat radiation

Heat Radiation
Infrared flame detectors suffer from Infrared heat radiation which is not
emitted by the possible fire. One could say, that the fire can be masked by
other heat sources. All objects which have a temperature higher than the
absolute minimum temperature (0 kelvins or 273.15 C) emit energy and at
room temperature (300 K) is this heat already a problem for the infrared
flame detectors with the highest sensitivity. Sometimes a moving hand is
sufficient to get the IR flame detector in an alarm. At 700 K a hot object
(black body) already starts to emit visible light (glowing). Dual- or multiinfrared detectors suppress the effects of heat radiation by means of sensors
which detect just off the CO2 peak; for example on 4.1 m. Here it is

necessary that there is a large difference in output between the applied


sensors (for example sensor S1 and S2 in the picture above). A disadvantage
is, that the radiation energy of a possible fire must be much bigger than the
present background heat radiation. In other words, the flame detector
becomes less sensitive. Every multi infrared flame detector is negatively
influenced by this effect, regardless how expensive it is.
Cone of vision

Cone of Vision (Field of View)


The cone of vision of a flame detector is determined by the shape and size of
the window and the housing and the location of the sensor in the housing.
For infrared sensors also the lamination of the sensor material plays a part; it
limits the cone of vision of the flame detector. A wide cone of vision does
not automatically mean that the flame detector is better. For some
applications the flame detector needs to be aligned precisely to take care that
it does not detect potential background radiation sources. The cone of vision
of the flame detector is three dimensional and is not necessarily perfectly
round. The horizontal angle of vision and the vertical angle of vision often
differ; this is mostly caused by the shape of the housing and by mirroring
parts (meant for the self test). Different combustibles can even have a
different angle of vision in the same flame detector. Very important is the
sensitivity at angles of 45. Here at least 50% of the maximum sensitivity at
the central axis must be achieved. Some flame detectors here achieve 70% or
more. In fact these flame detectors have a total horizontal angle of vision of
more than 90, but most of the manufacturers do not mention this. A high
sensitivity on the edges of the angle of vision provides advantages for the
projection of a flame detector.
[edit]The detection range

Detection Range
The range of a flame detector is highly determined by the mounting location.
In fact, when making a projection, one should imagine in what the flame
detector sees. A rule of thumb is, that the mounting height of the flame
detector is twice as high as the highest object in the field of view. Also the
accessibility of the flame detector must be taken into account, because of
maintenance and/or repairs. A rigid light-mast with a pivot point is for this
reason recommendable. A roof on top of the flame detector (30 x 30 cm, 1
x 1-foot) prevents quick pollution in outdoor applications. Also the shadow
effect must be considered. The shadow effect can be minimized by mounting
a second flame detector in the opposite of the first detector. A second
advantage of this approach is, that the second flame detector is a redundant
one, in case the first one is not working or is blinded. In general, when
mounting several flame detectors, one should let them look to each other
not let them look to the walls. Following this procedure blind spots (caused
by the shadow effect) can be avoided and a better redundancy can be
achieved than if the flame detectors would look from the central position
into the to be protected area. The range of flame detectors to the 30 x 30 cm,
1 x 1-foot industry standard fire is stated within the manufacturers data
sheets and manuals, this range can be affected by the previously stated desensitizing effects of sunlight, water, fog, steam and blackbody radiation.
The square law

Square Law
The square law applies to flame detection and relates the flame area and the
distance from the flame to the flame detector: If a flame detector can detect a
fire with an area A on a certain distance, then a 4 times bigger flame area is

necessary if the distance between the flame detector and the fire is doubled.
In short:
Double distance = four times bigger flame area (fire).
This law is valid for all flame detectors, also for the ones, which are based
on camera technique. It is a law, which is valid for all optical detectors. The
maximum sensitivity can be determined by dividing the maximum flame
area A by the square of the distance between the fire and the flame
detector: c =A/d2. With this constant c can, for the same flame detector and
the same type of fire, the maximum distance or the minimum fire area be
calculated:A = cd2 and d = (A/c). It must be emphasized, however, that the
square root in reality is not valid anymore at very high distances. At long
distances other parameters are playing a significant part; like the occurrence
of water vapour and of cold CO2 in the air. In the case of a very small flame,
on the other hand, the decreasing flickering of the flame will play an
increasing part.
GSM-Introduction

Architecture
Technical Specifications

Frame Structure

Channels

Security
Characteristics and features

Applications

Definition:
Global System for Mobile (GSM) is a second generation cellular standard
developed to cater voice services and data delivery using digital modulation.

GSM-History
Developed by Group Special Mobile (founded 1982) which was an

initiative of

CEPT (Conference of European Post and Telecommunication)


Aim : to replace the incompatible analog system
Presently the responsibility of GSM standardization resides with special mobile
group under ETSI ( European telecommunication Standards Institute )

Full set of specifications phase-I became available in 1990

Under ETSI, GSM is named as Global System for Mobile communication


Today many providers all over the world use GSM (more than 135
Countries in Asia, Africa, Europe, Australia, America)
More than 1300 million subscribers in world and 45 million subscribers in India.

GSM IN WORLD

GSM IN INDIA

GSM SERVICES
Tele-services
Bearer or Data Services
Supplementary services

Tele-services
Telecommunication services that enable voice communication
via mobile phones
Offered services
- Mobile telephony
- Emergency calling

Bearer or Data Services

Include various data services for information transfer between GSM and other
networks like PSTN, ISDN etc at rates from 300 to 9600 bps
Short Message Service (SMS)

up to 160 character alphanumeric data transmission to/from the mobile


terminal

Unified Messaging Services(UMS)


Group 3 fax
Voice mailbox
Electronic mail

Supplementary services
Call related services :

Call Waiting- Notification of an incoming call while on the handset

Call Hold- Put a caller on hold to take another call

Call Barring- All calls, outgoing calls, or incoming calls

Call Forwarding- Calls can be sent to various numbers defined by the user

Multi Party Call Conferencing - Link multiple calls together

CLIP Caller line identification presentation

CLIR Caller line identification restriction

CUG Closed user group

GSM System Architecture-I


Mobile Station (MS)
Mobile Equipment (ME)

Subscriber Identity Module (SIM)


Base Station Subsystem (BSS)
Base Transceiver Station (BTS)
Base Station Controller (BSC)
Network Switching Subsystem(NSS)
Mobile Switching Center (MSC)
Home Location Register (HLR)
Visitor Location Register (VLR)
AuthenticationCenter (AUC)
Equipment Identity Register (EIR)

System Architecture Mobile Station (MS)


The Mobile Station is made up of two entities:
1. Mobile Equipment (ME)
2. Subscriber Identity Module (SIM)
Mobile Equipment
Portable,vehicle mounted, hand held device
Uniquely identified by an IMEI (International Mobile Equipment Identity)
Voice and data transmission
Monitoring power and signal quality of surrounding cells for optimum handover
Power level : 0.8W 20 W
160 character long SMS.

Subscriber Identity Module (SIM)


Smart card contains the International Mobile Subscriber Identity (IMSI)
Allows user to send and receive calls and receive other subscribed services
Encoded network identification details
- Key Ki,Kc and A3,A5 and A8 algorithms
Protected by a password or PIN
Can be moved from phone to phone contains key information to activate the
phone

System ArchitectureBase Station Subsystem (BSS)


Base Station Subsystem is composed of two parts that communicate across the
standardized Abis interface allowing operation between components made by different
suppliers
1. Base Transceiver Station (BTS)
2. Base Station Controller (BSC)
System Architecture Base Station Subsystem (BSS)
Base Transceiver Station (BTS):
Encodes,encrypts,multiplexes,modulates and feeds the RF signals to the antenna.
Frequency hopping
Communicates with Mobile station and BSC

Consists of Transceivers (TRX) units


Base Station Controller (BSC)
Manages Radio resources for BTS
Assigns Frequency and time slots for all MSs in its area
Handles call set up
Transcoding and rate adaptation functionality
Handover for each MS
Radio Power control
It communicates with MSC and BTS

System ArchitectureNetwork Switching Subsystem(NSS)


Mobile Switching Center (MSC)
Heart of the network
Manages communication between GSM and other networks
Call setup function and basic switching
Call routing
Billing information and collection
Mobility management
- Registration
- Location Updating
- Inter BSS and inter MSC call handoff
MSC does gateway function while its customer roams to other network by using
HLR/VLR.

System Architecture Network Switching Subsystem


Home Location Registers (HLR)
- Permanent database about mobile subscribers in a large service area (generally one per
GSM network operator)
Database

contains

IMSI,MSISDN,prepaid/postpaid,roaming

restrictions,and

supplementary services.
Visitor Location Registers (VLR)
-

Temporary database which updates whenever new MS enters its


area, by HLR database

Controls those mobiles roaming in its area

Reduces number of queries to HLR

Database

contains

IMSI,TMSI,MSISDN,MSRN,Location

Area,authentication key
AuthenticationCenter (AUC)
-

Protects against intruders in air interface

Maintains authentication keys and algorithms and provides


security triplets ( RAND,SRES,Kc)

Generally associated with HLR

Equipment Identity Register (EIR)


- Database that is used to track handsets using the IMEI (International
Mobile Equipment Identity)
-

Made up of three sub-classes: The White List, The Black List and
the Gray List

Only one EIR per PLMN

GSM Specifications-1

RF Spectrum
GSM 900
Mobile to BTS (uplink): 890-915 Mhz
BTS to Mobile(downlink):935-960 Mhz
Bandwidth : 2* 25 Mhz
GSM 1800
Mobile to BTS (uplink): 1710-1785 Mhz
BTS to Mobile(downlink) 1805-1880 Mhz
Bandwidth : 2* 75 Mhz

GSM Specification-II
Carrier Separation : 200 Khz
Duplex Distance

: 45 Mhz

No. of RF carriers : 124


Access Method

: TDMA/FDMA

Modulation Method : GMSK


Modulation data rate : 270.833 Kbps

OPERATION OF GSM

Call Routing
Call Originating from MS
Call termination to MS
Outgoing Call

1. MS sends dialed number to BSS


2. BSS sends dialed number to MSC
3,4

MSC checks VLR if MS is allowed the requested service. If so,MSC asks BSS

toallocate resources for call.


5

MSC routes the call to GMSC

GMSC routes the call to local exchange of called user

7, 8,
9, 10

Answer back (ring back) tone is routed from called user to MS via

GMSC,MSC,BSS
Incoming Call

1. Calling a GSM subscribers


2. Forwarding call to GSMC
3. Signal Setup to HLR
4. 5. Request MSRN from VLR
6. Forward responsible MSC to GMSC
7. Forward Call to current MSC
8. 9. Get current status of MS
10. 11. Paging of MS
12. 13. MS answers
14. 15. Security checks
16. 17. Set up connection
Handovers

Between 1 and 2 Inter BTS / Intra BSC


Between 1 and 3
Inter BSC/ Intra MSC
Between 1 and 4
Inter MSC
Security in GSM
On air interface, GSM uses encryption and TMSI instead of IMSI.
SIM is provided 4-8 digit PIN to validate the ownership of SIM
3 algorithms are specified :
- A3 algorithm for authentication
- A5 algorithm for encryption

- A8 algorithm for key generation


Characteristics of GSM Standard
Fully digital system using 900,1800 MHz frequency band.
TDMA over radio carriers(200 KHz carrier spacing.
8 full rate or 16 half rate TDMA channels per carrier.
User/terminal authentication for fraud control.
Encryption of speech and data transmission over the radio path.
Full international roaming capability.
Low speed data services (upto 9.6 Kb/s).
Compatibility with ISDN.
Support of Short Message Service (SMS).

Advantages of GSM over Analog system:


Capacity increases
Reduced RF transmission power and longer battery life.
International roaming capability.
Better security against fraud (through terminal validation and user authentication).
Encryption capability for information security and privacy.
Compatibility with ISDN,leading to wider range of services
GSM Applications
Mobile telephony

GSM-R
Telemetry System
- Fleet management
- Automatic meter reading
- Toll Collection
- Remote control and fault reporting of DG sets
Value Added Services

RELAYS
Relay and Switch:
1. Mechanical relay:
Typical Mechanical Relay connection pin
This is a very important section. The introduction to this electrical control switch, call a
Relay. It is basically a device to activate a mechanical switch, by electrical means. This is
unlike a switch which is
activated manually. In another words it is a device that convert electrical signal to a
mechanical energy back to electrical signal again.Similar to mechanical switch, they can
be described as 2P2T, single
pole double throw, etc...
How it works? A electrical voltage will be applied to activate a coil in the relay. The
coil being powered up, will generate a magnetic force that will attract the lever. This lever
will be pulled towards the magnetized coil, causing an action that will switch the
mechanical contact.
Why on earth this relay is for? Why is there a need to convert electrical to mechanical
to electrical again?
A example would be that you may want to switch on your home 230Vac power remotely
from your friend house 1km away. To do this, one possibility is to lay cables thick

between your friend's home and your home. The cable must be thick enough to handle the
high current and 230Vac voltage. Using a 230Vac rated switch, which is relatively bigger
in size, it can be mounted in your friends home in order
to do the switching.
Another cool method is that you can deploy a relay to help switching the 230Vac in
your own house, while a thinner wire and lower rating
switch laid across your friend's house. This is one of the use of a relay.To be exact, the
relay helps to control energy from a electrical signal to
a mechanical energy to electrical power. Other application can be, controlling a high
power motor using tiny switch, or to switch on the house lightings using your computer
system digital signal.
The application of relay is important, as it is still widely used in control application. It
can be thought of as a amplifier. A powered signal can be produced by using a small
signal. This principle is similar to the use of a transistor as a switch. Knowledge in the
relay will certainly aid understanding the transistor, commonly seen in circuit interfacing.

Another common use of relay is to act as a isolator output for communication or I/O
between unknown electrical system. This isolated output acts as a mean for electronic
hardware to communicate
without affecting another electronics system. System design will be simpler, while
integration/troubleshooting work will be easier and
faster, because system can be isolated easily.
For example, one company may have a robotic application which require mobility
and high current discharge. A 12V SLA sealed lead acid battery would certainly meet this
requirement. A mobile phone
company is following the market trend and will be designing a 3.3V electronics circuits
which has the advantage of size and energy efficiency. Another one may choose to deploy
5V system, because they have been using some critical component which requires 5V.

How are their design able to communicate or control another system using a different
voltage system. They may use communication standard like
RS232 to communication between systems. However the design will be considerably too
complex if the communication requires only 1 bit of information, either on or off.
The operation of a relay as an isolated output is simple. The system X that activate the
relay provides a switch contact to indicate logic 1 or 0 to the receiving system Y. Y
provides its own power and interfacing circuit to sense if the switch is close or open.
Since there is no voltage interaction between the two system, some people defined this as
a "Dry Contact interface". System X activating the relay has provides a "Dry Contact" or
a switch contact output without any electrical signal transmitted to system Y. Dry contact
does not mean that no electrical current flow. It simply mean that Y will provide its own
electrical circuit to obtain the output signal from X. For further information on detecting
switch status, you can refer to the section on mechanicalswitch.

2. Reed relay :
Reed Relay is a smaller version of relay. Package is inplastic. It is about the same
size as a 14 pin DIP IC socket. It has a slightly different magnetize structure,however the
principle is the same as a mechanical relay. Since it is small, this reed relay is suitable for
handling signal, and not high power or high current drawing load. Switching sound is
hardly noticeable. You can still be able to hear some tick tick sound when it is activate.
Switching speed is considerable faster than a relay because the switch mechanism inside
the package is small.
Application for a reed relay can be for output signal isolation purposes or for
switching on small current load. Example of small load devices that can be switched on
might be LED, DC buzzer, relay, circuit or sensors. Typical current handling capacity is
of about 0.5A load.
Reed relay comes in different type of forms. Forms
refers to the nature of the switch contact. For further
information on "contact forms", refer to the switch
section above.

3. Solid state relay:


This is newer switch device known as Solid State Relay (SSR) or MOSFET relay. It
is a semiconductor device, to replace the mechanical relay as a reliable alternative. In
solid state relay, the input and switched output have voltage polarity. Be careful not to
connect to the wrong terminal. Some SSR are design to have the same package and pin
layout design as a reed relay. It looks like a reed relay. You
can differential between a reed and a SSR device by testing it's input terminal. A reed
relay is able to function with a reverse input priority, however a SSR will not be able to
function with reverse input priority.
The solid state relay can be smaller than a mechanical relay. It is a soft start device and
does not result in current slug or arcing effect. It has no
mechanical switching and is able to do faster switching. This mean that there are no
noise, no glitches mechanical switching, lesser wear and
tear. All these advantage adds up to longer lasting and more reliable device. The device
works with a wider range of input voltage (typical
3V to 12V) and consume relatively less power to turn on the switch.
Like other semiconductor devices, they do have their disadvantages. The component
have current leakage when inactive and dissipate heat during operation. Heat sink may be
required to prevent overheating. With a heat sink mounted, the whole design could be a
lot larger than the mechanical relay alternative. The heat sink itself can be up to 5
times the size of the SSR. If you don't want to mount the huge heat sink to the device,
you can try using a SSR that have a much higher current rating, of at least 2 times the
capacity of what is required. At least it will not be very hot. If possible, mount it to a
metal chassis or metal surface to act as a heat sink to dissipate the heat.

Switch:
1.Wire connection:
Long long time ago, circuit connection is achieved usingmuscular means. The
telephone network is one of a majorcommunication system in the early days. To Call your
buddynext block, the first step you have to do is to pick up the phone. A human operator
will attend to your pick up. Speakto her about the intention to talk to your buddy. The
operator will manually plunk in wire connector linking your home telephone to your
buddy phone. And Yes, you can now talk to your friend because there are operator doing
the switching at the end of your telephone line.
Sounds a lot of manual work. Yes, this is the good old days. The telephone operators in
the central telephone exchange house, are making the circuit connection manually. This is
what this page is all about. All about switches.All about making a good short circuit. Not
all short circuit is bad. In fact they are the fundamental building blocks in digital
electronics. Many electronic design/interface are as simple as a switch.In the articles that
follows, it will be about the various type of electronics components that can help you in
the creation of the perfect short circuits.

2.Mechanical switch:
Mechanical switches is a simple type of interface to control electrical stuff using the
means of some mechanical action. In short, a switch is a mechanical to electrical
conversion device. I can't find any history on the evolution of the mechanical switches. I
guess people might have become smarter. Rather than using a jumper wire to make
connection manually, human invented switch to make short circuiting task more efficient.
Tedious and time consuming work. Plucking the wires in and out
takes a lot more effort, compare to toggling switches.Of course mechanical switches are
not suitable for telephone exchange application for the millions of household. However
understand the roles of switches..
The greatest thing to understand about switches is allabout the component/device
rating. Some people
refer it as the power handling capacity, which is the voltage and the current. The voltage
it can handle across the switch terminals without destroying itself. Sometimes refer to as
the breakdown voltage. The maximum amount of current that can flow through, without
destroying itself. Sometimes refer to as the load current the switch can support.
In fact, the whole idea of this "switch" thingy is aboutunderstanding the rating and
capabilities of the various type of electronics components. I mean it applies to all the
electronics devices, includingeven wires. To me, this is also the most important concept
towards understanding of all other electronics. It is so important. Fortunately it is also
easy to understand, if you pay enough attention in this topic. Not just switch have rating.
Wire also have it's rating, since we know that switch is in fact another form of wire, or to
be precise we call it a conductor. Like the size of a water pipe, there is a limit on the
water flow rate. If the pipe diameter size is small, flow rate will be small too. Larger
diameter pipe more water can flow. This is what they mean by the term "current rating".
Larger wire size can carry more current. Small wire may also carry the same current at

the expense of increase temperature. When it gets too hot, the wire will just burn off, just
like what a fuse do.

KEIL SOFTWARE:
Keil compiler is software used where the machine
language code is written and compiled. After compilation,
the machine source code is converted into hex code which is
to be dumped into the microcontroller for further processing.
Keil compiler also supports C language code.
STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM
IN KEIL AND HOW TO COMPILE IT:
1. Install the Keil Software in the PC in any of the drives.
2. After installation, an icon will be created with the name
Keil uVision3. Just drag this icon onto the desktop so
that it becomes easy whenever you try to write
programs in Keil.
3. Double click on this icon to start the keil compiler.
4. A page opens with different options in it showing the
project workspace at the leftmost corner side, output
window in the bottom and an ash coloured space for
the program to be written.
5. Now to start using the keil, click on the option project.
6. A small window opens showing the options like new
project, import project, open project etc. Click on New
project.

7. A small window with the title bar Create new project


opens. The window asks the user to give the project
name with which it should be created and the
destination location. The project can be created in any
of the drives available. You can create a new folder and
then a new file or can create directly a new file.
8. After the file is saved in the given destination location,
a window opens where a list of vendors will be
displayed and you have to select the device for the
target you have created.
9. The most widely used vendor is Atmel. So click on
Atmel

and

now

the

family

of

microcontrollers

manufactured by Atmel opens. You can select any one


of the microcontrollers according to the requirement.

When you click on any one of the microcontrollers, the


features of that particular microcontroller will be displayed
on the right side of the page. The most appropriate
microcontroller with which most of the projects can be
implemented is the AT89C51. Click on this microcontroller
and have a look at its features. Now click on OK to select
this microcontroller.
10. A small window opens asking whether to copy the
startup code into the file you have created just now. Just
click on No to proceed further.

10.

Now you can see the TARGET and SOURCE GROUP

created in the project workspace.


11.

Now click on File and in that New. A new page

opens and you can start writing program in it.


12.

After the program is completed, save it with any

name but with the .asm extension. Save the program in


the file you have created earlier.
13.

You can notice that after you save the program,

the predefined keywords will be highlighted in bold


letters.
14.

Now add this file to the target by giving a right

click on the source group. A list of options open and in


that select Add files to the source group. Check for
this file where you have saved and add it.
15.

Right click on the target and select the first option

Options for target. A window opens with different


options like device, target, output etc. First click on
target.
16.

Since the set frequency of the microcontroller is

11.0592 MHz to interface with the PC, just enter this


frequency value in the Xtal (MHz) text area and put a
tick on the Use on-chip ROM. This is because the
program what we write here in the keil will later be
dumped into the microcontroller and will be stored in
the inbuilt ROM in the microcontroller.

17.

Now click the option Output and give any name

to the hex file to be created in the Name of


executable text area and put a tick to the Create HEX
file option present in the same window. The hex file
can be created in any of the drives. You can change the
folder by clicking on Select folder for Objects.
18.

Now to check whether the program you have

written is errorless or not, click on the icon exactly


below the Open file icon which is nothing but Build
Target icon. You can even use the shortcut key F7 to
compile the program written.
19.

To check for the output, there are several windows

like serial window, memory window, project window etc.


Depending on the program you have written, select the
appropriate window to see the output by entering into
debug mode.
20.

The icon with the letter d indicates the debug

mode.
21.

Click on this icon and now click on the option

View and select the appropriate window to check for


the output.
22.

After this is done, click the icon debug again to

come out of the debug mode.


23. The hex file created as shown earlier will be dumped

into the microcontroller with the help of software called


Proload.

KEIL SOFTWARE PROGRAMING PROCEDURE


How to write Embedded C Program in Keil Software.

Procedure Steps
Step-1:
Install Keil MicroVision-2 in your PC, Then after Click on
that Keil UVision-2 icon. After opening the window go
to toolbar and select Project Tab then close previous
project.

Step-2:
Next select New Project from Project Tab.

Step-3:
Then it will open Create New Project window. Select
the path where you want to save project and edit project
name.

Step-4:
Next it opens Select Device for Target window, It
shows list of companies and here you can select the device
manufacturer company.

Step-5:
For an example, for your project purpose you can select
the chip as 89c51/52 from Atmel Group. Next Click OK
Button, it appears empty window here you can observe left
side a small window i.e, Project Window. Next create a new
file.

Step-6:
From the Main tool bar Menu select File Tab and go to
New, then it will open a window, there you can edit the
program.

Step-7:
Here you can edit the program as which language will
you prefer either Assembly or C.

Step-8:
After editing the program save the file with extension as
.c or .asm, if you write a program in Assembly Language
save as .asm or if you write a program in C Language save
as .c in the selected path. Take an example and save the
file as test.c.

Step-9:
Then after saving the file, compile the program. For compilation go to project
window select source group and right click on that and go to Add files to Group.

Step-9:
Here it will ask which file has to Add. For an example
here you can add test.c as you saved before.

Step-9:
After adding the file, again go to Project Window and
right click on your c file then select Build target for
compilation. If there is any Errors or Warnings in your
program you can check in Output Window that is shown
bottom of the Keil window.

Step-10:
Here in this step you can observe the output window for
errors and warnings.

Step-11:
If you make any mistake in your program you can check
in this slide for which error and where the error is by clicking
on that error.

Step-12:
After compilation then next go to Debug Session. In Tool
Bar menu go to Debug tab and select Start/Stop Debug
Session.

Step-13:
Here a simple program for Leds Blinking. LEDS are
connected to PORT-1. you can observe the output in that
port.

Step-14:
To see the Ports and other Peripheral Features go to
main toolbar menu and select peripherals.

Step-15:
In this slide see the selected port i.e, PORT-1.

Step-16:
Start to trace the program in sequence manner i.e, step
by step execution and observe the output in port window.

Step-17:
After completion of Debug Session Create an Hex file
for Burning the Processor. Here to create an Hex file go to
project window and right click on Target next select Option
for Target.

Step-18:
It appears one window; here in target tab modify the
crystal frequency as you connected to your microcontroller.

Step-19:
Next go to Output tab. In that Output tab click on
Create HEX File and then click OK.

Step-16:
Finally Once again compile your program. The Created
Hex File will appear in your path folder.

1
Project implementation

You might also like