Beruflich Dokumente
Kultur Dokumente
Submitted by:
mentor:
Introduction
This idea came in my mind because the atm is not in complete security. because
thieves activity may different role such as .
If any person touch the atm then system automatically sense and
display the message ,weep alerting with generate the call to
responsible person automatically .this call indicate the problem or
a confirm signal. And automatically close the atm gate. this gate
cannot be open without authentication.
Component :
Microcontroller (at-89s52).
Lm-358.
Rf reader(em-18).
Rf Card.
Sensor (touch ,ir sensor).
Step-down transformer.
Regulator (7805).
Diode (in-4007).
Led.
Capacitor(27pf,1000uf,10uf,4.7uf).
Resistor(1k,10k,470ohm).
Motor.
opto- coupler (pc-817).
Transistor (npn,pnp).
CIRCUIT DIAGRAM:
U?
7805
D?
VI
VO
LCD?
GND
DIODE
C?
10p
C?
LM016L
R?
10k
10p
R?
D?
7
8
9
10
11
12
13
14
RS
RW
E
VSS
VDD
VEE
1
2
3
LED
D0
D1
D2
D3
D4
D5
D6
D7
10k
D?
DIODE
TRAN-2P2S
4
5
6
TR?
U?
8
7
6
5
4
3
2
1
C?
10p
R?
10k
31
30
29
P1.7
P1.6
P1.5
P1.4
P1.3
P1.2
P1.1/T2EX
P1.0/T2
P3.7/RD
P3.6/WR
P3.5/T1
P3.4/T0
P3.3/INT1
P3.2/INT0
P3.1/TXD
P3.0/RXD
P2.7/A15
P2.6/A14
P2.5/A13
P2.4/A12
P2.3/A11
P2.2/A10
P2.1/A9
P2.0/A8
EA
ALE
PSEN
RST
P0.7/AD7
P0.6/AD6
P0.5/AD5
P0.4/AD4
P0.3/AD3
P0.2/AD2
P0.1/AD1
P0.0/AD0
C?
10p
X?
C?
10p
18
19
CRYSTAL
XTAL2
XTAL1
17
16
15
14
13
12
11
10
RF CARD READER
28
27
26
25
24
23
22
21
1
32
33
34
35
36
37
38
39
U?
Q?
2
4
MOC3021
Q?
NPN
AT89C52
NPN
1
U?
Q?
U?
8
R
VCC
anti sensor
Q
DC
TR
TH
10p
PNP
R?
Q1
Q?
NPN
Q?
PNP
NPN
PNP
10k
555
Q?
PNP
MOC3021
C?
Q2
CV
GND
GSM CALLING
BUZZER
actual
place
of
work
with
with
must
compliment
often
use
of
in
those
project
RELAY
Relay
is
com mon,
sim ple
application
of
RESISTANCE
Resistance is t he opposit ion of a mat erial t o t he current .
It is measured in Ohm s (). All conductors represent a certain
amount of resist ance, since no conductor is 100% efficient . To
control the elect ron flow (current ) in a predict able m ann er, we
use
resistors.
Electronic
circuits
use
calibrat ed
lum ped
TRANSFORMER
PRINCIPLE OF THE TRANSFORMER:Two coils are wound over a Core such that t hey are
m agnet ically coupled. The t wo coils are known as t he primary
and secondary windings.
In a Transformer, an iron core is used. The coupling
between the coils is source of m aking a pat h for t he magnet ic
flux t o link bot h the coils. A core as in fig.2 is used and the
coils are wound on t he limbs of t he core. Because of high
permeability of iron, t he flux pat h for t he flux is only in t he
iron and hence t he flux links bot h windings. Hence t here is
very litt le leakage flux . This t erm leakage flux denot es t he
part of t he flux , which does not link bot h the coils, i.e., when
coupling is not perfect . In t he high frequency t ransformers,
ferrit e core is used. The transform ers may be st ep- up, st epdown, frequency mat ching, sound out put , am plifier driver etc.
The basic principles of all t he t ransf orm ers are sam e.
TRANSISTOR
The nam e is transist or derived from transfer resist ors
indicating a solid st at e Semiconduct or device. In addition to
conduct or and insulat ors, t here is a third class of material t hat
ex hibit s proportion of bot h. Under some condit ions, it acts as
an insulat or, and under ot her condit ions its a conductor. This
phenomenon is called Semi- conducting and allows a variable
control over elect ron flow. So, t he t ransistor is sem i conduct or
device used in elect ronics for amp lit ude. Transist or has three
t erminals, one is the collect or, one is the base and ot her is t he
emitt er, (each lead m ust be connect ed in t he circuit correctly
and only t hen t he t ransist or will funct ion). Elect rons are
emitt ed via one term inal and collect ed on anot her t erm inal,
while t he third t erm inal acts as a cont rol element . Each
t ransist or has a number marked on it s body. Every number has
it s own specificat ions.
There are m ainly t wo t ypes of t ransist or (i) NPN & (ii) PNP
NPN Transistors:
When a posit ive volt age is applied t o t he base, the
t ransist or begins t o conduct by allowing current to flow
t hrough t he collect or to em itt er circuit . The relatively sm all
current flowing t hrough the base circuit causes a m uch great er
current t o pass t hrough t he emit ter / collector circuit .
Th e
described
below.
Depending
upon
the
curren t
Schematic for obtaining low-voltage regulated output using 3-terminal voltage regulators.
CAPACITORS
It is an electronic component whose function is to accumulate
charges and then release it.
DIODE
The simplest semiconductor device is made up of a sandwich
of P- type semiconducting material, with contacts provided to
connect the p- and n- type layers to an ex ternal circuit. This is a
junction Diode. If the positive terminal of the battery is co nnected
to the p- type material (cathode) and the negative terminal to the Ntype material (Anode), a large current will flow. This is called
forward current or forward biased.
If the connections are reversed, a very little current will flow.
This is because under this condition, the p - type material will accept
the electrons from the negative terminal of the battery and the Ntype mat erial will give up its free electrons to the battery, resulting
in the state of electrical equilibrium since the N- type material has
no more electrons. Thus there will be a small current to flow and
the diode is called Reverse biased.
Thus the Diode allows direct current to pass only in one
direction while blocking it in the other direction. Power diodes are
used in concerting AC into DC. In this, current will flow freely
during the first half cycle (forward biased) and practically not at all
during the other half cycle (reverse biased). This makes the diode
an effective rectifier, which convert ac into pulsating dc. Signal
diodes are used in radio circuits for detection. Zener diodes are
used in the circuit to control the voltage.
Theft control
inside.
but the most common and widely used Reader frequency is 125
KHz.
If the
the
then door is
close.
Administrator authorize or un-authorised
rules.
We use this concept in
centre
or any paid
Block diagram
Every object at a temperature T not equal to 0 K emits radiation. Infrared radiant energy
is determined by the temperature and surface condition of an object. Human eyes
cannot detect differences in infrared energy because they are primarily sensitive to
visible light energy from 400 to 700 nm. Our eyes are not sensitive to the infrared
energy.
2.
The total energy emitted at all wavelengths by a black body is related to the absolute
temperature as
3.
Weins Law tells that objects of different temperature emit spectra that peak at different
wavelengths. It provides the wavelength for maximum spectral radiant emittance for a
given temperature.
The relationship between the true temperature of the black body and its peak spectral
exitance or dominant wavelength is described by this law
The world is not full of black bodies; rather it
comprises of selectively radiating bodies like rocks, water, etc. and the relationship
between the two is given by emissivity (E).
Emissivity
depends
on
object color, surface roughness, moisture content, degree of compaction, field of view,
viewing angle & wavelength.
1.
Infrared Source
All objects above 0 K radiate infrared energy and hence are infrared sources. Infrared
sources also include blackbody radiators, tungsten lamps, silicon carbide, and various
others. For active IR sensors, infrared Lasers and LEDs of specific IR wavelengths are
used as IR sources.
2.
Transmission Medium
Three main types of transmission medium used for Infrared transmission are vacuum,
the atmosphere, and optical fibers.
3.
Optical Components.
Often optical components are required to converge or focus infrared radiations, to limit
spectral response, etc. To converge/focus radiations, optical lenses made of quartz,
CaF2, Ge and Si, polyethylene Fresnel lenses, and mirrors made of Al, Au or a similar
material are used. For limiting spectral responses, bandpass filters are used. Choppers
are used to pass/ interrupt the IR beams.
4.
Infrared detectors.
Photosensitivity or Responsivity
Responsivity is the Output Voltage/Current per watt of incident energy. Higher the
better.
NEP represents detection ability of a detector and is the amount of incident light equal
to intrinsic noise level of a detector.
Detectivity(D*: D-star)
5.
Signal Processing
Since detector outputs are typically very small, preamplifiers with associated circuitry
are used to further process the received signals.
Three relay based circuit for the door open logic. Here in this
project we use three relay for any type of door open. IN this
project we use two relay for door open and one relay for
controlling the two relay. As the signal from controller is
connected to opto-coupler . Optocoupler connect first relay via
transistor and, other two relay work as a H bridge logic. Switch
connected to first relay is of the door open and close switch
components used:
Step down transformer 220 volt ac to 9-0-9 ac
Diode IN 4007 (2)
Capacitor 1000mfd (2), 27pf(2), 10mfd(1)
IC 7805 (1)
89S52 ( 8051 CONTROLLER)
Rf Reader ( 125kHtz ) serial interface
LCD 2by 16 ( alphanumeric lcd)
Push to on switch (9)
Resistor 470 ohm (1), 10k (1), 4k7(1).
Variable resistor 4.7k oh (1)
l.e.d (1)
cd Loader for door open (1)
crystal 12 Mhtz (1)
P.C.B
Rf CARD
CIRCUIT WORKING
in this project we use one 5 volt regulated power supply to convert the 220
volt ac in to 5 volt dc with the help of the 5 volt regulator circuit. First OF all
we step down the 220 volt ac into 6 volt ac with the help of step down
transformer. Step down transformer step down the voltage from 220 volt
ac to 9 volt ac. This ac is further converted into the dc voltage with the help
of the full wave rectifier circuit
Reset Circuitry:
This is not a big circuit we are just using a capacitor to charge the
microcontroller and again discharging via resistor.
Crystals
Pin no 18 and 19 is connected to external crystal oscillator to provide a
clock to the circuit.
Crystals provide the synchronization of the internal function and to the peripherals.
Whenever ever we are using crystals we need to put the capacitor behind it to make it
free from noises. It is good to go for a 33pf capacitor.
We can also use resonators instead of costly crystal which are low cost and
external capacitor can be avoided.
But the frequency of the resonators varies a lot. And it is strictly not advised
when used for communications projects.
into
ascii
code
and
Now when data is to be display on the lcd then first of all we register this
data for authorized and for unauthorized option. As we enter the 3 digit
password then circuit is activate. When password is okay then we press
authorized or unauthorized button. If we press authorized button then door
is open and when we press un-authorized button then door is closed.
Now microcontroller save this data in the ram memory. As we again show
the RF card to the door then now controller get the data and compare with
the ram content. If the data is to be match then door is open now and shut
off automatically after some tie
Theft control
Active tags, which contain a battery that powers the microchip and
allows it to transmit a signal to the reader.
Semi-active (or semi-passive) tags, which contain a battery to run the
circuitry of the chip, but must draw power from the magnetic field
created by the reader in order to communicate with the reader.
Passive tags, which rely solely on the magnetic field created by the
radio waves sent out by the reader to create a current that can be
received by the antenna within the passive tag.
RFID Construction
RFID Tag Components
RFID tags consist of a microchip connected to an antenna, which is
constructed of a small coil of wires. The assembly is usually covered with a
protective layer (such as a laminated card), which is determined by the type
of application. The RFID tag can be a passive tag or an active tag. The
RFID tag is also known as an inlay.
Components of passive RFID system:
The reader is the device that actually sends out the radio waves
to create a magnetic field. A passive RFID tag draws its power
from this magnetic field, which powers the circuits in the
microchip allowing it to transmit data back to the reader.
Microchip
The most expensive read/write, active RFID transponders may have
microchips with a memory capacity of up to one megabyte (1,000,000
characters). Most tags are inexpensive, passive transponders that can
store only 32 to 128 bits (characters) of information or less, so an
identification number is basically the only data that the read-only tag will
contain. When the number is read, detailed information stored in a
database in a computer can be accessed. This is similar to a barcode
system in which data, such as a price, is accessed when the barcode is
read. The main difference is that the barcode must come in direct contact
to an optical scanner/reader and the RFID tag can transmit to the reader
via radio waves and does not have to be in direct contact.
Antenna
The antenna allows the chip to receive and relay information, such as an ID
number of an individual product. Some antennas are constructed of metal
and are etched or stamped from metal, such as copper. Other types of
antennas are printed. Advances in technology are allowing printed
antennas to achieve the functionality of traditional materials and printed
antennas are less expensive. One of the most popular methods of printing
antennae is with the use of silver conductive inks printed on plastics
substrates or paper. Testing of RFID antennae is usually performed with
ohmmeters, milliohm meters, RF network analyzers, impedance-measuring
equipment, and others.
Some are the size of a pencil lead or are less than a half-inch in
length and can be inserted under the skin of animals and livestock.
Screw-shaped tags are used to identify specific trees.
Rectangular RFID tags found in some products are used as an antitheft device.
Large, heavy duty tags that are several inches in length, width, and
depth are used to track large containers or large vehicles such as
trucks or rail cars.
Radio Frequencies
RFID tags operate under different radio frequencies, depending on the
application. The FCC of the US government determines the limits on power
output of RFID systems as well as the different radio frequencies that can
be used. Low, high, and ultra-high (UHF) frequencies are used with RFID
transponders.
Low and high frequency tags are less expensive than UHF and are
best used for merchandise tracking, animal and livestock
identification, and security access.
Tags with UHF frequencies use more power than low and high
frequency tags, but they have a greater range and the data transfer
rate is faster. They are best suited for applications in which the tag
and the reader have a more direct path with one another. Rail car
tracking and automated toll booths are some of the uses.
The communication range between the RFID tag and the reader depends
on the frequency, the antenna size of the tag, the antenna size of the
reader, and the output power.
The radio signals can go through many substances such as rain, fog,
snows, dirt and grime, painted surfaces, etc. This gives RFID tags a distinct
advantage over optically read items, such as barcodes, which would be
useless under similar conditions. An RFID reader can receive data from as
many as 1,000 tags per second.
Quality Control
Quality control is a necessity because groups of manufactured inlays may
have experienced some damage before they reach the printer or converter.
The chips in the inlays can also be damaged during the printing or
converting process, which renders the RFID tag useless. Special
substrates can be used to limit the damage to the chips. Quality control
after printing or converting is also important to ensure that none of the
chips were damaged and will all be functional.
When RFID antennae are manufactured, they are usually tested with
ohmmeters, milliohm meters, RF network analyzers, and impedancemeasuring equipment. It is also important to remember that RFIDs are
electronic devices and therefore should not be exposed to or stored near
areas containing large amounts of electromagnetic or static energy.
Applications
The three most common uses for RFID tags are:
1. Tracking items in production lines
2. Tracking items in supply chains
3. Enhancing security measures
In other industrial uses, tags attached to items for tracking during assembly
or manufacture must be able to withstand heat, cold, etching processes,
cleaning and degreasing procedures, moisture, dirt, and many other types
of conditions and environments that would not be suitable for optically or
magnetically read devices.
Printing
With most types of printed applications, such as labels, the user is unaware
of the existence of the chip and antenna because of the different methods
of concealing them on the document. Some printers (such as label printers)
purchase inlays (containing the RFID) that are already manufactured and
then incorporate them into their printed products.
Label Printing
Label printing is one of the fastest growing segments of the printing
industry using RFID technology. Smart labels and electronic surveillance
labels are being used for applications in which simple, optically read
barcoding may not be suitable.
Smart Labels
Smart labels contain RFID transponders to automatically capture data. The
standard construction of a smart label consists of a pressure sensitive
facestock, an inlay, which contains the radio frequency identification
transponder, and a liner. The inlay is laminated between the facestock and
the liner. The transponder contains an antenna and microchip.
The data from the smart label is accessed when the transponder passes by
the reader. Radio wave lengths are picked up from the antenna and the
data on the microchip is transferred to the reader and then passed on to a
computer or printer. As the product moves from one stage to the next, its
movements can be monitored and data can be updated when necessary.
The smart label can identify, track in real-time, and authenticate a product.
Smart labels are used on all types of applications including supply chain
management, production control, work-in-process, baggage identification
and tracking, express delivery services, reusable container tracking, and
security systems.
Equipment is available that is able to encode a separate RFID inlay and
then bond it to the substrate after the label has been printed. A variety of
label substrates can be used. This process eliminates the need for inserting
transponders into blank label stock before the label stock is printed. Since
the printing process can damage stock containing transponders, the
process eliminates this problem by allowing the printing to happen first. The
system creates a printing system that is on-demand. There is no need for
special papers because the equipment can print on almost any label stock.
Other equipment is able to encode data on very thin UHF RFID
transponders that are inserted into smart labels. The equipment
immediately verifies the proper encoding. The equipment can then print
text, graphics, or barcodes on the smart label to complete the application.
The smart labels can be used for a number of warehousing, inventory, and
supply chain tracking applications.
There are also compact desktop printers specifically design for RFID
printing. The printers can read, write, and print labels that have an
embedded RFID transponder.
The industry acceptance of smart labels has been slow. The RFID
technology can improve performance and efficiency but is expensive to
startup. As more companies commit to the use of this new technology it will
become more widely accepted and many will benefit from its capabilities.
RFID is only one of the technologies used for EAS labels. Other common
types are AM (Acousto Magnetic) and EM (Electro Magnetic). Each of the
EAS systems has its own unique detection equipment that must be used to
allow the system to work properly.
Because of the anti-theft protection they provide, the EAS labels and EAS
systems allow more freedom for retail stores to display items that would
usually be locked in display cases. This allows the consumer to examine
the product more closely before purchasing.
Comparisons with Barcoding
RFID and barcode technology are similar in concept, but the two
technologies have different methods for reading data. RFID reads data via
radio waves and does not need a direct line of sight between the reader
and the tag. Barcodes are read optically and do require a direct line of sight
between the reader and the barcode.
Advantages of RFID systems over barcodes:
feet away.
Trucking
Commercial trucking facilities also use RFID systems to monitor truck
movements in and out of a main terminal.
Automotive
RFID systems are very useful in the automobile manufacturing industry in
tracking individual vehicles through the assembly process. RFID systems
are also being installed in toll booths to monitor the traffic.
Airports
Most airports track passenger baggage with barcoded labels or tags, but
they are often damaged do to rough handling of the baggage. Barcoded
tags that have been damaged because of rough baggage handling, may
account for 10% of the total volume. All of these bags must be accounted
for manually, which can be a time consuming process. RFID systems can
help to eliminate the problems that occur with unreadable barcodes.
When used for tracking bags at an airport, RFID tags contain a unique
number assigned to the bag. Anyone with access to a reader could see the
number, but any personal information could not be viewed because it is
stored in a database and is not stored on the tag.
Privacy Issues
Many people mistakenly believe that RFID is similar to GPS (Global
Positioning System) and can be used for detailed tracking, but RFID has a
range of only a few feet so this isn't possible. Another misconception that
people have is that the movement of products with RFID tags can be
tracked even after the product is purchased. Most active RFID tags have a
read range of about 25 feet, which means the RFID is basically useless
outside of the retail store or business.
Security measures and safeguards used to protect consumer privacy when
using RFID systems:
waves is reduced with the use of data encryption and over the air
protocols.
The protocols require both the reader and the eavesdropper to be
within range of the tag.
are:
The system can also be used for counterfeit prevention and for
tracking manufactured products.
POSitive
Technology
EAS
Overview
What is EAS?
Electronic Article Surveillance is a system that protects
merchandise from theft. An EAS system has three components: 1)
Labels and hard tagselectronic sensors that are attached to
merchandise; 2) Deactivators and detachersused at the point of
The transmission
technique used between the transponder and the reader is Frequency Shift Keying (FSK)
with transmissions between 134.2kHz and 124.2kHz. This approach has comparatively good
resistance to noise while also being very cost effective to implement.
System Performance
Reading Distance - one of the key benefits of the TIRIS system is its superior reading range
with low power consumption. The actual reading distance that can be acheived depends on
many factors, transponder type, electromagnetic noise, transponder orientation, antenna
type, and government regulations. In general a standard 32mm glass capsule can be read
with a stationary reader and a gate antenna from a distance of upto 1 meter Larger
transponders can acheive ranges upto 2 meters with handheld readers offering lower ranges
upto 250mm.
Data Accuracy The TIRIS system uses a 16-bit Cyclic Redundancy Check algorithim (CRCCCITT) which ensures that only 'valid' data is sent from the reader to its associated
controller. To date there have been no cases of an incorrect identification number being
read from a transponder.
Antenna Selection Of the two standard antenna types (ferrite rod and gate) the larger gate
antennas give the best reading range. Although in some environments an overall better
performance can be acheived with smaller antennas.
Each antenna has its own specific 'readout pattern' i.e. the electro magnetic field emanating
from the transponder during its reply stage. The shape and size of this pattern depends on
the specific readout antenna selected and a country's government regulations that define
the amount of electromagnetic field strength that can be generated. Electromagnetic noise
in the environment can also affect readout ranges.
Transponder Orientation The orientation of the transponder with respect to the antenna also
impacts the reading range. For maximum range the orientation of the antenna with respect
The 8051
The 8051 developed and launched in the early 80`s, is one of the most
popular micro controller in use today. It has a reasonably large amount of
built in ROM and RAM. In addition it has the ability to access external
memory.
The generic term `8x51` is used to define the device. The value of x
defining the kind of ROM, i.e. x=0, indicates none, x=3, indicates mask
ROM, x=7, indicates EPROM and x=9 indicates EEPROM or Flash.
A note on ROM
The early 8051, namely the 8031 was designed without any ROM. This
device could run only with external memory connected to it. Subsequent
developments lead to the development of the PROM or the programmable
ROM. This type had the disadvantage of being highly unreliable.
The next in line, was the EPROM or Erasable Programmable ROM. These
devices used ultraviolet light erasable memory cells. Thus a program could
be loaded, tested and erased using ultra violet rays. A new program could
then be loaded again.
An improved EPROM was the EEPROM or the electrically erasable PROM.
This does not require ultra violet rays, and memory can be cleared using
circuits within the chip itself.
Finally there is the FLASH, which is an improvement over the EEPROM.
While the terms EEPROM and flash are sometimes used interchangeably,
the difference lies in the fact that flash erases the complete memory at one
stroke, and not act on the individual cells. This results in reducing the time
for erasure.
PIC
One of the famous microcontrollers used in the industries. It is based on
RISC Architecture which makes the microcontroller process faster than other
microcontroller.
INTEL
These are the first to manufacture microcontrollers. These are not as
sophisticated other microcontrollers but still the easiest one to learn.
ATMEL
Atmels AVR microcontrollers are one of the most powerful in the
embedded industry. This is the only microcontroller having 1kb of ram even the entry
stage. But it is unfortunate that in India we are unable to find this kind of microcontroller.
Intel 8051
Intel 8051 is CISC architecture which is easy to program in assembly language and also has a
good support for High level languages.
The 8051 microcontroller is in the field for more than 20 years. There are lots of books and
study materials are readily available for 8051.
Derivatives
The best thing done by Intel is to give the designs of the 8051 microcontroller to everyone. So it
is not the fact that Intel is the only manufacture for the 8051 there more than 20 manufactures,
with each of minimum 20 models. Literally there are hundreds of models of 8051
microcontroller available in market to choose. Some of the major manufactures of 8051 are
Atmel
Philips
Philips
The Philipss 8051 derivatives has more number of features than in any microcontroller.
The costs of the Philips microcontrollers are higher than the Atmels which makes us to choose
Atmel more often than Philips
Dallas
Dallas has made many revolutions in the semiconductor market. Dallass 8051 derivative
is the fastest one in the market. It works 3 times as fast as a 8051 can process. But we are
unable to get more in India.
Atmel
These people were the one to master the flash devices. They are the cheapest
microcontroller available in the market. Atmels even introduced a 20pin variant of 8051 named
2051. The Atmels 8051 derivatives can be got in India less than 70 rupees. There are lots of
cheap programmers available in India for Atmel. So it is always good for students to stick with
8051 when you learn a new microcontroller.
Architecture
Architecture is must to learn because before learning new machine it is necessary to learn the
capabilities of the machine. This is some thing like before learning about the car you cannot
become a good driver. The architecture of the 8051 is given below.
The 8051 doesnt have any special feature than other microcontroller. The only feature is that it
is easy to learn. Architecture makes us to know about the hardware features of the
microcontroller. The features of the 8051 are
The 8051 has a 8-Bit CPU that means it is able to process 8 bit of data at a time. 8051 has 235
instructions. Some of the important registers and their functions are
The positive side (+ve) of the battery is connected to one side of a switch.
The other side of the switch is connected to a bulb or LED (Light Emitting
Diode). The bulb is then connected to a resistor, and the other end of the
resistor is connected to the negative (-ve) side of the battery.
When the switch is closed or switched on the bulb glows. When the switch
is open or switched off the bulb goes off
If you are instructed to put the switch on and off every 30 seconds, how
would you do it? Obviously you would keep looking at your watch and
every time the second hand crosses 30 seconds you would keep turning
the switch on and off.
Imagine if you had to do this action consistently for a full day. Do you think
you would be able to do it? Now if you had to do this for a month, a year??
No way, you would say!
The next step would be, then to make it automatic. This is where we use
the Microcontroller.
But if the action has to take place every 30 seconds, how will the
microcontroller keep track of time?
Execution time
Let us now have a look at the features of the 8051 core, keeping the
above example as a reference,
1. 8-bit CPU.( Consisting of the A and B registers)
Most of the transactions within the microcontroller are carried out through
the A register, also known as the Accumulator. In addition all arithmetic
functions are carried out generally in the A register. There is another
register known as the B register, which is used exclusively for
4. 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3)
In our bulb example, we used the notation p1.0. This means bit zero of port
one. One bit controls one bulb.
Thus port one would have 8 bits. There are a total of four ports named p0,
p1, p2, p3, giving a total of 32 lines. These lines can be used both as input
or output.
7. 5- interrupt sources with two priority levels (Two external and three
internal)
During the discussion on the timers, we had indicated that the timers can
trigger a branch in the main program. However, what would we do in case
we would like the microcontroller to take the branch, and then return back
to the main program, without having to constantly check whether the
required time / count has been reached?
This is where the interrupts come into play. These can be set to either the
timers, or to some external events. Whenever the background program has
reached the required criteria in terms of time or count or an external event,
the branch is taken, and on completion of the branch, the control returns to
the main program.
Priority levels indicate which interrupt is more important, and needs to be
executed first in case two interrupts occur at the same time.
8. On-chip clock oscillator.
This represents the oscillator circuits within the microcontroller. Thus the
hardware is reduced to just simply connecting an external crystal, to
achieve the required pulsing rate.
5.
PORT0 Port 0 occupies a total of 8 pins. Pin no 32 to pin no 39. It can be used
for input or output. We connect all the pins of the port 0 with the pullup resistor (10 k
ohm) externally. This is due to fact that port 0 is an open drain mode. It is just like a
open collector transistor.
6.
PORT1. ALL the ports in micrcontroller is 8 bit wide pin no 1 to pin no 8 because
it is a 8 bit controller. All the main register and sfr all is mainly 8 bit wide. Port 1 is
also occupies a 8 pins. But there is no need of pull up resistor in this port. Upon
reset port 1 act as a input port. Upon reset all the ports act as a input port
7.
PORT2. port 2 also have a 8 pins. It can be used as a input or output. There is no
need of any pull up resistor to this pin.
PORT 3.
ALE
ALE is an output pin and is active high. When connecting an 8031 to external memory,
port 0 provides both address and data. In other words, the 8031 multiplexes address and data
through port 0 to save pins. The ALE pin is used for demultiplexing the address and data by
connecting to the ic 74ls373 chip.
PSEN.
PSEN stands for program store eneable. In an 8031 based system in which an
external rom holds the program code, this pin is connected to the OE pin of the rom.
EA. EA. In 89c51 8751 or any other family member of the ateml 89c51 series all come with onchip rom to store programs, in such cases the EA pin is connected to the Vcc. For family
member 8031 and 8032 is which there is no on chip rom, code is stored in external memory and
this is fetched by 8031. In that case EA pin must be connected to GND pin to indicate that the
code is stored externally.
ACC
ACCUMULATOR
0E0H
B REGISTER
0F0H
PSW
0D0H
SP
STACK POINTER
81H
DPTR
DPL
82H
DPH
83H
P0
PORT0
80H
P1
PORT1
90H
P2
PORT2
0A0H
P3
PORT3
0B0H
TMOD
89H
TCON
88H
TH0
TLO
TH1
TL1
8BH
SCON
SERIAL CONTROL
98H
SBUF
99H
PCON
POWER CONTROL
87H
INSTRUCTIONS
8CH
8AH
8DH
SETB BIT
CLR BIT
CPL BIT
JB BIT,TARGET
JBC BIT,TARGET
MOV INSTRUCTIONS
MOV instruction simply copy the data from one location to another location
MOV D,S
Copy the data from(S) source to D(destination)
MOV R0,A
MOV R1,A
MOV A,R3
MOV A,#23H
MOV R0,#12h
MOV R5,#0F9H
ADD INSTRUCTIONS.
ADD instructions adds the source byte to the accumulator ( A) and place the result in the
Accumulator.
MOV A, #25H
ADD A,#42H
ADDA,R3
;By this instructions we move the data from register r3 to accumulator and
then add the contents of the register into accumulator .
ACALL,TARGET ADDRESS
By this instructions we call subroutines with a target address within 2k bytes from the current
program counter.
ACALL is a limit for the 2 k byte program counter, but for upto 64k byte we use LCALL
instructions.. Note that LCALL is a 3 byte instructions. ACALL is a two
byte instructions.
LJMP is also for absoltute jump. It tranfer program execution to the target addres
unconditionally. This is a 3 byte instructions LJMP jump to any address
within 64 k byte location.
JC TARGET
JUMP TO THE TARGET IF CY FLAG =1
JNC TARGET
JUMP TO THE TARGET ADDRESS IF CY FLAG IS = 0
JZ TARGET
JUMP TO TARGET IF A = 0
JNZ TARGET
JUMP IF ACCUMULATOR IS NOT ZERO
RL A
BY this instructions we rotate the bits of A left. The bits rotated out of A are
rotated back into A at the opposite end
RR A
RRC A
This is same as RR A but difference is that the bit rotated out of register
first enter in to carry and then enter into MSB
RLC A
Same as above but but shift the data from MSB to carry and carry to LSB
RET
RET1
PUSH.
This copies the indicated byte onto the stack and increments SP by . This
instructions supports only direct addressing mode.
POP.
This copies the byte pointed to be SP to the location whose direct address
is indicated, and decrements SP by 1. Notice that this instructions supports
only direct addressing mode.
DPTR INSTRUCTIONS.
This instructions load the 16 bit dptr register with a 16 bit immediate value
MOV C A,@A+DPTR
MOVC A,@A+PC
This instructions moves a byte of data located in the program area to A. the address of the
desired byte of data is formed by adding the program counter ( PC) register to the original value
of the accumulator.
INC BYTE
INC A
INC Rn
INC DIRECT
DEC BYTE
DEC A
DEC Rn
DEC DIRECT
ARITHMATIC INSTRUCTIONS.
This performs a logical AND on the operands, bit by bit, storing the result in
the destination. Notice that both the source and destination values are byte
size only
`
DIV AB
Both timer is the 89c51 share the one register TMOD. 4 LSB bit for the timer 0 and 4 MSB for
the timer 1.
GATE:
Gating control when set. Timer/counter is enabled only while the INTX pin is high
and the TRx control pin is set. When cleared, the timer is enabled whenever the TRx control bit
is set
C/T :
clock)
Timer or counter selected cleared for timer operation ( input from internal system
M1
Mode bit 1
M0
Mode bit 0
M1
M0
MODE
OPERATING MODE
13 BIT TIMER/MODE
CY
PSW.7
CARRY FLAG
AC
PSW.6
AUXILIARY CARRY
F0
PSW.5
RS1
PSW.4
RS0
PSW.3
0V
PSW.2
OVERFLOW FLAG
--
PSW.1
PSW.0
TH1
CRYSTAL FREQUENCY
256---- ____________________
There are two ways to increase the baud rate of data transfer in the 8051
1.
2.
PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used for the
power control capability of the 8051. the bit which is used for the serial communication is D7,
the SMOD bit. When the 8051 is powered up, D7 ( SMOD BIT) OF PCON register is zero. We
can set it to high by software and thereby double the baud rate
( DECIMAL)
HEX
SMOD =0
SMOD =1
-3
FD
9600
19200
-6
FA
4800
9600
-12
F4
2400
4800
-24
E8
1200
2400
EA
IE.7
IE.6
NOT implemented
ET2
IE.5
ES
IE.4
ET1
IE.3
EX1
IE.2
ET0
IE.1
EX0
IE.0
If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the corresponding
interrupt has a higher priority
PT2
IP.7
IP.6
IP.5
PS
IP.4
PT1
IP.3
PX1
IP.2
PT0
IP.1
PX0
IP.0
SCON
SM0
SM1
SM2
SCON.5
REN
TB8
SCON.3 The 9th bit that will be transmitted in modes 2 and 3, Set/cleared
By software
RB8
SCON.2 In modes 2 &3, is the 9th data bit that was received. In mode 1,
If SM2 = 0, RB8 is the stop bit that was received. In mode 0
RB8 is not used
T1
SCON.1 Transmit interrupt flag. Set by hardware at the end of the 8th bit
Time in mode 0, or at the beginning of the stop bit in the other
SCON.0 Receive interrupt flag. Set by hardware at the end of the 8th bit
R1
Time in mode 0, or halfway through the stop bit time in the other
Modes. Must be cleared by the software.
TCON
TF1
TCON.7
TR1
TCON.6
TF0
TCON.5
TR0
TCON.4
IE1
TCON.3
ITI
TCON.2
IE0
TCON.1
IT0
TCON.0
Arithmetic Operations
Mnemonic
Description
Size
Cycles
ADD A,Rn
ADD A,@Ri
ADDC A,Rn
ADDC A,direct
ADDC A,#data
SUBB A,Rn
SUBB A,direct
SUBB A,#data
INC A
INC Rn
Increment ACC.
Increment register.
INC direct
INC @Ri
Decrement ACC.
DEC A
DEC Rn
Decrement register.
DEC direct
DEC @Ri
INC DPTR
MUL AB
DIV AB
DA A
Size
Cycles
Logical Operations
Mnemonic
Description
ANL A,Rn
ANL A,@Ri
ANL direct,#data
ORL A,Rn
OR Register to ACC.
ORL A,@Ri
ORL direct,#data
XRL A,Rn
XRL A,@Ri
XRL direct,#data
CLR A
CPL A
Compliment ACC.
RL A
RLC A
RR A
RRC A
SWAP A
Data Transfer
Mnemonic
Description
Size
Cycles
MOV A,Rn
MOV A,direct
MOV A,@Ri
MOV A,#data
MOV Rn,A
MOV Rn,direct
MOV Rn,#data
MOV direct,A
MOV direct,Rn
MOV direct,direct
MOV direct,@Ri
MOV direct,#data
MOV @Ri,A
MOV @Ri,direct
MOV @Ri,#data
MOVC A,@A+DPTR Move code byte relative to DPTR to ACC (16 bit address). 1
MOVC A,@A+PC
MOVX A,@Ri
MOVX A,@DPTR
MOVX @Ri,A
MOVX @DPTR,A
PUSH direct
POP direct
XCH A,Rn
XCH A,direct
XCH A,@Ri
XCHD A,@Ri
Mnemonic
Description
Size
Cycles
CLR C
CLR bit
SETB C
SETB
CPL C
CPL bit
ANL C,bit
ANL C,/bit
ORL C,bit
ORL C,/bit
MOV C,bit
MOV bit,C
JC rel
JNC rel
JB bit,rel
JNB bit,rel
JBC bit,rel
Size
Cycles
Program Branching
Mnemonic
Description
ACALL
addr11
LCALL
addr16
RET
RETI
SJMP rel
JMP @A+DPTR
JZ rel
JNZ rel
CJNE A,direct,rel
CJNE A,#data,rel
CJNE Rn,#data,rel
CJNE @Ri,#data,rel Compare immediate byte to indirect and jump if not equal.3
DJNZ Rn,rel
DJNZ direct,rel
Other Instructions
Mnemonic
NOP
Description
No operation. 1
Size
Cycles
exists which allows us to communicate with the vast 3 control lines as well as either 4 or 8 I/O lines
for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit
data bus. If a 4-bit data bus is used, the LCD The 44780 standard requires 3 control lines as well as
either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD will require a total of 7 data
lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used, the LCD will
require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data
bus is used, the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data
bus).
The
As you can see, we've established a 1-to-1 relation between a pin on the 8051 and a line on the
44780 LCD. Thus as we write our assembly program to access the LCD, we are going to equate 1,
P0.2, etc. Let's go ahead and write our initial equates:
RW EQU P3.5
DATA EQU P1
Having established the above equates, we may now refer to our I/O lines by their 44780 name.
For example, to set the RW line high (1), we can execute the following insutrction:
SETB RW
SETB EN
And once we've finished setting up our instruction with the other control lines and data bus lines,
we'll always bring this line back low:
CLR EN
Programming Tip: The LCD interprets and executes our command at the instant the
EN line is brought low. If you never bring EN low, your instruction will never be executed.
Additionally, when you bring EN low and the LCD executes your instruction, it requires a
certain amount of time to execute the command. The time it requires to execute an
instruction depends on the instruction and the speed of the crystal which is attached to
the 44780's oscillator input.
WAIT_LCD:
SETB EN ;Start LCD command
CLR RS ;It's a command
SETB EN
CLR RS
MOV DATA,#38h
CLR EN
LCALL WAIT_LCD
Programming Tip: The LCD command 38h is really the sum of a number of option bits.
The instruction itself is the instruction 20h ("Function set"). However, to this we add the
values 10h to indicate an 8-bit data bus plus 08h to indicate that the display is a two-line
display.
We've now sent the first byte of the initialization sequence. The second byte of the initialization
sequence is the instruction 0Eh. Thus we must repeat the initialization code from above, but
now with the instruction. Thus the next code segment is:
SETB EN
CLR RS
MOV DATA,#0Eh
CLR EN
LCALL WAIT_LCD
Programming Tip: The command 0Eh is really the instruction 08h plus 04h to turn the
LCD on. To that an additional 02h is added in order to turn the cursor on.
The last byte we need to send is used to configure additional operational parameters of the
LCD. We must send the value 06h.
SETB EN
CLR RS
MOV DATA,#06h
CLR EN
LCALL WAIT_LCD
Programming Tip: The command 06h is really the instruction 04h plus 02h to configure
the LCD such that every time we send it a character, the cursor position automatically
moves to the right.
So, in all, our initialization code is as follows:
INIT_LCD:
SETB EN
CLR RS
MOV DATA,#38h
CLR EN
LCALL WAIT_LCD
SETB EN
CLR RS
MOV DATA,#0Eh
CLR EN
LCALL WAIT_LCD
SETB EN
CLR RS
MOV DATA,#06h
CLR EN
LCALL WAIT_LCD
RET
Having executed this code the LCD will be fully initialized and ready for us to send display data
to it.
CLEARING THE DISPLAY
When the LCD is first initialized, the screen should automatically be cleared by the after the LCD An
subroutine:
CLEAR_LCD:
SETB EN
CLR RS
MOV DATA,#01h
CLR EN
LCALL WAIT_LCD
RET
How that we've written a "Clear Screen" routine, we may clear the LCD at any time by simply
executing an LCALL CLEAR_LCD.
Programming Tip: Executing the "Clear Screen" instruction on the LCD also positions
the cursor in the upper left-hand corner as we would expect.
WRITING TEXT TO THE LCD
Now we get to the real meat of what we're trying to do: All this effort is really so we can display text
to the LCD is something we'll almost certainly want to do over and over--so let's make it a
subroutine.
WRITE_TEXT:
SETB EN
SETB RS
MOV DATA,A
CLR EN
LCALL WAIT_LCD
RET
The WRITE_TEXT routine that we just wrote will send the character in the accumulator to the
LCD which will, in turn, display it. Thus to display text on the LCD all we need to do is load the
accumulator with the byte to display and make a call to this routine. Pretty easy, huh?
A "HELLO WORLD" PROGRAM
Now that we have
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#' '
LCALL WRITE_TEXT
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
The above "Hello World" program should, when executed, initialize the LCD, clear the LCD
screen, and display "Hello World" in the upper left-hand corner of the display.
CURSOR POSITIONING
The above "Hello World" program is simplistic in the sense that it prints its text in the upper left-hand
corner of the screen. However, what if we wanted to display the word "Hello" in the
Thus, the first character in the upper left-hand corner is at address 00h. The following character
position (character #2 on the first line) is address 01h, etc. This continues until we
SETB EN
CLR RS
MOV DATA,#0C4h
CLR EN
LCALL WAIT_LCD
The above code will position the cursor on line 2, character 10. To display "Hello" in the upper
left-hand corner with the word "World" on the second line at character position 10 just requires
us to insert the above code into our existing "Hello World" program. This results in the following:
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
SETB EN
CLR RS
MOV DATA,#0C4h
CLR EN
LCALL WAIT_LCD
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
1.
Vss
GROUND
2.
Vcc
+5VOLT SUPPLY
Vee
4.
RS
5.
R/W
DB0
DB1
9.
DB2
10.
DB3
11.
DB4
ENABLE
12.
DB5
13.
DB6
14.
DB7
15 ,16
2.
RETURN HOME
6.
7.
8.
F.
10.
14.
18.
1C
SHIF