INTRODUCTION The need for manual toll based systems is completely reduced in this method and the tolling system works through RFID. A complete RFID system consists of a transponder (tag),reader/writer, antenna, and computer host. The transponder, better known as the tag, is a microchip combined with an antenna system in a compact package. The microchip contains memory and logic circuits to receive and send data back to the reader. These tags are classified as either active or passive tags. Active tags have internal batteries that allow a longer reading range, while passive tags are powered by the signal from its reader and thus have shorter reading range. Passive RFID have no internal power source and use external external power to operate. These tags are powered by the electromagnetic signal rece ived from a reader. The Received Electromagnetic signal charges an internal capacitor on the tags, which in turn, acts as a power source and supplies the power to the chip. Though these passive tags have both UHF and LF, the low The received electromagnetic signal charges an internal capacitor on the tags, which in turn, acts as a power source and supplies the power to the chip. Though these passive tags have both UHF and LF, the low frequency tags are best because UHF tags have high read range and hence capable of reading multiple tags simultaneously which in turn may lead to
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
INTRODUCTION
The need for manual toll based systems is completely reduced in this method and the
tolling system works through RFID. A complete RFID system consists of a transponder
(tag),reader/writer, antenna, and computer host. The transponder, better known as the tag, is a
microchip combined with an antenna system in a compact package. The microchip contains
memory and logic circuits to receive and send data back to the reader.
These tags are classified as either active or passive tags. Active tags have internal
batteries that allow a longer reading range, while passive tags are powered by the signal from
its reader and thus have shorter reading range. Passive RFID have no internal power source
and use external external power to operate.
These tags are powered by the electromagnetic signal received from a reader. The
Received Electromagnetic signal charges an internal capacitor on the tags, which in turn, acts
as a power source and supplies the power to the chip. Though these passive tags have both
UHF and LF, the low
The received electromagnetic signal charges an internal capacitor on the tags, which
in turn, acts as a power source and supplies the power to the chip. Though these passive tags
have both UHF and LF, the low frequency tags are best because UHF tags have high read
range and hence capable of reading multiple tags simultaneously which in turn may lead to
collision. The obvious advantage of the transponder in our project is that it reads only one tag
at a time and hence it is very advantageous compared to all the other previously existing
system.
Why Toll is collected?
Any structure, building or system needs maintenance and rehabilitation which are of
course costly. Highways and roads are also not an exception. From the very past, the
construction, extension, maintenance and operating costs of highways, roads, bridges and
tunnels were collected directly or indirectly. In the older indirect method, the expenses are
compensated either by tax payment on fuel or by budget allocation from the national income.
The shortcoming of this method is that a number of tax payers, who do not use some of the
roads and carriageways, have to pay extra money. However, in the other system, called direct
method, the tolls are taken directly from the drivers passing that road or street. The other
three main reasons why tolling, or road pricing, is implemented are listed below.
1. Finance/Revenue Generation: To recoup the costs of building, operating and
maintaining the facility. Road pricing is becoming a more appealing means of funding
transportation. Moreover, toll financing allows projects to be built sooner instead of waiting
for tax revenues to accumulate.
2. Demand Management: To moderate the growth in demand on the transportation
system, and to encourage more use of public transportation and carpooling. For example,
vehicles are charged to enter inner London, England, as a way of regulating the demand in
the region.
3. Congestion Management: To place a price on limited roadway space in
proportion to demand. In this application the toll increases with the level of congestion. In the
absence of such pricing, drivers do not appreciate the costs they impose on others as a result
of the congestion they cause.
Different types of Toll Collection Systems
Three systems of toll roads exist: open (with mainline barrier toll plazas); closed (with
entry/exit tolls) and all-electronic toll collection (no toll booths, only electronic toll collection
gantries at entrances and exits or at strategic locations on the mainline of the road).
On an open toll system, all vehicles stop at various locations along the highway to pay a toll.
While this may save money from the lack of need to construct tolls at every exit, it can cause
traffic congestion, and drivers may be able to avoid tolls by exiting and re-entering the
highway.
With a closed system, vehicles collect a ticket when entering the highway. In some
cases, the ticket displays the toll to be paid on exit. Upon exit, the driver must pay the amount
listed for the given exit. Should the ticket be lost, a driver must typically pay the maximum
amount possible for travel on that highway. Short toll roads with no intermediate entries or
exits may have only one toll plaza at one end, with motorists traveling in either direction
paying a flat fee either when they enter or when they exit the toll road. In a variant of the
closed toll system, mainline barriers are present at the two endpoints of the toll road, and each
interchange has a ramp toll that is paid upon exit or entry. In this case, a motorist pays a flat
fee at the ramp toll and another flat fee at the end of the toll road; no ticket is necessary.
In an all-electronic system no cash toll collection takes place, tolls are usually
collected with the use of a transponder placed before the Gate as soon as the vehicle reaches
near the Transponder the amount is deducted and the gate will be opened customer account
which is debited for each use of the toll road. On some roads automobiles and light trucks
without transponders are permitted to use the road (though trucks with a gross vehicle weight
over 5,000 kilograms must have a transponder)- a bill for the toll due is then sent to the
registered owner of the vehicle by mail; by contrast, some tollways require all vehicles to be
equipped with a transponder.
Modern toll roads often use a combination of the three, with various entry and exit
tolls supplemented by occasional mainline tolls. Open Road Tolling (ORT), with all-
electronic toll collection, is now the preferred practice, being more efficient, environmentally
friendly, and safer than manual toll collection.
LITERATURE SURVEY
In most advanced countries, ETC systems have evolved from older systems where
many of the existing technologies did not exist. Due to backward compatibility constraints,
implementing ETC models across the country has proved to be a challenge, and sometimes
complicated solutions have evolved to ensure interoperability between systems of different
toll vendors.
India has an advantage as there are no legacy systems in place, and highway
expansion has begun to take off mainly over the last decade .Consequently, there is an
opportunity to built a simple and robust ETC system that leverages modern information and
communication technologies. Presently, Electronic toll collection is used at few toll plazas on
national highways like:
I. Delhi- Gurgaon Highway
II. Bangalore-Electronic City Elevated Highway
I. DELHI-GURGAON HIGHWAY:
The solution introduced on Delhi-Gurgaon Expressway is a multi- tiered processing
ability so as to accommodate the motorists and the processing speeds ensuring little to no
queuing at the Toll Plazas. The acceptance of cash and the introduction of the following cash-
less (Electronic Media to pay Toll) transaction will enable this to be achieved.
Technology: Smart Tag
The Smart Tag allows a motorist to travel non-stop through the toll plaza. It is an
electronic device the size of a computer mouse which is installed in the windscreen behind
the rear view mirror of your vehicle. It is charged with the denomination of your choice and
has the capability of interacting with sensors placed at the toll gates. Which means that all
you have to do is to slow down to 20 Km/hr (you don't have to stop) near the toll gates, the
sensor at the gates interact with your Smart Tag, the transaction is recorded and the toll
deducted, you hear a confirmation beep inside your car and you're off.
All of this takes less than a second and is extremely convenient to commuters and the
best way to do away with waiting periods at the toll gates. Smart tag works like a debit card,
it has no expiry and you can use it till you keep re-charging the amount in your account.
Designated lanes for Smart Tag holders have been created to ensure a seamless drive through.
Any person may apply for a smart tag device who travels on the NH-8. This could include
Motorists , Local residents and local commercial traffic. All you need is a copy of the
registration Certificate of your vehicle and you can register for the Smart Tag at the following
locations as per your convenience:
1. Point of Sale Office at the KM 24 Toll Plaza at the Delhi-Gurgaon Border
2. Point of Sale Office at the KM 42 Toll Plaza near Haldiram on NH 8
3. Point of Sale Office at IGI Airport Toll Plaza
Rules for vehicle with Smart Tag:
The smart tag based ETC implemented at Delhi-Gurgaon Highway is basic model and
works under certain constraints which are mentioned below.[13]
• Tag users are required to proceed only after observing green traffic signal.
• Tag users are required to maintain approx. 2 car length distance while crossing toll
gate.
• Speed of the vehicle should not be more than 15 km while crossing the toll gate.
• Tag is not an authority to move freely without following traffic rules. Being
electronic item there can be instances when the system doesn’t work.
• Don’t move on hearing the beep sound coming out of tag. Look out for a green
Traffic light only.
• Each vehicle will be required to have its own Smart-Tag. If anyone tries to tamper
the device, a tamper switch which is monitored by the system and will result in hot-listing of
the account.
• If there is any problem in the Smart-tag, the consumer should visit the POS and get
the Smart-tag checked. It will be replaced if it has not been tampered with.
• Speed limits in a nonstop Smart Tag lane must be not more than 15 Km/h for the
safety of commuters.
• The same Smart-tag can be used at all the three toll plazas on the Delhi - Gurgaon
Expressway, this Smart-tag can’t be used on any other toll road across the country as DG
Expressway is the only toll road in India which offers Smart-tag technology.
• In case the customer changes his/her vehicle or changes the existing fleet, change in
particulars need to be filled in, which would then be available at all the three toll plazas to
avoid any inconvenience.
• If the Smart-tag is lost or stolen, the customer should report it to the Point of Sale in
writing. The customer will be held responsible for any loss from the use that Smart-tag for 48
hours after the loss has been reported in writing.
Smart-tag antenna requires the device to be in a certain position and angle on the
windshield.
Invalid card: If the card to which the Smart-Tag is linked is no longer valid the
Smart-tag will not function as system automatically checks the validity of the linked card,
before opening the boom.
Functionality:
A centralized back office operation or Central Toll Clearing House is mandatory for
the operation of nation-wide ETC systems. The Central Clearing House concept is a
transaction management which will enable multiple toll collection agencies to share toll
transaction data and revenue reconciliation. It is convenient and easy for a road user to use a
common payment mechanism which can be accepted at all toll plazas. Irrespective of the toll
plazas being operated by NHAI or BOT concessionaries, the reader system at each toll plaza
debits the applicable amount from the smart card of users.
Every Toll plaza shall have the facility to account for ETC based payments, and all
such transactions for the day are sent to the central toll clearing house (CTCH) as claims. The
CTCH runs an end of the day settlement and sends files to every toll plaza and point of sales
outlet for their receivables for that particular day. Such files are then sent to the bank for
conducting finanancial settlements to the particular bank accounts of all the collecting
agencies.
II. BANGALORE ELEVATED TOLLWAY LTD:
A Consortium of Soma Enterprise Ltd (Soma), Nagarjuna Construction Company
Limited (NCCL), and Maytas Infra Limited (Maytas) has built a 9 Km long 4 lane Elevated
Divided Carriageway Road between Silk Board Junction and Electronic City Junction on a
Build, Operate and Transfer (BOT) Basis for the National Highways Authority of India
(NHAI). The Consortium will operate and maintain the roads in the stretch between Silk
Board Junction and Inter State Border for the next 18 years. Bangalore Elevated Tollway Ltd
(BETL), which has been awarded the expressway project on the Bangalore-Hosur section of
the National Highway connecting the Electronic City, has proposed a toll of Rs 10 to Rs 70
per trip for different modes of vehicles, including heavy commercial vehicles. [15]
Technology: Passive RFID
Toll booths on National Highways will adopt the passive RFID technology standard –
ISO 18000 6C — for electronic toll collection (ETC) system, based on the recommendation
of a committee set up for this purpose, headed by Mr Nandan Nilekani, Chairman, Unique
Identification Authority of India (UIDAI). The recommendations have been adopted by the
Highways Ministry. In the ETC system, vehicles will have tags on their windscreens – where
amounts can be pre-loaded (just like prepaid SIM cards for phones) – and when the vehicles
pass through NH toll lanes with tag readers, the toll amount would automatically get debited.
This will pave the way for setting up of ETC system across the NH network.
There are about 147 toll booths on the NH network, out of which about 100-odd are
operated by NHAI and remaining by private developers. Each reader will cost about Rs 2
lakh. Each NH toll booth will have at least two lanes (one on each side) with tag readers.
NHAI or the operating concessionaire is likely to bear the cost of setting up tag readers at its
toll plazas though the Union Highway Minister, Mr Kamal Nath, said he expects the system
to be ―self-financing. It is also not clear as to who will fund the clearing house operator. At
present, two NH stretches have ETC options –Delhi-Gurgaon Expressway and Bangalore-
Electronic City elevated highway.
BLOCK DIAGRAM
The figure below shows the Block Diagram of the RFID based Toll Tax System:
Block Description:
RFID Transponder:
The RFID transponder module used in the project is a low frequency transponder
which works at the frequency of 125 Khz and it is responsible for providing power to the
Passive Tag and also reads the 12 byte code sent by the RFID tag and sends it to the TTL to
RS-232 converter.
RFID TRANSPONDER
RS232 TO TTLCONVERTER
MICONTROLLERAT89S52
LC D16x2UART
4X3 MATRIXSWITCH
MOTORDRIVER
L293D
MOTOR(GATE)
IR SENSORMODULE
BUZZER
RFID TAG
TTL to RS-232 converter:
The output of the RFID Transponder is RS 232 level it is necessary to convert the
RS232 level to the TTL level before providing it to the microcontroller this is done by using
and IC Max 232 which is a level shifter which is capable of converting the signals from
RS232 to TTL and TTL to RS232.
4x3 Matrix Switch:
The 4x3 Matrix Switch is a numeric keypad which is used to recharge the amount
when the amount of the user is low.
Microcontroller AT89S52:
The microcontroller is the most important device of the system since it is capable of
controlling all the device connected to it. It receives the code of the RFID tag from the
transponder and then compares it with the code stored in the memory and performs various
operations like deducting the amount from the user, recharging the amount, controlling the
gate. It also checks whether the vehicle is a stolen vehicle, if the vehicle is a stolen vehicle
then it will not open the gate and also generates a buzzer sound.
IR Sensor Module:
The IR Sensor Module is used to detect whether the vehicle has left the gate so that
the gate can be closed. The IR sensor Module normally comprises of an IR transmitter LED
and an IR receiver. The IR signals are continuously transmitted. Whenever an obstruction is
present then the IR signals emitted from the transmitter gets reflected towards the receiver
due to which the output of the receiver goes low, this can be detected by the microcontroller.
LCD 16x2:
The LCD provides all the information of the user like the user name the account
balance of the user the key pressed while recharging and also to show the type of the vehicle
such as LMV, HMV and STOLEN.
Motor Driver:
The Motor Driver receives the input from the microcontroller and drives the motor in
forward or reverse direction according to received command input. It mainly consists of an
IC L293d which has two H-bridges inbuilt . Among the two H-Bridge we are using a single
H-Bridge for controlling the Gate Motor.
Motor:
A high geared Torque DC motor is used for opening or closing the gate.
BUZZER:
A BUZZER is used to generate an alarm sound when a stolen vehicle arrives the Toll
Collection System.
INTRODUCTION TO RFID
Radio-frequency identification (RFID) is an automatic identification method, relying
on storing and remotely retrieving data using devices called RFID tags or transponders. The
technology requires some extent of cooperation of an RFID reader and an RFID tag.
An RFID tag is an object that can be applied to or incorporated into a product, animal,
or person for the purpose of identification and tracking using radio waves. Some tags can be
read from several meters away and beyond the line of sight of the reader.
An RFID tag is an object that can be applied to or incorporated into a product, animal,
or person for the purpose of identification and tracking using radio waves. Some tags can be
read from several meters away and beyond the line of sight of the reader.
What is RFID?
A basic RFID system consists of three components:
a) An antenna or coil
b) A transceiver (with decoder)
c) A transponder (RF tag)
Electronically programmed with unique information. There are many different types
of RFID systems out in the market. They are categorized according to there frequency ranges.
Some of the most commonly used RFID kits are as follows:
1) Low-frequency (30 KHz to 500 KHz)
2) Mid-Frequency (900KHz to 1500MHz)
3) High Frequency (2.4GHz to 2.5GHz)
These frequency ranges mostly tell the RF ranges of the tags from low frequency tag
ranging from 3m to 5m, mid-frequency ranging from 5m to 17m and high frequency ranging
from 5ft to 90ft. The cost of the system is based according to there ranges with low-frequency
system ranging from a few hundred dollars to a high-frequency system ranging somewhere
near 5000 dollars.
How RFID Is Changing the Business Environment today
Radio frequency identification (RFID) technology has been in use for several decades
to track and identify goods, assets and even living things. Recently, however, RFID has
generated widespread corporate interest as a means to improve supply chain performance.
Market activity has been exploding since Wal-Mart's June 2003 announcement that its top
100 suppliers must be RFID-compliant by January 2005. Mandates from Wal-Mart and the
Department of Defense (DoD) are making many companies scramble to evaluate, select and
implement solutions that will make them compliant with their customers' RFID requirements
and additional retailers and other large supply chain channel masters are likely to follow suit.
COMPONENTS OF RFID
A basic RFID system consist of three components:
An antenna or coil
A transceiver (with decoder)
A transponder (RF tag) electronically programmed with unique information
These are described below:
ANTENNA
The antenna emits radio signals to activate the tag and read and write data to it.
Antennas are the conduits between the tag and the transceiver, which controls the system's
data acquisition and communication. Antennas are available in a variety of shapes and sizes;
they can be built into a door frame to receive tag data from persons or things passing through
the door, or mounted on an interstate tollbooth to monitor traffic passing by on a freeway.
The electromagnetic field produced by an antenna can be constantly present when multiple
tags are expected continually. If constant interrogation is not required, a sensor device can
activate the field.
Often the antenna is packaged with the transceiver and decoder to become a reader
(a.k.a. interrogator), which can be configured either as a handheld or a fixed-mount device.
The reader emits radio waves in ranges of anywhere from one inch to 100 feet or more,
depending upon its power output and the radio frequency used. When an RFID tag passes
through the electromagnetic zone, it detects the reader's activation signal. The reader decodes
the data encoded in the tag's integrated circuit (silicon chip) and the data is passed to the host
computer for processing.
TAGS
An RFID tag is comprised of a microchip containing identifying information and an
antenna that transmits this data wirelessly to a reader. At its most basic, the chip will contain
a serialized identifier, or license plate number, that uniquely identifies that item, similar to the
way many bar codes are used today. A key difference, however is that RFID tags have a
higher data capacity than their bar code counterparts. This increases the options for the type
of information that can be encoded on the tag, including the manufacturer, batch or lot
number, weight, ownership, destination and history (such as the temperature range to which
an item has been exposed). In fact, an unlimited list of other types of information can be
stored on RFID tags, depending on application needs. An RFID tag can be placed on
individual items, cases or pallets for identification purposes, as well as on fixed assets such as
trailers, containers, totes, etc.
Tags come in a variety of types, with a variety of capabilities. Key variables include:
"Read-only" versus "read-write"
There are three options in terms of how data can be encoded on tags: (1) Read-only
tags contain data such as a serialized tracking number, which is pre-written onto them by the
tag manufacturer or distributor. These are generally the least expensive tags because they
cannot have any additional information included as they move throughout the supply chain.
Any updates to that information would have to be maintained in the application software that
tracks SKU movement and activity. (2) "Write once" tags enable a user to write data to the
tag one time in production or distribution processes. Again, this may include a serial number,
but perhaps other data such as a lot or batch number. (3) Full "read-write" tags allow new
data to be written to the tag as needed—and even written over the original data. Examples for
the latter capability might include the time and date of ownership transfer or updating the
repair history of a fixed asset. While these are the most costly of the three tag types and are
not practical for tracking inexpensive items, future standards for electronic product codes
(EPC) appear to be headed in this direction.
RFID TAGS
Data capacity
The amount of data storage on a tag can vary, ranging from 16 bits on the low end to
as much as several thousand bits on the high end. Of course, the greater the storage capacity,
the higher the price per tag.
Form factor
The tag and antenna structure can come in a variety of physical form factors and can
either be self-contained or embedded as part of a traditional label structure (i.e., the tag is
inside what looks like a regular bar code label—this is termed a 'Smart Label') companies
must choose the appropriate form factors for the tag very carefully and should expect to use
multiple form factors to suit the tagging needs of different physical products and units of
measure. For example, a pallet may have an RFID tag fitted only to an area of protected
placement on the pallet itself. On the other hand, cartons on the pallet have RFID tags inside
bar code labels that also provide operators human-readable information and a back-up should
the tag fail or pass through non RFID-capable supply chain links.
Passive versus active
“Passive” tags have no battery and "broadcast" their data only when energized by a
reader. That means they must be actively polled to send information. "Active" tags are
capable of broadcasting their data using their own battery power. In general, this means that
the read ranges are much greater for active tags than they are for passive tags—perhaps a read
range of 100 feet or more, versus 15 feet or less for most passive tags. The extra capability
and read ranges of active tags, however, come with a cost; they are several times more
expensive than passive tags. Today, active tags are much more likely to be used for high-
value items or fixed assets such as trailers, where the cost is minimal compared to item value,
and very long read ranges are required. Most traditional supply chain applications, such as the
RFID-based tracking and compliance programs emerging in the consumer goods retail chain,
will use the less expensive passive tags.
Frequencies
Like all wireless communications, there are a variety of frequencies or spectra
through which RFID tags can communicate with readers. Again, there are trade-offs among
cost, performance and application requirements. For instance, low-frequency tags are cheaper
than ultra high-frequency (UHF) tags, use less power and are better able to penetrate non-
metallic substances. They are ideal for scanning objects with high water content, such as
fruit, at close range. UHF frequencies typically offer better range and can transfer data faster.
But they use more power and are less likely to pass through some materials. UHF tags are
typically best suited for use with or near wood, paper, cardboard or clothing products.
Compared to low-frequency tags, UHF tags might be better for scanning boxes of goods as
they pass through a bay door into a warehouse. While the tag requirements for compliance
mandates may be narrowly defined, it is likely that a variety of tag types will be required to
solve specific operational issues. You will want to work with a company that is very
knowledgeable in tag and reader technology to appropriately identify the right mix of RFID
technology for your environment and applications.
CIRCUIT DIAGRAM
Circuit description:
The RFID reader reads the tag if it is present near the reader and sends the 12 byte
code in the form of serial data at an baud rate of 9600 bps to the input of a level converter
which is nothing but RS 232 to TTL converter It is required since the microcontroller
operates at TTL level. The serial data is received in interrupt mode by the microcontroller.
As soon as vehicle arrives in the toll gate the RFID card in the vehicle is read by the
reader and its is processed by the microcontroller initially the microcontroller compares it
with the already stored one and detects the type of vehicle whether LMV, HMV and
STOLEN vehicle as the soon as the type is detected it displays in the LCD it also shows the
account balance of the user and charges an amount of 20Rs. For LMV and charges an amount
of 30Rs. For HMV vehicle if the account balance is insufficient then it is indicated on the
LCD to recharge the account with the help of the Keypad attached to the system.
The * button is used to cancel a letter if a letter is wrongly pressed and the # symbol
denotes the OK sign i.e. once the amount to recharge is entered then the # symbol should be
pressed and the amount is deducted and after deducting the amount the gate is opened by
turning the DC motor.
Now the IR sensor is scanned to notify whether the Vehicle has left the gate so that
the gate can be closed.
Whenever a Stolen vehicle arrives the gate it is detected since the information of the
stolen vehicle is already stored in the database by comparing with the received code of the tag
with all the code stored the stolen vehicle is identified and now the gate will not be opened
and an alarm is generated with the help of a buzzer.
Circuit diagram of Power Supply
Power supply design:
Block diagram:
Most digital logic circuits and processors need a 5 volt power supply. To use
these parts we need to build a regulated 5 volt source. Usually you start with an
unregulated power to make a 5 volt power supply, we use a LM7805 voltage regulator
IC (Integrated Circuit). The LM7805 is simple to use. You simply connect the positive
lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the
Input pin, connect the negative lead to the Common pin and then when you turn on the
power, you get a 5 volt supply from the Output pin.
CIRCUIT FEATURES:
POWER SUPPLY BLOCK DIAGRAM:
FIG 5.1: BLOCK DIAGRAM OF POWER SUPPLY
POWER SUPPLY BLOCK DIAGRAM DESCRIPTION:
The ac voltage, typically 230 Vrms, is connected to a transformer, which steps that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a full-wave
rectified voltage that is initially filtered by a simple capacitor filter to produce a dc voltage.
This resulting dc voltage usually has some ripple or ac voltage variation. A regulator circuit
removes the ripples and also remains the same dc value even if the input dc voltage varies, or
the load connected to the output dc voltage changes. This voltage regulation is usually
obtained using one of the popular voltage regulator IC units.
POWER SUPPLY CIRCUIT COMPONENT DESCRIPTION:
5.1.2: TRANSFORMER:
Transformers convert AC electricity from one voltage to
another with little loss of power. Transformers work only
with AC and this is one of the reasons why mains electricity
is AC. The input coil is called the primary and
the output coil is called the secondary. There is no electrical connection between the two
coils, instead they are linked by an alternating magnetic field created in the soft-iron core
of the transformer. The two lines in the middle of the circuit symbol represent the core.
Transformers waste very little power so the power out is (almost) equal to the power in.
Note that as voltage is stepped down current is stepped up. The ratio of the number of
turns on each coil, called the turns ratio.
turns ratio = Vp
= Np
and power out = power in
Vs Ns Vs × Is = Vp × Ip
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current
Vs = secondary (output) voltage
Ns = number of turns on secondary coil
Is = secondary (output) current
5.1.3: BRIDGE RECTIFTER:
The rectifier is nothing but a circuit which would convert ac into dc. The most commonly
used rectifier is the bridge rectifier. The bridge rectifier consists of four diodes of IN4007.
The diodes are connected in such a way that during the positive half cycle two of the diodes
that are forward biased will conduct and the other two will not conduct. And in the next half
cycle, the alternate diodes will conduct. So we get an output with fewer ripples. Now the
output must be a clear dc for which we need to further filter the ac components.
FIG 5.1.3(A): Bridge rectifier
FIG 5.1.3(B):Output: full-wave varying
5.1.4: FILTER:
The filter circuit used here is capacitive filter circuit is connected at the rectifier output, and a
DC is obtained across it. The filtered waveform is essentially a DC voltage with negligible
ripples, which is ultimately fed to the load.
FIG 5.1.4 CAPACITIVE FILTER
Smoothing significantly increases the average DC voltage to almost the peak value (1.4 ×
RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS
(1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value
giving 1.4 × 4.6 = 6.4V smooth DC. The Smoothing is not perfect due to the capacitor
voltage falling a little as it discharges, giving a small ripple voltage. For many circuits a
ripple which is 10% of the supply voltage is satisfactory and the Equation below gives the
required value for the smoothing capacitor. A larger capacitor will give fewer ripples.
Smoothing capacitor for 10% ripple, C = 5 × Io
Vs × f
C= smoothing capacitance in farads (F)
Io = output current from the supply in amps (A)
Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DC
f = frequency of the AC supply in hertz (Hz), 50Hz
5.1.5: VOLTAGE REGULATOR:
FIG 5.1.5: IC7805
FIG 5.1.5: IC7805
Pin Description:
Pin No Function Name
1 Input voltage (5V-18V) Input
2 Ground (0V) Ground
3 Regulated output; 5V (4.8V-5.2V) Output
The series 78 regulators provide fixed regulated voltages from 5V to 24V shows how one
such IC, a 7805, is connected to provide voltage regulation with output from this unit of +5V
dc. An unregulated input voltage Vi is filtered by capacitor C1 and connected to the IC‘s IN
terminal. The IC‘s OUT terminal provides a regulated + 5V which is filtered by capacitor C2
(mostly for any high-frequency noise). The third IC terminal is connected to ground (GND).
While the input voltage may vary over some permissible voltage range, and the output load
may vary over some acceptable range, the output voltage remains constant within specified
voltage variation limits.
7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear
voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not
give the fixed voltage output. The voltage regulator IC maintains the output voltage at a
constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide.
7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at
input and output pins depending upon the respective voltage levels.
RFID MODULE:
Radio-frequency identification (RFID) is a technology that uses communication
through the use of radio waves to transfer data between a reader and an electronic tag attached
to an object for the purpose of identification and tracking. RFID makes it possible to give each
product in a grocery store its own unique identifying number, to provide assets, people, work
in process, medical devices etc. all with individual unique identifiers - like the license plate on
a car but for every item in the world. This is a vast improvement over paper and pencil
tracking or bar code tracking that has been used since the 1970s. With bar codes, it is only
possible to identify the brand and type of package in a grocery store, for instance.
Furthermore, passive RFID tags (those without a battery) can be read if passed
within close enough proximity to an RFID reader. It is not necessary to "show" the tag to the
reader device, as with a bar code. In other words it does not require line of sight to "see" an
RFID tag, the tag can be read inside a case, carton, box or
other container, and unlike barcodes RFID tags can be read hundreds at a time. Bar codes can
only read one at a time.
Some RFID tags can be read from several meters away and beyond the line of sight
of the reader. The application of bulk reading enables an almost-parallel reading of tags.
Radio-frequency identification involves the hardware known as interrogators (also
known as readers), and tags (also known as labels), as well as RFID software or RFID
middleware.
Most RFID tags contain at least two parts: one is an integrated circuit for storing
and processing information, modulating and demodulating a radio-frequency (RF) signal, and
other specialized functions; the other is an antenna for receiving and transmitting the signal.
RFID can be either passive (using no battery), active (with an on-board battery that
always broadcasts or beacons its signal) or battery assisted passive (BAP) which has a small
battery on board that is activated when in the presence of an RFID reader. Passive tags in 2011
start at $ .05 each and for special tags meant to be mounted on metal, or withstand gamma
sterilization go up to $5. Active tags for tracking containers, medical assets, or monitoring
environmental conditions in data centers all start at $50 and can go up over $100 each. BAP
tags are in the $3–10 range and also have sensor capability like temperature and humidity.
The term RFID refers to the technology. The tags should properly be called "RFID
tags" not "RFIDs".Fixed RFID and Mobile RFID: Depending on mobility, RFID readers are
classified into two different types: fixed RFID and mobile RFID. If the reader reads tags in a
stationary position, it is called fixed RFID. These fixed readers are set up specific
interrogation zones and create a "bubble" of RF energy that can be tightly controlled if the
physics
is well engineered.
This allows a very definitive reading area for when tags go in and out of the
interrogation zone.On the other hand, if the reader is mobile when the reader reads tags, it is
called mobile RFID. Mobile readers include hand helds, carts and vehicle mounted RFID
readers from manufacturers such as Motorola, Intermec, Impinj, Sirit, etc.
Fig.5.2.:RFID tag
125KHz readers are high performance proximity readers featuring long range and
small dimensions. The readers run from any voltage from 5 to 12.5 VDC and feature
high read range at as low as 5 volts making it ideally suited to a wide variety of
applications, particularly access control. The same basic unit can be configured to
output most of the common interface formats, including Wiegand, Magstripe, Clock/
Data and RS-232 serial ASCII output, making it easy to upgrade existing installations.
Readers are RF detectors that can read tags to obtain the information
stored within them. It has an antenna that sends and receives signals.A reader
generates an RF field. When a tag passes through the field, the information stored on
the chip in the tag is decoded by the reader and sent to the server.
RFID tag used is passive tag.It provides best reading range with 125KHz
RFID readers. RFID tags contain a memory chip and RF antenna that can send and
receive several bits of data. Such RFID tags are known as smart labels or digital
identification tags.The microchips on the RFID tags can be programmed electronically.
Similarly a reader (technically known as an interrogator) has to be
programmed to send and receive correct information from a tag. passive RFID tags,
which have no battery and require an external source to provoke signal transmission.
Passive tags generally operate at a maximum distance of 3 meters or less,
and have power only when in communication with an RFID reader. 125Khz RFID
Clamshell cards are water proof and provide best reading range with 125KHz RFID
readers. Clamshell cards are very popular in Access control applications but can be
used in wide range of RFID applications. They are lowest cost RFID cards available
currently in the market.
They have 26-bit factory written ID that cannot be changed, though selected
number sequences can be supplied for volume orders. These are Read only tags.
FEATURES OF RFID READER:
Low cost
Long read range
Small outline
Wide voltage range
Potted for environmental protection
Externally programmable interface.
MICROCONTROLLER (AT89S52)
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes
of in-system programmable Flash memory. The device is manufactured using Atmel’s high-
density nonvolatile memory technology and is compatible with the indus-try-standard 80C51
instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. By
combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip,
the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-
effective solution to many embedded control applications.
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
3.1.5 Transmission in 89V51RD2:3.1.5 Transmission in 89V51RD2:
89V51RD2 has a serial data communication circuit that uses register SBUF to hold data.
Register SCON controls data communication. Register PCON controls data rates. Pins RxD (p3.0)
and TxD(3.1) connect to serial data network. SBUF is physically two registers, one is writing only
i.e. to hold data to be transmitted out of microcontroller via TxD. The other is read only and holds
received data from an external transmitting source via RxD.
Whenever a data byte is transmitted T1 flag is set and so program is interrupted to transmit
another byte of data. The main program is interrupted only serial port interrupt is 1E SFR is enable.
The data transmission steps are:
Initially the T1 flag is reset.
Data to be transmitted must be written into SBUF.
As soon as data is transmitted the T1 flag is set and main program is interrupted to execute
ISR.
In the ISR T1 flag is reset .another data is written in SBUF register.
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, for parts that
require 12-volt VPP.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2:
Output from the inverting oscillator amplifier.
RAM memory space allocation in the 8051
There are 128 bytes of RAM in the 8051. The 128 bytes of RAM inside the 8051 are
assigned addresses 00 to7FH. These 128 bytes are divided into three different groups as
follows:
1. A total of 32 bytes from locations 00 to 1FH hex are set aside for register banks
and the stack.
2. A total of 16 bytes from locations 20 to 2FH hex are set aside for bit-addressable
read/write memory.
3. A total of 80 bytes from locations 30H to 7FH are used for read and write storage,
or what is normally called Scratch pad. These 80 locations of RAM are widely
used for the purpose of storing data and parameters nu 8051 programmers.
Default register bank
Register bank 0; that is, RAM locations 0, 1,2,3,4,5,6, and 7 are accessed with the
names R0, R1, R2, R3, R4, R5, R6, and R7 when programming the 8051.
FIG 8: RAM Allocation in the 8051
PSW Register (Program Status Word)
This is one of the most important SFRs. The Program Status Word (PSW) contains several
status bits that reflect the current state of the CPU. This register contains: Carry bit, Auxiliary
Carry, two register bank select bits, Overflow flag, parity bit, and user-definable status flag.
The ALU automatically changes some of register’s bits, which is usually used in regulation
of the program performing.
P - Parity bit. If a number in accumulator is even then this bit will be automatically set (1),
otherwise it will be cleared (0). It is mainly used during data transmission and receiving via
serial communication.
OV Overflow occurs when the result of arithmetical operation is greater than 255 (decimal),
so that it cannot be stored in one register. In that case, this bit will be set (1). If there is no
overflow, this bit will be cleared (0).
RS0, RS1 - Register bank select bits. These two bits are used to select one of the four
register banks in RAM. By writing zeroes and ones to these bits, a group of registers R0-R7
is stored in one of four banks in RAM.
RS1 RS2 Space in RAM
0 0 Bank0 00h-07h
0 1 Bank1 08h-0Fh
1 0 Bank2 10h-17h
1 1 Bank3 18h-1Fh
F0 - Flag 0. This is a general-purpose bit available to the user.
AC - Auxiliary Carry Flag is used for BCD operations only.
CY - Carry Flag is the (ninth) auxiliary bit used for all arithmetical operations and shift
instructions.
DPTR Register (Data Pointer)
These registers are not true ones because they do not physically exist. They consist of two
separate registers: DPH (Data Pointer High) and (Data Pointer Low). Their 16 bits are used
for external memory addressing. They may be handled as a 16-bit register or as two
independent 8-bit registers. Besides, the DPTR Register is usually used for storing data and
intermediate results, which have nothing to do with memory locations.
SP Register (Stack Pointer)
The stack is a section of RAM used by the CPU to store information temporily. This
information could be data or an address. The CPU needs this storage area since there are
only a limited number of registers.
How stacks are accessed in the 8051
If the stack is a section of RAM, there must be registers inside the CPU to point to it.
The register used to access the stack is called the SP (Stack point) Register. The stack pointer
in the 8051 is only 8 bits wide; which means that it can take values of 00 to FFH. When the
8051 is powered up, the SP register contains value 07. This means that RAM location 08 is
the first location used for the stack by the 8051. The storing of a CPU register in the stack is
called a PUSH, and pulling the contents off the stack back into a CPU register is called a
POP. In other words, a register is pushed onto the stack to save it and popped off the stack to
retrieve it. The job of the SP is very critical when push and pop actions are performed.
Program counter:
The important register in the 8051 is the PC (Program counter). The program counter
points to the address of the next instruction to be executed. As the CPU fetches the opcode
from the program ROM, the program counter is incremented to point to the next instruction.
The program counter in the 8051 is 16bits wide. This means that the 8051 can access
program addresses 0000 to FFFFH, a total of 64k bytes of code. However, not all members
of the 8051 have the entire 64K bytes of on-chip ROM installed, as we will see soon.
Serial Communication:
Serial data communication uses two methods, asynchronous and synchronous. The
synchronous method transfers a block of data at a time, while the asynchronous method
transfers a single byte at a time.
In data transmission if the data can be transmitted and received, it is a duplex
transmission. This is in contrast to simplex transmissions such as with printers, in which the
computer only sends data. Duplex transmissions can be half or full duplex, depending on
whether or not the data transfer can be simultaneous. If data is transmitted one way at a time,
it is referred to as half duplex. If the data can go both ways at the same time, it is full duplex.
Of course, full duplex requires two wire conductors for the data lines, one for transmission
and one for reception, in order to transfer and receive data simultaneously.
Asynchronous serial communication and data framing
The data coming in at the receiving end of the data line in a serial data transfer is all
0s and 1s; it is difficult to make sense of the data unless the sender and receiver agree on a set
of rules, a protocol, on how the data is packed, how many bits constitute a character, and
when the data begins and ends.
Start and stop bits
Asynchronous serial data communication is widely used for character-oriented
transmissions, while block-oriented data transfers use the synchronous method. In the
asynchronous method, each character is placed between start and stop bits. This is called
framing. In the data framing for asynchronous communications, the data, such as ASCII
characters, are packed between a start bit and a stop bit. The start bit is always one bit, but the
stop bit can be one or two bits. The start bit is always a 0 (low) and the stop bit (s) is 1
(high).
Data transfer rate
The rate of data transfer in serial data communication is stated in bps (bits per
second). Another widely used terminology for bps is baud rate. However, the baud and bps
rates are not necessarily equal. This is due to the fact that baud rate is the modem
terminology and is defined as the number of signal changes per second. In modems a single
change of signal, sometimes transfers several bits of data. As far as the conductor wire is
concerned, the baud rate and bps are the same, and for this reason we use the bps and baud
interchangeably.
RS232 Standards
To allow compatibility among data communication equipment made by various
manufacturers, an interfacing standard called RS232 was set by the Electronics Industries
Association (EIA) in 1960. In 1963 it was modified and called RS232A. RS232B AND
RS232C were issued in 1965 and 1969, respectively. Today, RS232 is the most widely used
serial I/O interfacing standard. This standard is used in PCs and numerous types of
equipment. However, since the standard was set long before the advert of the TTL logic
family, its input and output voltage levels are not TTL compatible. In RS232, a 1 is
represented by -3 to -25V, while a 0 bit is +3 to +25V, making -3 to +3 undefined. For this
reason, to connect any RS232 to a micro controller system we must use voltage converters
such as MAX232 to convert the TTL logic levels to the RS232 voltage levels, and vice versa.
MAX232 IC chips are commonly referred to as line drivers.
RS232 pins
RS232 cable, commonly referred to as the DB-25 connector. In labeling, DB-25P refers to the plug connector (male) and DB-25S is for the socket connector (female). Since not all the pins are used in PC cables, IBM introduced the DB-9 Version of the serial I/O standard, which uses 9 pins only, as shown in table.(Out of computer and exposed end of cable)
Pin Functions:
Pin Description
1 Data carrier detect (DCD)
2 Received data (RXD)
3 Transmitted data (TXD)
4 Data terminal ready(DTR)
5 Signal ground (GND)
6 Data set ready (DSR)
7 Request to send (RTS)
8 Clear to send (CTS)
9 Ring indicator (RI)
Note: DCD, DSR, RTS and CTS are active low pins.
The method used by RS-232 for communication allows for a simple connection of three
lines: Tx, Rx, and Ground. The three essential signals for 2-way RS-232
8051 connection to RS232
The RS232 standard is not TTL compatible; therefore, it requires a line driver such as
the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa. The
interfacing of 8051 with RS232 connectors via the MAX232 chip is the main topic.
The 8051 has two pins that are used specifically for transferring and receiving data
serially. These two pins are called TXD and RXD and a part of the port 3 group (P3.0 and
P3.1). pin 11 of the 8051 is assigned to TXD and pin 10 is designated as RXD. These pins
are TTL compatible; therefore, they require a line driver to make them RS232 compatible.
One such line driver is the MAX232 chip.
Since the RS232 is not compatible with today’s microprocessors and
microcontrollers, we need a line driver (voltage converter) to convert the RS232’s signals to
TTL voltage levels that will be acceptable to the 8051’s TXD and RXD pins. One example
of such a converter is MAX232 from Maxim Corp. The MAX232 converts from RS232
voltage levels to TTL voltage levels, and vice versa.
Fig 11: Interfacing of MAX-232 to controller
Interrupts in the 8051:
In reality, only five interrupts are available to the user in the 8051, but many manufacturers’
data sheets state that there are six interrupts since they include reset .the six interrupts in the
8051 are allocated as above.
1. Reset. When the reset pin is activated, the 8051 jumps to address location 0000.this is
the power-up reset.
2. Two interrupts are set aside for the timers: one for Timer 0 and one for Timer
1.Memory location 000BH and 001BH in the interrupt vector table belong to Timer 0
and Timer 1, respectively.
3. Two interrupts are set aside for hardware external harder interrupts. Pin number
12(P3.2) and 13(P3.3) in port 3 is for the external hardware interrupts INT0 and
INT1, respectively. These external interrupts are also referred to as EX1 and
EX2.Memory location 0003H and 0013H in the interrupt vector table are assigned to
INT0 and INT1, respectively.
4. Serial communication has a single interrupt that belongs to both receive and transmit.
The interrupt vector table location 0023H belongs to this interrupt.
Interrupt Enable Register
D7 D6 D5 D4 D3 D2 D1 D0
EA IE.7 disables all interrupts. If EA=0, no interrupts is acknowledged.
If EA=1, each interrupt source is individually enabled disabled
By setting or clearing its enable bit.
-- IE.6 Not implemented, reserved for future use.*
ET2 IE.5 Enables or disables Timer 2 overflow or capture interrupt (8052
only).
ES IE.4 Enables or disables the serial ports interrupt.
ET1 IE.3 Enables or disables Timers 1 overflow interrupt
EX1 IE.2 Enables or disables external interrupt 1.
ET0 IE.1 Enables or disables Timer 0 overflow interrupt.
EX0 IE.0 Enables or disables external interrupt 0.
LCD (16X2)
The output section consists of the
LCD Display which is a
16character X 2line display
used to indicate the modes selected,
the clock time, room
temperature. Etc.
The LCD Display mainly consists of two RAM
1) Display Data RAM (DDRAM)
EA -- ET2 ES ET1 EX1 ET0 EX0
2) Character Generator RAM (CGRAM)-User defined character RAM
Display Data RAM (DDRAM)
Display data RAM (DDRAM) is where you send the characters (ASCII code) you
want to see on the LCD screen. It stores display data represented in 8-bit character codes. Its
capacity is 80 characters (bytes). Below you see DD
RAM address layout of a 2*16 LCD.
In the above memory map, the area shaded in black is the visible display (For 16x2
display).
For first line addresses for first 15 characters is from 00h to 0Fh. But for second line
address of first character is 40h and so on up to 4Fh for the 16th character.
So if you want to display the text at specific positions of LCD, we require to
manipulate address and then to set cursor position accordingly.
Character Generator RAM (CGRAM)-User defined character RAM
In the character generator RAM, we can define our own character patterns by program. CG
RAM is 64 bytes, allowing for eight 5*8 pixel, character patterns to be defined. However
how to define this and use it is out of scope of this tutorial. So I will not talk any more about
CGRAM
Registers
The HD44780 has two 8-bit registers, an instruction register (IR) and a data register (DR).
The IR stores instruction codes. The DR temporarily stores data to be written into DDRAM
or CGRAM and temporarily stores data to be read from DDRAM or CGRAM. Data written
into the DR is automatically written into DDRAM or CGRAM by an internal operation. .
These two registers can be selected by the register selector (RS) signal. See the table below:
Register Selection
RS R/W Operation
0 0 IR write as an internal operation (display clear, etc.)
0 1 Read busy flag (DB7) and address counter (DB0 to DB6)
1 0 DR write as an internal operation (DR to DDRAM or CGRAM)
1 1 DR read as an internal operation (DDRAM or CGRAM to DR)
Busy Flag (BF)
When the busy flag is 1, the LCD is in the internal operation mode, and the next
instruction will not be accepted. When RS = 0 and R/W = 1 (see the table above), the busy
flag is output to DB7 (MSB of LCD data bus). The next instruction must be written after
ensuring that the busy flag is 0.
LCD Commands
The LCD’s internal controller accept several commands and modify the display
accordingly. These commands would be things like:
– Clear screen
– Return home
– Shift display right/left
Instruction Decimal HEX
Function set (8-bit interface, 2 lines, 5*7 Pixels) 56 38
Function set (8-bit interface, 1 line, 5*7 Pixels) 48 30
Function set (4-bit interface, 2 lines, 5*7 Pixels) 40 28
Function set (4-bit interface, 1 line, 5*7 Pixels) 32 20
Scroll display one character right (all lines) 28 1E
Scroll display one character left (all lines) 24 18
Home (move cursor to top/left character position) 2 2
Move cursor one character left 16 10
Move cursor one character right 20 14
Turn on visible underline cursor 14 0E
Turn on visible blinking-block cursor 15 0F
Make cursor invisible 12 0C
Blank the display (without clearing) 8 08
Restore the display (with cursor hidden) 12 0C
Clear Screen 1 01
Set cursor position (DDRAM address) 128 + addr 80+ addr
Set pointer in character-generator RAM (CG RAM address) 64 + addr 40+ addr
Entry mode set
This command sets cursor move direction and display shift ON/OFF. There are 4
possible function set commands;04, 05, 06, and 07. This command changes the direction the
cursor moves by setting the address counter to increment or decrement. This command is
very important. If you do not understand it you may not see anything or what you actually
wanted to see on LCD screen.
Set cursor position (DDRAM address)
As said earlier if we want to display the text at specific positions of LCD, we require
to manipulate address and then to set cursor position accordingly.
Converter TTL to RS232 (MAX 232)
Meets or Exceeds TIA/EIA-232-F and ITU
Recommendation V.28
Operates From a Single 5-V Powere Supply
With 1.0-_F Charge-Pump Capacitors
Operates Up To 120 kbit/s
Two Drivers and Two Receivers 30-V Input Levels
Low Supply Current . . . 8 mA Typical
ESD Protection Exceeds JESD 22 2000-V Human-Body Model (A114-A)
Upgrade With Improved ESD (15-kV HBM) and 0.1-_F Charge-Pump Capacitors is
sbit mot_ina=P0^0;sbit mot_inb=P0^1;sbit sensor = P0^2;sbit buzzer = P1^7;//for storing the card id of the vehiclescode unsigned char card_lmv[12]="8400855A3F64";code unsigned char card_hmv[12]="8400855AB4EF";code unsigned char card_stolen[12]="8400855D663A";
unsigned char card_id[12]; //for storing the card id during serial receptionunsigned char recv_count=0; //no. of characters received
unsigned int balance_lmv=50;unsigned int balance_hmv=100;unsigned int balance_stolen=0;
unsigned char money[6]; //storing the recharge amount in the arrayunsigned int amount_cal=0; //interger value of the array moneyunsigned int multiplier=1;unsigned char lcd_pos=0;bit recharge_flag=0;//function for generating the delay of 1 msecvoid delay_ms(unsigned int msec){
unsigned int i;TMOD|=0X01;
for(i=0;i<msec;i++){
TH0=0XFC;TL0=0X77;TR0=1;while(!TF0);TR0=0;TF0=0;
}}//ISR for serial receptionvoid serial_isr(void) interrupt 4 using 2{
if(RI){
RI=0;card_id[recv_count++]=SBUF;
}}
unsigned char keypad(void){
//scanning the first rowrow1=row2=row3=row4=1;row1=0;if(col1==0){
delay_ms(32);if(col1==0){
while(!col1);return(1);
}}if(col2==0){
delay_ms(32);if(col2==0){
while(!col2);return(2);
}
}if(col3==0){
delay_ms(32);if(col3==0){
while(!col3);return(3);
}}//scanning the second rowrow1=row2=row3=row4=1;row2=0;if(col1==0){
delay_ms(32);if(col1==0){
while(!col1);return(1);
}}if(col2==0){
delay_ms(32);if(col2==0){
while(!col2);return(5);
}}if(col3==0){
delay_ms(32);if(col3==0){
while(!col3);return(6);
}}//scanning the third rowrow1=row2=row3=row4=1;row3=0;
if(col1==0){
delay_ms(32);if(col1==0){
while(!col1);return(7);
}}if(col2==0){
delay_ms(32);if(col2==0){
while(!col2);return(8);
}}if(col3==0){
delay_ms(32);if(col3==0){
while(!col3);return(9);
}}//scanning the fourth rowrow1=row2=row3=row4=1;row4=0;if(col1==0){
delay_ms(32);if(col1==0){
while(!col1);return('*');
}}if(col2==0){
delay_ms(32);if(col2==0)
{while(!col2);return(0);
}}if(col3==0){
delay_ms(32);if(col3==0){
while(!col3);return('#');
}}return('$');
}void lcd_display(unsigned int val,unsigned char x,unsigned char y){
lclrscr();lprintf(" Thank You ");gotoxy(2,1);lprintf(" USER 1 ");delay_ms(1500);lclrscr();lprintf(" Vehicle Type ");gotoxy(2,1);lprintf(" LMV ");delay_ms(1500);lclrscr();lprintf(" Account Bal. ");lcd_display(balance_lmv,2,13);gotoxy(2,14);lprintf(".001");delay_ms(1500);if(balance_lmv<20)