0% found this document useful (0 votes)
3 views

Example Document

The document discusses the concept and components of embedded systems, highlighting their specific functions, limitations, and architecture. It introduces an autonomous electronic toll gate system that utilizes GPS and GSM technology for automatic toll deduction without stopping vehicles. Additionally, it covers the role of microcontrollers in embedded systems, detailing their features and comparing them to microprocessors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Example Document

The document discusses the concept and components of embedded systems, highlighting their specific functions, limitations, and architecture. It introduces an autonomous electronic toll gate system that utilizes GPS and GSM technology for automatic toll deduction without stopping vehicles. Additionally, it covers the role of microcontrollers in embedded systems, detailing their features and comparing them to microprocessors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 84

AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CHAPTER 1

INTRODUCTION TO EMBEDDED SYSTEMS

1.1 Introduction to Embedded Systems

An embedded system can be defined as a computing device that does a


specific focused job. Appliances such as the air-conditioner, VCD player, DVD
player, printer, fax machine, mobile phone etc. are examples of embedded systems.
Each of these appliances will have a processor and special hardware to meet the
specific requirement of the application along with the embedded software that is
executed by the processor for meeting that specific requirement. The embedded
software is also called “firm ware”. The desktop/laptop computer is a general purpose
computer. You can use it for a variety of applications such as playing games, word
processing, accounting, software development and so on. In contrast, the software in
the embedded systems is always fixed listed below:

Embedded systems do a very specific task, they cannot be programmed to do


different things. . Embedded systems have very limited resources, particularly the
memory. Generally, they do not have secondary storage devices such as the CDROM
or the floppy disk. Embedded systems have to work against some deadlines. A
specific job has to be completed within a specific time. In some embedded systems,
called real-time systems, the deadlines are stringent. Missing a deadline may cause a
catastrophe-loss of life or damage to property. Embedded systems are constrained for
power. As many embedded systems operate through a battery, the power consumption
has to be very low.

Some embedded systems have to operate in extreme environmental


conditions such as very high temperatures and humidity.

1.2 Brief History:


The first recognizably modern embedded system was the Apollo Guidance
Computer, developed by Charles Stark Draper at the MIT instrumentation Laboratory.
The first mass-produced embedded system was the autonetics D-17 guidance
Computer for the Minueteman (missile), released in 1961. It was built from transistor
logic and had a hard disk for main memory.

ECE Department, SITAM 1


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Since these early applications in the 1960s, embedded systems have come
down in price. There has also be an enormous rise in processing power and
functionality. For example the first microprocessor was the Intel 4004, which found
its way into calculators and other small systems, but required external memory and
support chips.

In 1978 National Engineering Manufacturers Association released the


standard for a programmable microcontroller. The definition was an almost any
Computer –based controller. They included single board Computers, numerical
controllers and sequential controllers in order to perform event-based instructions. By
the mid-1980s, many of he previously external system components had been
integrated into the same chip as the processor, resulting in integrated circuits called
microcontrollers, and wide spread use of embedded systems became feasible.
Presently, a lot of varieties of embedded systems are available at very low costs.

1.3 Overview of Embedded System Architecture:

Every embedded system consists of custom-built hardware built around a


Central Processing Unit (CPU). This hardware also contains memory chips onto
which the software is loaded. The software residing on the memory chip is also called
the ‘firmware’.

The operating system runs above the hardware, and the application
software runs above the operating system. The same architecture is applicable to any
computer including a desktop computer. However, there are significant differences. It
is not compulsory to have an operating system in every embedded system. For small
appliances such as remote control units, air conditioners, toys etc., there is no need for
an operating system and you can write only the software specific to that application.
For applications involving complex processing, it is advisable to have an operating
system. In such a case, you need to integrate the application software with the
operating system and then transfer the entire software on to the memory chip. Once
the software is transferred to the memory chip, the software will continue to run for a
long time you don’t need to reload new software.

ECE Department, SITAM 2


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Now, let us see the details of the various building blocks of the hardware of an
embedded system. As shown in Fig. the building blocks are;

· Central Processing Unit (CPU)

· Memory (Read-only Memory and Random Access Memory)

· Input Devices

· Output devices

· Communication interfaces

· Application-specific circuitry

1.3.1Central Processing Unit (CPU):

The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-
controller is a low-cost processor. Its main attraction is that on the chip itself, there
will be many other components such as memory, serial communication interface,
analog-to digital converter etc. So, for small applications, a micro-controller is the
best choice as the number of external components required will be very less. On the
other hand, microprocessors are more powerful, but you need to use many external
components with them. DSP is used mainly for applications in which signal
processing is involved such as audio and video processing.

1.3.2 Memory:

The memory is categorized as Random Access 11emory (RAM) and Read


Only Memory (ROM). The contents of the RAM will be erased if power is switched
off to the chip, whereas ROM retains the contents even if the power is switched off.
So, the firmware is stored in the ROM. When power is switched on, the processor
reads the ROM; the program is program is executed.

1.3.3 Input devices:

Unlike the desktops, the input devices to an embedded system have very
limited capability. There will be no keyboard or a mouse, and hence interacting with

ECE Department, SITAM 3


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

the embedded system is no easy task. Many embedded systems will have a small
keypad-you press one key to give a specific command. A keypad may be used to input
only the digits. Many embedded systems used in process control do not have any
input device for user interaction; they take inputs from sensors or transducers 1’fnd
produce electrical signals that are in turn fed to other systems.

1.3.4 Output devices:

The output devices of the embedded systems also have very limited capability.
Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate
the health status of the system modules, or for visual indication of alarms. A small
Liquid Crystal Display (LCD) may also be used to display some important
parameters.

1.3.5 Communication interfaces:

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

1.4 PERIPHERALS:

Peripherals are the various devices that are connected to the CPU, for
performing various functions. Embedded systems talk with the outside world via
peripherals, such as:

 Serial communication interfaces (SCI): RS-232, RS-422, RS-458 etc.


 Synchronous Serial communication interfaces (SSCI): I2C, JTAG, SPI,
SSC and ESSI
 Universal Serial Bus (USB)
 Networks: Controller Area Network, etc.
 Timers: PLL(s), Capture/Compare and Time Processing units.
 Discrete I/O: General Purpose Input/Output (GPIO).

ECE Department, SITAM 4


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Fig 1.1 block diagram of


communication
interference b/w
microprocessor and
memory device

1.5
PROCCESORS:

Processors are the key elements in any embedded system. They interact with
the memory, where the various instructions of useful functions into a single IC
package.

These functions are:

 The ability to execute a stored set of instructions to carry out user defined
tasks.
 The ability to be able to access external memory chips to both read and writes
data from and to the memory.

1.6 RELIABILITY:

Embedded systems often reside in machines that are expected to run


continuously for years without errors and in some cases recover by themselves if
any error occurs. Therefore the software is usually developed and tested more
carefully than that for PC, and unreliable mechanical moving parts such as Disk
drives, switches or buttons are avoided.

Specific reliability issues may include:

 The system cannot safely be shut down for repair, or it is too inaccessible to
repair. Solutions may involve subsystems with redundant spares that can be
switched over to, or software “limp modes” that provide partial function. Examples
include space systems, undersea cables, navigational beacons, bore-hole systems
and automobiles.

ECE Department, SITAM 5


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

 The system must be kept running for safety reasons. “Limp modes” are less
tolerable. Often backups are selected by an operator. Examples include Aircraft,
Navigation, Reactor control systems, safety-critical Chemical factory controls, Train
signals and engines on single-engine Aircraft.
 The system will loose large amounts of money when shutdown: Telephone
switches, Factory controls, Bridge and elevator controls, funds transfer and
market making, automated sales and service.
Physically, embedded systems ranged from portable devices such as MP3
players, to large stationary installations like traffic lights, Factory controllers. In
terms of complexity embedded systems can range from very simple with a single
microcontroller chip to very complex with multiple units, peripherals and networks
mounted inside a large chassis or enclosure.

ECE Department, SITAM 6


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CHAPTER 2
CIRCUIT OPERATION
2.1 OVERVIEW
The proposed system is an embedded system which will be used at toll gates
for the automatic deduction of toll tax without stopping the vehicles. This process is
done with help of GPS and GSM technology. When the vehicle crossed the toll gate
then the money will be deducted from the owners account if there is insufficient
balance then the request will be sent to deduct from friends account

2.2 Block Diagram:

ECE Department, SITAM 7


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

2.2 Steps of working:

Initially start the circuit and set all initial values to zero

Now the gps ,finds the exact position(latitude and longitude)of the vehicle

The obtained gps data is sent to microcontroller for further processing this data is
initially stored in a buffer

Initially the location of the toll gates are predefined in the gpsn the similar manner ,as
and when the vehicle crosses the toll gates the ssame process will be repeated

Then again a message indicating the toll tax fee and remaining balance is displayed on
the mobile screen

For suppose if there is no balance in the customer account then there will be another
facility to add friends acoount and use his balance at instance ,officially

To access friends account a meesage indicating ACC Account number is sent to the
sim

This GPS can also be used in theft situation

ECE Department, SITAM 8


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CHAPTER 3
MICRO CONTROLLERS

3.1. Introduction:

Circumstances that we find ourselves in today in the field of microcontrollers


had their beginnings in the development of technology of integrated circuits. This
development has made it possible to store hundreds of thousands of transistors into
one chip. That was a prerequisite for production of microprocessors, and the first
computers were made by adding external peripherals such as memory, input-output
lines, timers and other. Further increasing of the volume of the package resulted in
creation of integrated circuits. These integrated circuits contained both processor and
peripherals. That is how the first chip containing a microcomputer, or what would
later be known as a microcontroller came about.

3.2. Definition Of A Microcontroller:


Microcontroller, as the name suggests, are small controllers. They are like
single chip computers that are often embedded into other systems to function as
processing/controlling unit. For example, the remote control you are using probably
has microcontrollers inside that do decoding and other controlling functions. They are
also used in automobiles, washing machines, microwave ovens, toys ... etc, where
automation is needed.

The key features of microcontrollers include:

 Integration of Functionality
 Microcontrollers sometimes are called single-chip computers because they
have on-chip memory and I/O circuitry and other circuitries that enable them to
function as small standalone computers without other supporting circuitry.
 Field Programmability, Flexibility
 Microcontrollers often use EEPROM or EPROM as their storage device to
allow field programmability so they are flexible to use. Once the program is tested to
be correct then large quantities of microcontrollers can be programmed to be used in
embedded systems.

ECE Department, SITAM 9


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

 Easy to Use
Assembly language is often used in microcontrollers and since they usually follow
RISC architecture, the instruction set is small. The development package of
microcontrollers often includes an assembler, a simulator, a programmer to "burn" the
chip and a demonstration board. Some packages include a high level language
compiler such as a C compiler and more sophisticated libraries.

Most microcontrollers will also combine other devices such as:

 A Timer module to allow the microcontroller to perform tasks for certain time
periods.
 A serial I/O port to allow data to flow between the microcontroller and other
devices such
 as a PC or another microcontroller.
 An ADC to allow the microcontroller to accept analogue input data for
processing.

Fig 3.1: Showing a typical microcontroller device and its different


subunits

3.3. Microcontrollers versus Microprocessors:

ECE Department, SITAM 10


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Microcontroller differs from a microprocessor in many ways. First and the


most important is its functionality. In order for a microprocessor to be used, other
components such as memory, or components for receiving and sending data must be
added to it. In short that means that microprocessor is the very heart of the computer.
On the other hand, microcontroller is designed to be all of that in one. No other
external components are needed for its application because all necessary peripherals
are already built into it. Thus, we save the time and
space needed to construct devices.
3.4. Features of P89V51RD2:

The P89V51RD2 is an 80C51 microcontroller


with 64 kB Flash and 1024 bytes of data RAM. A key
feature of the P89V51RD2 is its X2 mode option. The
design engineer can choose to run the application with
the conventional 80C51 clock rate (12 clocks per
machine cycle) or select the X2 mode (6 clocks per
machine cycle) to achieve twice the throughput at the
same clock frequency. Another way to benefit from
this feature is to keep the same performance by
reducing the clock frequency by half, thus dramatically reducing the EMI.
The Flash program memory supports both parallel programming and in serial
In-System Programming (ISP). Parallel programming mode offers gang-programming
at high speed, reducing programming costs and time to market. ISP allows a device to
be reprogrammed in the end product under software control. The capability to
field/update the application firmware makes a wide range of applications possible.The
P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash program
memory to be reconfigured even while the application is running.
80C51 Central Processing Unit
 5 V Operating voltage from 0 to 40 MHz
 64 kB of on-chip Flash program memory with ISP (In-System
Programming)
 IAP (In-Application Programming)
 SPI (Serial Peripheral Interface) and enhanced UART

ECE Department, SITAM 11


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

 PCA (Programmable Counter Array) with PWM and Capture/Compare


functions
 Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each)
 Three 16-bit timers/counters
 Programmable Watchdog timer (WDT)
 Eight interrupt sources with four priority levels, Second DPTR register

3.5. Pin Diagram Of P89V51RD2:

3.5.1. Pin Description:

VCC - Supply voltage.

VSS - Ground.

Port 0:

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each


pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used
as high impedance inputs.Port 0 may also be configured to be the multiplexed low
order address/data bus during accesses to external program and data memory. In this
mode P0 has internal pull ups. Port 0 also receives the code bytes during Flash
programming, and outputs the code bytes during program verification. External pull
ups are required during program verification.

Port 1

buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins
they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port
1 pins that are externally being pulled low will source current (IIL), because of the
internal pull ups. Port 1 also receives the low-order address bytes during Flash
programming and verification.

ECE Department, SITAM 12


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Port 1 is an 8-bit bi-directional I/O port with internal pull ups. The Port 1

output.

Port 2

Port 2 is an 8-bit bi-directional I/O port with internal pull ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins
they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port
2 pins that are externally being pulled low will source current (IIL) because of the
internal pull ups.

Port 2 emits the high-order address byte during fetches from external program
memory and during accesses to external data memory that use 16-bit addresses
(MOVX @DPTR). In this application, it uses strong internal pull ups when emitting
1s. During accesses to external data memory hat use 8-bit addresses (MOVX @ RI),
Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the
high-order address bits and some control signals during Flash programming and
verification.

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are
pulled high by the internal pull ups and can be used as inputs. As inputs,

ECE Department, SITAM 13


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Port 3 pins that are externally being pulled low will source current (IIL)
because of the pull ups.

Port 3 also serves the functions of various special features of the AT89C51 as listed
below:

Port Pin Alternate Functions:

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 RD (external data memory read strobe

Port 3 also receives some control signals for Flash programming and verification.

RST:

Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.

ALE/PROG

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

ECE Department, SITAM 14


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

PSEN

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

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on
reset. EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage ( VPP) during Flash programming,
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.

3.6. NECESSITY OF MICROCONTROLLERS:

Microprocessors brought the concept of programmable devices and made many


applications of intelligent equipment. Most applications, which do not need large
amount of data and program memory, tended to be:

1.Costly:

The microprocessor system had to satisfy the data and program requirements
so, sufficient RAM and ROM are used to satisfy most applications .The peripheral
control equipment also had to be satisfied. Therefore, almost all-peripheral chips were
used in the design. Because of these additional peripherals cost will be comparatively
high.

In comparison a typical Micro controller 8051 chip has all that the 8051 board
has except a reduced memory as follows.
4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to 32-KB.

ECE Department, SITAM 15


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

2 .Bulky:

On comparing a board full of chips (Microprocessors) with one chip with all
components in it (Micro controller) .

3. Debugging:

Lots of Microprocessor circuitry and program to debug . In Micro controller


there is no Microprocessor circuitry to debug.

4. Slower Development time: As we have observed Microprocessors need a lot of


debugging at board level and at program level, where as, Micro controller do not have
the excessive circuitry and the built-in peripheral chips are easier to program for
operation.

So peripheral devices like Timer/Counter, Parallel programmable port, Serial


Communication Port, Interrupt controller and so on, which were most often used were
integrated with the Microprocessor to present the Micro controller .RAM and ROM
also were integrated in the same chip. The ROM size was anything from 256 bytes to
32Kb or more. RAM was optimized to minimum of 64 bytes to 256 bytes or more.

3.7. P89V51RD2 Micro Controller Architecture


The P89V51RD2 architecture consists of these specific features:

 Eight –bit CPU with registers A (the accumulator) and B


 Sixteen-bit program counter (PC) and data pointer (DPTR)
 Eight- bit stack pointer (PSW)
 Eight-bit stack pointer (Sp)
 Internal ROM or EPROM (8751) of 0(8031) to 4K (8051)
 Internal RAM of 128 bytes:
1. Four register banks, each containing eight registers
2. Sixteen bytes, which maybe addressed at the bit level
3. Eighty bytes of general- purpose data memory
 Thirty –two input/output pins arranged as four 8-bit ports:p0-p3
 Two 16-bit timer/counters: T0 and T1 and T2
 Full duplex serial data receiver/transmitter: SBUF

ECE Department, SITAM 16


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

 Control registers: TCON, TMOD, SCON, PCON, IP, and IE


 Two external and three internal interrupts sources.
 Oscillator and clock circuits.

Fig 3.2: Functional block diagram of micro controller

3.7.1. 8051 Oscillator And Clock (P89V51RD2):

The heart of the 8051 circuitry that generates the clock pulses by which all the
internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is
provided for connecting a resonant network to form an oscillator. Typically a quartz
crystal and capacitors are employed. The crystal frequency is the basic internal clock
frequency of the microcontroller. The manufacturers make 8051 designs that run at
specific minimum and maximum frequencies typically 1 to 16 MHz.

ECE Department, SITAM 17


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Fig 3.3: -Oscillator and timing circuit


3.7.2.Types Of Memory:

The P89V51RD2 has 1 kB of RAM.


The device has four sections of internal data memory:
1. The lower 128 bytes of RAM (00H to 7FH) are directly and indirectly addressable.
2. The higher 128 bytes of RAM (80H to FFH) are indirectly addressable.
3. The special function registers (80H to FFH) are directly addressable only.
4. The expanded RAM of 768 bytes (00H to 2FFH) is indirectly addressable by the
move external instruction (MOVX) and clearing the EXTRAM bit. (See ‘Auxiliary
Register (AUXR) Since the upper 128 bytes occupy the same addresses as the SFRs,
the RAM must be accessed indirectly. The RAM and SFRs space are physically
separate eventhough they have the same addresses determines whether to access the
SFRs or RAM by the type of instruction given. If it is indirect, then RAM is accessed.
If it is direct, then an SFR is accessed. See the examples below.

Indirect Access:

ECE Department, SITAM 18


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

MOV@R0, #data; R0 contains 90H


Register R0 points to 90H which is located in the upper address range. Data in ‘#data’
is writ9en to RAM location 90H rather than port 1.
Direct Access:
MOV90H, #data; write data to P1 Data in ‘#data’ is written to port 1. Instructions that
write directly to the address write to the SFRs.

To access the expanded RAM, the EXTRAM bit must be cleared and MOVX
instructions must be used. The extra 768 bytes of memory is physically located on the
chip and logically occupies the first 768 bytes of external memory (addresses 000H to
2FFH). When EXTRAM = 0, the expanded RAM is indirectly addressed using the
MOVX instruction in combination with any of the registers R0, R1 of the selected
bank or DPTR. Accessing the expanded RAM does not affect ports P0, P3.6 (WR),
P3.7
(RD), or P2. With EXTRAM = 0, the expanded RAM can be accessed as in the
following example.
Expanded RAM Access (Indirect Addressing only):

When EXTRAM = 1, MOVX @Ri and MOVX @DPTR will be similar to the
standard 8051. Using MOVX @Ri provides an 8-bit address with multiplexed data on
Port 0. Other output port pins can be used to output higher order address bits. This
provides external paging capabilities. Using MOVX @DPTR generates a 16-bit
address. This allows external addressing up the 64 kB. Port 2 provides the high-order
eight address bits (DPH), and Port 0 multiplexes the low order eight address bits
(DPL) with data. Both MOVX @Ri and MOVX @DPTR generates the necessary
read and write signals (P3.6 - WR and P3.7 - RD) for external memory use. shows
external data memory RD, WR operation with EXTRAM bit. The stack pointer (SP)
can be located anywhere within the 256 bytes of internal RAM (lower 128 bytes and
upper 128 bytes). The stack pointer may not be located in any part of the expanded
RAM.
3.7.3 Special Function registered memory:

Special function registers are the areas of memory that control specific
functionality of the 8051 micro controller.

ECE Department, SITAM 19


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

a) Accumulator (0E0h)

As its name suggests, it is used to accumulate the results of large no of


instructions. It can hold 8 bit values.

b) B register (0F0h)

The B register is very similar to accumulator. It may hold 8-bit value. The b
register is only used by MUL AB and DIV AB instructions. In MUL AB the higher
byte of the product gets stored in B register. In div AB the quotient gets stored in B
with the remainder in A.

c) Stack pointer (81h)


The stack pointer holds 8-bit value. This is used to indicate where the next
value to be removed from the stack should be taken from. When a value is to be
pushed onto the stack, the 8051 first store the value of SP and then store the value at
the resulting memory location . When a value is to be popped from the stack, the
8051 returns the value from the memory location indicated by SP and then
decrements the value of SP.

d) Data pointer

The SFRs DPL and DPH work together work together to represent a 16-bit
value called the data pointer. The data pointer is used in operations regarding
external RAM and some instructions code memory. It is a 16-bit SFR and also an
addressable SFR.

e) Program counter

The program counter is a 16 bit register, which contains the 2 byte address,
which tells the 8051 where the next instruction to execute to be found in memory.
When the 8051 is initialized PC starts at 0000h. And is incremented each time an
instruction is executes. It is not addressable SFR.

f) PCON (power control, 87h)

The power control SFR is used to control the 8051’s power control modes.
Certain operation modes of the 8051 allow the 8051 to go into a type of “sleep mode
” which consume much lee power.

ECE Department, SITAM 20


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

g) TCON (timer control, 88h)

The timer control SFR is used to configure and modify the way in which the
8051’s two timers operate. This SFR controls whether each of the two timers is
running or stopped and contains a flag to indicate that each timer has overflowed.
Additionally, some non-timer related bits are located in TCON SFR. These bits are
used to configure the way in which the external interrupt flags are activated, which
are set when an external interrupt occurs.

h) TMOD (Timer Mode, 89h)

The timer mode SFR is used to configure the mode of operation of each of the
two timers. Using this SFR your program may configure each timer to be a 16-bit
timer, or 13 bit timer, 8-bit auto reload timer, or two separate timers. Additionally
you may configure the timers to only count when an external pin is activated or to
count “events ” that are indicated on an external pin.

i) TO (Timer 0 low/high, address 8A/8C h)

These two SFRs taken together represent timer 0. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up. What is configurable is how and when they increment in value.

j) T1 (Timer 1 Low/High, address 8B/ 8D h)

ECE Department, SITAM 21


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

These two SFRs, taken together, represent timer 1. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up. What is

Configurable is how and when they increment in value.

k) P0 (Port 0, address 90h, bit addressable)

This is port 0 latch. Each bit of this SFR corresponds to one of the pins on a
micro controller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P0.0, bit 7 is pin p0.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to low level.

l) P1 (port 1, address 90h, bit addressable)

This is port latch1. Each bit of this SFR corresponds to one of the pins on a micro
controller. Any data to be outputted to port 0 is first written on P0 register. For e.g.,
bit 0 of port 0 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this SFR
will send a high level on the corresponding I/O pin whereas a value of 0 will bring it
to low level

m) P2 (port 2, address 0A0h, bit addressable) :

This is a port latch2. Each bit of this SFR corresponds to one of the pins on a micro
controller. Any data to be outputted to port 0 is first written on P0 register. For e.g.,
bit 0 of port 0 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to a bit of this SFR
will send a high level on the corresponding I/O pin whereas a value of 0 will bring it
to low level.

n) P3(port 3,address B0h, bit addressable) :

This is a port latch3. Each bit of this SFR corresponds to one of the pins on a micro
controller. Any data to be outputted to port 0 is first written on P0 register. For e.g.,
bit 0 of port 0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this SFR
will send a high level on the corresponding I/O pin whereas a value of 0 will bring it
to low level

o) IE (interrupt enable, 0A8h):

ECE Department, SITAM 22


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

The Interrupt Enable SFR is used to enable and disable specific interrupts. The
low 7 bits of the SFR are used to enable/disable the specific interrupts, where the
MSB bit is used to enable or disable all the interrupts. Thus, if the high bit of IE is 0
all interrupts are disabled regardless of whether an individual interrupt is enabled by
setting a lower bit.

p) IP (Interrupt Priority, 0B8h)


The interrupt priority SFR is used to specify the relative priority of each
interrupt. On 8051, an interrupt maybe either low or high priority. An interrupt may
interrupt interrupts. For e.g., if we configure all interrupts as low priority other than
serial interrupt. The serial interrupt always interrupts the system, even if another
interrupt is currently executing. However, if a serial interrupt is executing no other
interrupt will be able to interrupt the serial interrupt routine since the serial interrupt
routine has the highest priority.

q) PSW (Program Status Word, 0D0h)


The program Status Word is used to store a number of important bits that are
set and cleared by 8051 instructions. The PSW SFR contains the carry flag, the
auxiliary carry flag, the parity flag and the overflow flag. Additionally, it also
contains the register bank select flags, which are used to select, which of the “R”
register banks currently in use.

r) SBUF (Serial Buffer, 99h)


SBUF is used to hold data in serial communication. It is physically two
registers. One is writing only and is used to hold data to be transmitted out of 8051 via

ECE Department, SITAM 23


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

TXD. The other is read only and holds received data from external sources via RXD.
Both mutually exclusive registers use address 99h.

3.8. I/O ports:


One major feature of a microcontroller is the versatility built into the
input/output (I/O) circuits that connect the 8051 to the outside world. The main
constraint that limits numerous functions is the number of pins available in the 8051
circuit. The DIP had 40 pins and the success of the design depends on the flexibility
incorporated into use of these pins. For this reason, 24 of the pins may each used for
one of the two entirely different functions which depend, first, on what is physically
connected to it and, then, on what software programs are used to “program” the pins.

PORT 0
Port 0 pins may serve as inputs, outputs, or, when used together, as a bi
directional low-order address and data bus for external memory. To configure a pin as
input, 1 must be written into the corresponding port 0 latch by the program. When
used for interfacing with the external memory, the lower byte of address is first sent
via PORT0, latched using Address latch enable (ALE) pulse and then the bus is
turned around to become the data bus for external memory.

PORT 1
Port 1 is exclusively used for input/output operations. PORT 1 pins have no
dual function. When a pin is to be configured as input, 1 is to be written into the
corresponding Port 1 latch.

PORT 2
Port 2 may be used as an input/output port. It may also be used to supply a
high –order address byte in conjunction with Port 0 low-order byte to address external
memory. Port 2 pins are momentarily changed by the address control signals when
supplying the high byte a 16-bit address. Port 2 latches remain stable when external
memory is addressed, as they do not have to be turned around (set to 1) for data input
as in the case for Port 0.

ECE Department, SITAM 24


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

PORT 3
Port 3 may be used to input /output port. The input and output functions can be
programmed under the control of the P3 latches or under the control of various special
function registers. Unlike Port 0 and Port 2, which can have external addressing
functions and change all eight-port b se, each pin of port 3 maybe individually
programmed to be used as I/O or as one of the alternate functions. The Port 3 alternate
uses are:

Pin Alternate Use SFR


P3.0 - RXD Serial data input SBUF
P3.1 - TXD Serial data output SBUF
P3.2 - INTO 0 External interrupt 0
TCON.1
P3.3 - INTO 1 External interrupt 1
TCON.3
P3.4 - T0 External Timer 0 input
TMOD
P3.5 – T1 External timer 1 input
TMOD
P3.6 - WR External memory write pulse -
P3.7 - RD External memory read pulse -

3.9. INTERRUPTS:
Interrupts are hardware signals that are used to determine conditions that exist
in external and internal circuits. Any interrupt can cause the 8051 to perform a
hardware call to an interrupt –handling subroutine that is located at a predetermined
absolute address in the program memory.
Five interrupts are provided in the 8051. Three of these are generated
automatically by the internal operations: Timer flag 0, Timer Flag 1, and the serial
port interrupt (RI or TI) Two interrupts are triggered by external signals provided by
the circuitry that is connected to the pins INTO 0 and INTO1. The interrupts maybe
enable or disabled, given priority or otherwise controlled by altering the bits in the
Interrupt Enabled (IE) register, Interrupt Priority (IP) register, and the Timer Control

ECE Department, SITAM 25


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

(TCON) register. . These interrupts are mask able i.e. they can be disabled. Reset is a
non maskable interrupt which has the highest priority. It is generated when a high is
applied to the reset pin. Upon reset, the registers are loaded with the default values.
Each interrupt source causes the program to do store the address in PC onto
the stack and causes a hardware call to one of the dedicated addresses in the program
memory. The appropriate memory locations for each for each interrupt are as follows:
Interrupt Address
RESET 0000
IE0 (External interrupt 0) 0003
TF0 (Timer 0 interrupt) 000B
IE1 (External interrupt 1) 0013
TF1 (Timer 1 interrupt) 001B
SERIAL 0023
Functions of micro controller in main unit are

1. Sends appropriate commands to ADC to start conversion,

2. Collects the output of ADC for every 10 sec and stores in buffer,

3. Sends command to the modem for dialing the base every 80 sec,

4. Sends data in a serial manner to MODEM,

5. After data gets transmitted sends command for disconnection.

6. Sends appropriate information to the display unit as per status


of the communication medium.

3.10. Programming the Flash

There are two internal flash memory blocks in the device. Block 0 has 64
kbytes and contains the user’s code. Block 1 contains the Philips-provided ISP/IAP
routines and may be enabled such that it overlays the first 8k bytes of the user code
memory. The 64 kB Block 0 is organized as 512 sectors, each sector consists of 128
bytes. Access to the IAP routines may be enabled by clearing the BSEL bit in the FCF
register. However, caution must be taken when dynamically changing the BSEL bit.

ECE Department, SITAM 26


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Since this will cause different physical memory to be mapped to the logical program
address space, the user must avoid clearing the BSEL bit when executing user code
within the address range 0000H to 1FFFH.

The P89V51RD2 code memory array is programmed byte-by byte In either


programming mode. To program any nonblank byte in the on-chip Flash Memory, the
entire memorymust be erased using the Chip Erase Mode.

3.10.1.Programming Algorithm:

Before programming the P89V51RD2, the address, data and control signals should be
set up according to the Flash programming mode table. To program the P89V51RD2,
take the following steps.

1. Input the desired memory location on the address lines.

2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals.

4. Raise EA/VPP to 12V for the high-voltage programming mode.

5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The
byte-write cycle is self-timed and typically takes no more than 1.5 ms. Repeat steps 1
through 5, changing the address and data for the entire array or until the end of the
object file is reached.

ECE Department, SITAM 27


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CHAPTER 4

HARDWARE DESCRIPTION
4.1 REGULATED POWER SUPPLY

4.1.1 DESCRIPTION

A variable regulated power supply, also called a variable bench power supply,
is one where you can continuously adjust the output voltage to your requirements.
Varying the output of the power supply is the recommended way to test a project after
having double checked parts placement against circuit drawings and the parts
placement guide.

This type of regulation is ideal for having a simple variable bench power
supply. Actually this is quite important because one of the first projects a hobbyist
should undertake is the construction of a variable regulated power supply. While a
dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a variable
supply on hand, especially for testing.

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 supply
ranging from 9 volts to 24 volts DC (A 12 volt power supply is included with the Beginner Kit
and the Microcontro.. Fig 4.1

ller Beginner Kit Fig 4.1

ECE Department, SITAM 28


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

To make a 5 volt power supply, we use a LM7805 voltage regulator IC


(Integrated Circuit). The IC is shown below.

Any invention of latest technology cannot be activated without the source of


power. So in this fast moving world we deliberately need a proper power source
which will be apt for a particular requirement. All the electronic components starting
from diode to ics only work with a DC supply ranging from 5V to 12V.We are
utilizing for the same, the cheapest and commonly available energy source of 230V-
50Hz and stepping down, rectifying, filtering and regulating the voltage.

Transformer:

A bridge rectifier coupled with a step down transformer is used for our design.
The voltage rating of transformer used is 0-12V and the current rating is

500mA. When AC voltage of 230V is applied across the primary winding an output
AC voltage of 12V is obtained. One alteration of input causes the top of transformer
to be positive and the bottom negative. The next alteration will temporarily cause the
reverse.

Rectifier:

In the power supply unit, rectification is normally achieved using a solid state
diode. Diode has the property that will let the electron flow easily at one direction at
proper biasing condition. Bridge rectifiers of 4 diodes are used to achieve full wave
rectification. Two diodes will conduct during the negative cycle and the other two will
conduct during the positive half cycle.

Filtering unit:

Filter circuit which is usually a capacitor acts as a surge arrester always


follows the rectifier unit. This capacitor is also called as a decoupling capacitor or a
bypass capacitor, is used not only to short the ripple with frequency to ground but also
leave the frequency of the DC to appear at the output.

ECE Department, SITAM 29


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Regulators:

The voltage regulators play an important role in any power supply unit. The
primary purpose of a regulator is to aid the rectifier and filter circuit in providing a
constant DC voltage to the device. Power supplies without regulators haveinherent
problem of changing DC voltage values due to variations in the load or due to
fluctuations in the AC line voltage. With a regulator connected to DC
output, the voltage can be maintained within a close tolerant region of the desired
output. IC 7805 and 7812 regulators are used in this project for providing a DC
voltage of +5V and +12V respectively.

LM78XX

The LM78XX series of three terminal regulators is available with several


fixed output voltages making them useful in a wide range of applications. One of
these is local on card regulation, eliminating the distribution problems associated with
single point regulation. The voltages available allow these regulators to be used in
logic systems, instrumentation, HiFi, and other solid state electronic equipment.
Although designed primarily as fixed voltage regulators these devices can be used
with external components to obtain adjustable voltages and currents .

The LM78XX series is available in an aluminium TO-3 package which will allow
over 1.0A load current if adequate .

Heat sinking is provided. Current limiting is included to limit the peak output current
to a safe value. Safe area protection for the output transistor is provided to limit
internal power dissipation. If internal power dissipation becomes too high for the heat
sinking provided, the thermal shutdown circuit takes cover preventing the IC from
overheating. Considerable effort was expanded to make the LM78XX series of
regulators easy to use and minimize the number of external components. It is not
necessary to bypass the output, although this does improve transient response. Input
bypassing is needed only if the regulator is located far from the filter capacitor of the
power supply. For output voltage other than 5V, 12V and 15V the LM117 Series
provides an output voltage range from 1.2V to 57V.

ECE Department, SITAM 30


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

4.1.2 CIRCUIT FEATURES

 Brief description of operation: Gives out well regulated +5V output, output
current capability of 100 mA
 Circuit protection: Built-in overheating protection shuts down output when
regulator IC gets too hot
 Circuit complexity: Very simple and easy to build
 Circuit performance: Very stable +5V output voltage, reliable operation
 Availability of components: Easy to get, uses only very common basic
components
 Design testing: Based on datasheet example circuit, I have used this circuit
successfully as part of many electronics projects
 Applications: Part of electronics devices, small laboratory power supply
 Power supply voltage: Unregulated DC 8-18V power supply
 Power supply current: Needed output current + 5 mA
 Component costs: Few dollars for the electronics components + the input
transformer cost

BLOCK DIAGRAM

Fig 4.2

ECE Department, SITAM 31


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

BASIC POWER SUPPLY CIRCUIT

Above is the circuit of a basic unregulated dc power supply. A bridge


rectifier D1 to D4 rectifies the ac from the transformer secondary, which may also be
a block rectifier such as WO4 or even four individual diodes such as 1N4004 types.
(See later re rectifier ratings).

The principal advantage of a bridge rectifier is you do not need a centre


tap on the secondary of the transformer. A further but significant advantage is that the
ripple frequency at the output is twice the line frequency (i.e. 50 Hz or 60 Hz) and
makes filtering somewhat easier.

Fig 4.3 power supply circuit

Here we will go for a voltage of about 12 - 13V at a maximum output current


(IL) of 500ma (0.5A). Maximum ripple will be 2.5% and load regulation is 5%.

Now the RMS secondary voltage (primary is whatever is consistent with your
area) for our power transformer T1 must be our desired output Vo PLUS the voltage
drops across D2 and D4 ( 2 * 0.7V) divided by 1.414.

This means that Vsec = [13V + 1.4V] / 1.414 which equals about 10.2V.
Depending on the VA rating of your transformer, the secondary voltage will vary
considerably in accordancewith the applied load. The secondary voltage on a
transformer advertised as say 20VA will be much greater if the secondary is only
lightly loaded.

ECE Department, SITAM 32


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

If we accept the 2.5% ripple as adequate for our purposes then at 13V this
becomes 13 * 0.025 = 0.325 Vrms. The peak to peak value is 2.828 times this value.
Vrip = 0.325V X 2.828 = 0.92 V and this value is required to calculate the value of
C1. Also required for this calculation is the time interval for charging pulses. If you
are on a 60Hz system it it 1/ (2 * 60 ) = 0.008333 which is 8.33 milliseconds. For a
50Hz system it is 0.01 sec or 10 milliseconds.

Remember the tolerance of the type of capacitor used here is very loose.
The important thing to be aware of is the voltage rating should be at least 13V X
1.414 or 18.33. Here you would use at least the standard 25V or higher (absolutely not
16V).With our rectifier diodes or bridge they should have a PIV rating of 2.828 times
the Vsec or at least 29V. Don't search for this rating because it doesn't exist. Use the
next highest standard or even higher. The current rating should be at least twice the
load current maximum i.e. 2 X 0.5A or 1A. A good type to use would be 1N4004,
1N4006 or 1N4008 types.

ECE Department, SITAM 33


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

4.2 MAX 232

INTRODUCTION:

The MAX232 is a dual driver/receiver that includes a capacitive


voltage generator to supply TIA/EIA-232-F voltage levels from a single 5-V supply.
Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers
have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V
inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.

4.2.1 PIN DIAGRAM:

The MAX232 from MAXIM was the first IC


which in one package contains the necessary drivers (two) and
receivers (also two), to adapt the RS-232 signal voltage levels
to TTL logic. It became popular, because it just needs one
voltage (+5V) and generates the necessary RS-232 voltage

ECE Department, SITAM 34


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

levels (approx. -10V and +10V) internally. This greatly simplified the design of
circuitry.

Circuitry designers no longer need to design and build a power supply with three
voltages (e.g. -12V, +5V, and +12V), but could just provide one +5V power supply,
e.g. with the help of a simple 78x05 voltage converter.

4.2.2 FUNCTION TABLES:

AX232 Pin Layout

Capacitor
Capacitor
No. Name Purpose Signal Voltage Value
Value MAX232
MAX232A

+ connector for capacitor should


1 C1+ 1µF 100nF
capacitor C1 stand at least 16V

+10V, capacitor
output of voltage
2 V+ should stand at 1µF to VCC 100nF to VCC
pump
least 16V

- connector for capacitor should


3 C1- 1µF 100nF
capacitor C1 stand at least 16V

+ connector for capacitor should


4 C2+ 1µF 100nF
capacitor C2 stand at least 16V

- connector for capacitor should


5 C2- 1µF 100nF
capacitor C2 stand at least 16V

6 V- 1µF to GND 100nF to GND


output of voltage -10V, capacitor

ECE Department, SITAM 35


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

should stand at
pump / inverter
least 16V

7 T2out Driver 2 output RS-232

8 R2in Receiver 2 input RS-232

9 R2out Receiver 2 output TTL

10 T2in Driver 2 input TTL

11 T1in Driver 1 input TTL

12 R1out Receiver 1 output TTL

13 R1in Receiver 1 input RS-232

14 T1out Driver 1 output RS-232

15 GND Ground 0V 1µF to VCC 100nF to VCC

16 VCC Power supply +5V see above see above

4.2.3 LOGIC DIAGRAM:

ECE Department, SITAM 36


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

The MAX232 has two receivers (converts from RS-232 to TTL voltage
levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This
means only two of the RS-232 signals can be converted in each direction.

Typically a pair of a driver/receiver of the MAX232 is used for TX and RX and the
second one for CTS and RTS.

There are not enough drivers/receivers in the MAX232 to also connect


the DTR, DSR, and DCD signals. Usually these signals can be omitted when e.g.
communicating with a PC's serial interface. If the DTE really requires these signals
either a second MAX232 is needed, or some other IC from the MAX232 family can
be used (if it can be found in consumer electronic shops at all). An alternative for
DTR/DSR is also given below.

OPERATING CONDITIONS:

ELECTRICAL CHARACTERISTICS:

4.3 RS232 :

The USB to RS232 serial communications interface


provides RS232 serial communication interfaces to

ECE Department, SITAM 37


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

computers with USB support.RS-232 full duplex serial port furnished with a 9 pin D-
type male connector similar to which can be found on back of PC. The port is fully
configured with two data, six control I/O lines and one signal return. Driver provided
for Win98, ME, 2K, XP, Vista, Mac and Linux.

USB to RS232 Converter is an intelligent module which connects to a PC


Universal Serial Bus port providing a high-speed asynchronous RS-232 serial port.
The USB-232 Converter provides easy connectivity between the PC and standard
communication ports, not requiring PC reconfiguration.

The USB to RS232 module is a cost-effective way to convert RS232 interface


to a USB interface. When connected to a PC USB port the USB to RS232 module is
automatically detected and is installed as a native COM port which is compatible with
any existing serial communication application. Multiple modules can be installed
when using USB hubs thus allowing a hassle-free configuration of a multi serial
system without any IRQ or DMA configuration.

4.3.1 Specifications:
Parameter Value
USB Driver Interface Works with existing COM Port PC applications
(Installs Virtual COM port on PC to which existing
software can connect)
Communication speed 75 to 6MBPS baud
Power consumption 50mA @5volt (power provided by the PC’s USB
port.)
Temperature Range 0ºC to 50ºC.
USB Compliant USB Specification 2.0 compliant; full-speed (12
Mbps)
Asynchronous Serial Data All handshaking and modem interface signals
BUS (UART)
Data formats supported: - Data bits: 5, 6, 7, and 8
- Stop bits: 1, 1.5, and 2
Buffer 256 Byte receive buffer; 256 byte transmit buffer

ECE Department, SITAM 38


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Handshaking Hardware or X-On/X-Off handshaking supported


Table

4.3.2 Asynchronous Serial Data Bus (UART) Interface:


The UART interface consists of the TX (transmit) and RX (receive) data
signals as well as the RTS, CTS, DSR, DTR, DCD, and RI control signals. The
UART supports RTS/CTS, DSR/DTR, and X On/X-Off handshaking. The UART is
programmable to support a variety of data formats and baud rates. The data format
and baud rate programmed into the UART is set during COM port configuration on
the PC.

4.4 IR SENSOR:

The cheapest way to remotely control a device within a visible range is via
Infra-Red light. Almost all audio and video equipment can be controlled this way
nowadays. Due to this wide spread use the required components are quite cheap,
thus making it ideal for us to use IR control for our own projects. Infra-Red actually
is normal light with a particular color. We humans can't see this color because its
wave length of 950nm is below the visible spectrum. That's one of the reasons why
IR is chosen for remote control purposes, we want to use it but we're not interested
in seeing it. Another reason is because IR LED’s are quite easy to make, and
therefore can be very cheap. Fig: 4.7 IR SENSORS

Wireless communication, as the term


implies, allows information to be exchanged
between two devices without the use of wire or
cable. In all such cases, information is being
transmitted and received using electromagnetic energy, also referred to as
electromagnetic radiation.

ECE Department, SITAM 39


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

IR Sensor is a distance measuring sensor unit, composed of an integrated


combination of PSD (position sensitive detector) , IRED (infrared emitting diode) and
signal processing circuit. The variety of the reflectivity of the object, the environmental
temperature and the operating duration are not influenced easily to the distance detection
because of adopting the triangulation method. This device outputs the voltage
corresponding to the detection distance. So this sensor can also be used as a proximity
sensor.

4.5 LIQUID CRYSTAL DISPLAY


The alphanumeric 16character X 2line LCD requires 8data lines and also 3
control signals and they are interfaced to 3664.By using 2 ports, port 0&3 data pins
are connected to LCD as data bus. Port0 can be basically used as I/O port i.e. it can be
programmed as an input or as an output port.

That means if it is programmed as output port, suppose if it is required to read


data from LCD immediately it is not possible. Before reading the data it is required to
make the port as an input port. Data reading from LCD gives an erroneous reading &
should not be implemented. Because of this port5 is made as input / output port
depending on the situation. The control signals are connected to port 3 pins. They are
EN bar & RS bar, RW bar. At different instance such as data write / command write /
data read etc. Various signals are to be provided as indicated by the by the LCD
manufacturers.

To interface the LCD, to the Micro controller it require an 8 bit and also three
control signals differentiate the data from the control words send to the LCD. The
Micro controller has to send the necessary control words followed by the data to be
displayed.

Depending on the operation to be performed the control words are selected and
passes to the LCD. The data to be displayed on the LCD is to be sent in the ASCII
format. Thus all the character to be displayed are converted into ASCII form and then
sent to the LCD along with different control words. The control word differentiated
the various operations and are executed. It is also possible to read the LCD data if
required.

ECE Department, SITAM 40


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

The control signals to the LCD are also provided by the Micro controller. This is
also done through pins 3.5,3.6&3.7.Through program necessary control signals are
passed to the LCD by using the bits of the port. The remaining can be used for some
other purpose if there is a need. The software controls the necessary ports and
performs the task it is designed for. The soft ware and associated hardware perform
the LCD interface.

LCD DISPLAY

Gnd vcc preset rs rw en d0 d1 d2 d3 d4 d5 d6 d7 vcc gnd

Fig 4.8 LCD Display PIN Diagram

A liquid crystal is a material (normally organic for LCDs) that will flow like a
liquid but whose molecular structure has some properties normally associated with
solids. The Liquid Crystal Display (LCD) is a low power device. The power
requirement is typically in the order of microwatts for the LCD. However, an LCD
requires an external or internal light source. It is limited to a temperature range of
about 0C to 60C and lifetime is an area of concern, because LCDs can chemically
degrade.

There are two major types of LCD s which are:

1) Dynamic-scattering LCD s

2) Field-effect LCD s

Field-effect LCD s are normally used in such applications where source of energy is a
prime factor (e.g., watches, portable instrumentation etc.).They absorb considerably less
power than the light-scattering type. However, the cost for field-effect units is typically
higher, and their height is limited to 2 inches. On the other hand, light-scattering units are

ECE Department, SITAM 41


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

available up to 8 inches in height. Field-effect LCD is used in the project for displaying the
appropriate information. The turn-on and turn-off time is an important consideration in all
displays. The response time of LCD s is in the range of 100 to 300ms.The lifetime of LCD s
is steadily increasing beyond 10,000+hours limit. Since the colour generated by LCD units is
dependent on the source of illumination, there is a wide range of colour choice.

4.6 LIGHT EMITING DIODES

It is a semiconductor diode having radioactive recombination. It requires a


definite amount of energy to generate an electron-hole pair.

The same energy is released when an electron recombines with a hole. This released
energy may result in the emission of photon and such a recombination. Hear the
amount of energy released when the electro reverts from the conduction band to the
valence band appears in the form of radiation. Alternatively the released energy may
result in a series of phonons causing lattice vibration. Finally the released energy may
be transferred to another electron. The recombination radiation may be lie in the infra-
red and visible light spectrum. In forward is peaked around the band gap energy and
the phenomenon is called injection luminescence. I n a junction biased in the
avalanche break down region , there results a spectrum of photons carrying much
higher energies . Almost White light then gets emitted from micro-plasma breakdown
region in silicon junction. Diodes having radioactive recombination are termed as
Light Emitting Diode , abbreviated as LEDs.

In gallium arsenide diode , recombination is predominantly a radiation


recombination and the probability of this radioactive recombination far exceeds that
in either germanium or silicon . Hence GaAs LED has much higher efficiency in
terms of

Photons emitted per carrier. The internal efficiency of GaAs LED may ba very close
to 100% but because of high index of refraction, only a small fraction of the internal
radiation can usually come out of the device surface. In spite of this low efficiency of
actually radiated light , these LEDs are efficiency used as light emitters in visual
display units and in optically coupled circuits, The efficiency of light generation
ECE Department, SITAM 42
AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

increases with the increase of injected current and with decreases in temperature.
The light so generated is concentrated near the junction since most of the charge
carriers are obtained within one diffusion length of the diode junction.

The following are the merits of LEDs over conventional incandescent


and other types of lamps

1. Low working voltages and currents


2. Less power consumption
3. Very fast action
4. Emission of monochromatic light
5. small size and weight
6. No effect of mechanical vibrations
7. Extremely long life
Typical LED uses a forward voltage of about 2V and current of 5 to
10mA.

GaAs LED produces infra-red light while red, green and orange lights are
produced by gallium arsenide phosphide (GaAs) and gallium phosphide (Gap)
.

4.7 GPS (GLOBAL POSITIONING SYSTEM)

ECE Department, SITAM 43


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

INTRODU
Fig 4.9 GPS Module
CTION:

PRODUCT INTRODUCTION:

The ProGin SR-87 series GPS modules incorporates high sensitivity, high
Performance SiRF Star chipset solution in a compact design. The module tracks Up to
20 satellites at a time while offering fast time-to-first-fix and 1Hz navigation Update.
The unit is very suitable for broad applications such as Handheld, PDA, PPC or other
battery operated navigation system.

4.7.1 MAIN FEATURES:

 High sensitivity SiRF Star chipsets.


 High performance receiver tracks up to 20 satellites.
 TTL output for GPS command interface.
 Low power consumption.
 Average Cold Start time under 42 seconds.
 On-chip 1Mb SRAM.
 Reacquisition time 0.1 second.
 Support accurate 1PPS output signal aligned with GPS timing.
 Support Standard NMEA-0183 and SiRF Binary protocol.
 Multi-path mitigation hardware.
 Built-in a lithium battery enables fast positioning.
 Compact size (25.4×25.4×7 mm3) for easy integration into hand-held devices.

ECE Department, SITAM 44


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

The SR-87 design utilizes the latest surface mount technology and high level circuit
Integration to achieve superior performance while minimizing dimension and power
consumption. This hardware capability combined with software intelligence makes
the board easy to be integrated and used in all kinds of navigation applications or
products. The module communicates with application system via RS232 (TTL level)
with NMEA-0183 protocol.

4.7.2 TECHNICAL SPECIFICATIONS:

ELECTRICAL CHARACTERISTICS:

GENERAL:

Frequency L1, 1575.42 MHz


C/A code 1.023 MHz chip rate
Channels 20 channels all in view tracking

SENSITIVITY:

Tracking -159 dBm typical

ACCURACY (OPEN SKY)

Position < 10 meters, 2D RMS


< 7 meters 2D RMS, WAAS corrected
1-5 meters, DGPS corrected
Time 1 microsecond synchronized to GPS time
DATUM:

Default WGS-84

ACQUISITION RATE:

Hot start 1 sec, average


Warm start 38 sec, average
Cold start 42 sec, average

ECE Department, SITAM 45


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Reacquisition 0.1 sec, average

DYNAMIC CONDITIONS:

Altitude < 18,000 meters (60,000 feet)


Velocity < 515 meters/sec (1000 knots)
Acceleration <4G
Jerk 20 meters/sec max

POWER:

Main power input 3.0 ~ 5.5 VDC input.


Supply Current < 80 mA
Backup Power 3V rechargeable Lithium battery,
Up to 500 hours discharge

RF INTERFACE:

Antenna connector type MMCX

SERIAL PORT:

Electrical interface two full duplex serial communication, via RS232,


TTL interface.

Protocol message NMEA-0183.

Default NMEA GGA, GSA, GSV, RMC, (GLL, VTG, and ZDA
Optional).
4800 baud rate (other rate optional).
8 bits data, 1 stop bit, no parity.

TIME:

1PPS Pulse, Pulse duration 100 msec .


Time reference at the pulse positive edge .
Synchronized to GPS time, ±1 microsecond .
WEIGHT: < 8g

ECE Department, SITAM 46


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

RECOMMENDED EXTERNAL ANTENNA SPECIFICATION:

Gain 20 dB min (cable loss included)


Noise figure 1.5 dB typical
Current 10 mA typical
Operating Voltage Confirmed to spec 3.3 ~ 5.5 V
Survival 3.0 ~ 3.3 V

ENVIRONMENTAL CHARACTERISTICS:

Operating temperature range -40 oC to +85 oC


Storage temperature range -45 oC to +100 Oc

PIN ASSIGNMENT:

4.7.3 APPLICATIONS:

Applications are as follows:


 Car Navigation
 Wrist Watch
 Solar Operated Device
 Marine Navigation
 Fleet Management
 AVL and Location-Based Services
 Radar detector with GPS function
 Hand-Held Device for Personal Positioning and Navigation
Ideal for PDA, Pocket PC and Other Computing Devices at GPS Application

ECE Department, SITAM 47


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

4.8 GSM (GLOBAL SERVICE FOR MOBILE


COMMUNICATION)

Fig 4.10 GSM Module

INTRODUCTION TO GSM:

GSM was first introduced in 1991. As of the end of 1997, GSM service was
available in more than 100 countries and has become the de facto standard in Europe
and Asia.

Global System for Mobile communications is the most popular standard for
mobile phones in the world. Its promoter, the GSM Association, estimates that 82% of
the global mobile market uses the standard. GSM is used by over 3 billion people
across more than 212 countries and territories. Its ubiquity makes international
roaming very common between mobile phone modulators, enabling subscribers to use
their phones in many parts of the world. GSM differs from its predecessors in that
both signaling and speech channels, and thus is considered a second generation (2g)
mobile phone system. This has also meant that data communication was easy to build
into the system.

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services. GSM differs from
first generation wireless systems in that it uses digital technology and time division

ECE Department, SITAM 48


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

multiple access transmission methods. GSM is a circuit-switched system that divides


each 200 kHz channel into eight 25 kHz time-slots. GSM supports data transfer
speeds of up to 9.6 kbps, allowing the transmission of basic data services such as
SMS (Short Message Service).

Another major benefit is its international roaming capability, allowing users to


access the same services when traveling abroad as at home. GSM satellite roaming
has also extended service access to areas where terrestrial coverage is not available
There are five different cell sizes in a GSM network they are macro, micro, Pico,
femto and umbrella cells. The coverage area of each cell varies according to the
implementation environment. Macro cells can be regarded as cells where the base
station antenna is installed on a mast or a building above average roof top level. Micro
cells are cells whose antenna height is under average roof top level; they are typically
used in urban areas. Pico cells are small cells whose coverage diameter is a few dozen
meters; they are mainly used indoors. Femto cells are cells designed for use in
residential or small business environments and connect to the service provider’s
network via a broadband internet connection. Umbrella cells are used to cover
shadowed regions of smaller cells and fill in gaps in coverage between those cells.

Before looking at the GSM specifications, it is important to understand the following


basic terms:

 bandwidth—the range of a channel's limits; the broader the bandwidth, the


faster data can be sent .

 bits per second (bps)—a single on-off pulse of data; eight bits are equivalent
to one byte

 frequency—the number of cycles per unit of time; frequency is measured in

hertz (Hz)

 kilo (k)—kilo is the designation for 1,000; the abbreviation kbps represents
1,000 bits per second

 megahertz (MHz)—1,000,000 hertz (cycles per second)

 milliseconds (ms)—one-thousandth of a second

ECE Department, SITAM 49


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

 watt (W)—a measure of power of a transmitter

Specifications for different personal communication services (PCS)


systems vary among the different PCS networks. Listed below is a description of the
specifications and characteristics for GSM.

 Frequency band—the frequency range specified for GSM is 1,850 to 1,990


MHz (mobile station to base station).

 Duplex distance—the duplex distance is 80 MHz. Duplex distance is the


distance between the uplink and downlink frequencies. A channel has two
frequencies, 80 MHz apart.

 Channel separation—the separation between adjacent carrier frequencies. In


GSM, this is 200 kHz.

 Modulation—Modulation is the process of sending a signal by changing the


characteristics of a carrier frequency. This is done in GSM via Gaussian
minimum shift keying (GMSK).

 Transmission rate—GSM is a digital system with an over-the-air bit rate of


270 kbps.

 Access method—GSM utilizes the time division multiple access (TDMA)


concept. TDMA is a technique in which several different calls may share the
same carrier. Each call is assigned a particular time slot.

 Speech coder—GSM uses linear predictive coding (LPC). The purpose of


LPC is to reduce the bit rate. The LPC provides parameters for a filter that
mimics the vocal tract. The signal passes through this filter, leaving behind a
residual signal. Speech is encoded at 13 kbps.

GSM GPRS Yagi Omni Panel Antenna 2 dBi 3, 5, 10 dBi antenna China Korea
Taiwan Singapore India RFID Tags gprs antenna gsm antenna booster gsm car
antenna GSM gps antenna gsm external antenna gsm antenna gsm enhanced data
rates for enhanced data for gsm enhanced data rate for 900 1800 gsm 900 1800 1900
Gsm900 dual band triple band 1800 MHz dual band gsm1900 gsm1800 antenna tri
band 1900 MHz iden800 dcs1800 tri band pcs1900 gprs gsm850 1900 egsm900 uhf
antennas 1800 900 MHz units wave COM vhf tc35 MHz gsm800 gsm+ frequency

ECE Department, SITAM 50


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

band single band 900 Quad band 900 MHz dcs. A wide variety of Antennas are
available for various models of mobile Phones and different wireless applications.
Please find a brief description of the Different antennas and their applications.

4.8.1 GSM MODULE:


Global System for Mobile communications is the most popular
standard for mobile phones in the world. Its promoter, the GSM Association,
estimates that 82% of the global mobile market uses the standard. GSM is used by
over 3 billion people across more than 212 countries and territories. Its ubiquity
makes international roaming very common between mobile phone operators, enabling
subscribers to use their phones in many parts of the world. GSM differs from its
predecessors in that both signaling and speech channels are digital, and thus is
considered a second generation (2G) mobile phone system. This has also meant that
data communication was easy to build into the system.

GSM (Global System for Mobile communications) is an open, digital


cellular technology used for transmitting mobile voice and data services.

GSM differs from first generation wireless systems in that it uses digital
technology and time division multiple access transmission methods. GSM is a circuit-
switched system that divides each 200 kHz channel into eight 25 kHz time-slots. GSM
supports data transfer speeds of up to 9.6 kbps, allowing the transmission of basic data
services such as SMS (Short Message Service). Another major benefit is its
international roaming capability, allowing users to access the same services when
traveling abroad as at home. GSM satellite roaming has also extended service access to
areas where terrestrial coverage is not available

There are five different cell sizes in a GSM network they are macro,
micro, Pico, femto and umbrella cells. The coverage area of each cell varies according
to the implementation environment. Macro cells can be regarded as cells where the base
station antenna is installed on a mast or a building above average roof top level. Micro
cells are cells whose antenna height is under average roof top level; they are typically
used in urban areas. Pico cells are small cells whose coverage diameter is a few dozen
meters; they are mainly used indoors. Femto cells are cells designed for use in
residential or small business environments and connect to the service provider’s

ECE Department, SITAM 51


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

network via a broadband internet connection. Umbrella cells are used to cover
shadowed regions of smaller cells and fill in gaps in coverage between those cells.

AT COMMANDS ACCORDING TO GSM:

The GSM 07.05 commands are for performing SMS and CBS related
operations.SIM300II supports both text and PDU modes.

4.8.2OVERVIEW OF AT COMMANDS ACCORDING TO GSM:

ECE Department, SITAM 52


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

4.9 CRYSTAL OSCILLATOR

A crystal oscillator is an electronic oscillator circuit that uses the mechanical


resonance of a vibrating crystal of piezoelectric material to create an electrical signal
with a very precise frequency. This frequency is commonly used to keep track of time
(as in quartz wristwatches), to provide a stable clock signal for digital integrated
circuits, and to stabilize frequencies for radio transmitters and receivers. The most
common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits
designed around them became known as "crystal oscillators."

Quartz crystals are manufactured for frequencies from a few tens of kilohertz
to tens of megahertz. More than two billion (2×10 9) crystals are manufactured
annually. Most are used for consumer devices such as wristwatches, clocks, radios,
computers, and cell phones. Quartz crystals are also found inside test and
measurement equipment, such as counters, signal generators, and oscilloscopes.

Piezoelectricity was discovered by Jacques and Pierre Curie in 1880. Paul


Langevin first investigated quartz resonators for use in sonar during World War I. The
first crystal-controlled oscillator, using a crystal of Rochelle salt, was built in 1917
and in 1918 by Alexander M. Nicholson at Bell Telephone Laboratories, although his
priority was disputed by Walter Guyton Cady. Cady built the first quartz crystal
oscillator in 1921. Other early innovators in quartz crystal oscillators include G. W.
Pierce and Louis Essen.

Quartz crystal oscillators were developed for high-stability frequency


references during the 1920s and 1930s. By 1926 quartz crystals were used to control
the frequency of radio broadcasting stations and were popular with amateur radio
operators. In 1928, Warren Marrison (of Bell Telephone Laboratories) developed the
first quartz crystal clock. This invention replaced the escapement and pendulum (as
the timing reference), relying instead on the natural vibrations occurring in the quartz
crystal as the oscillator. This improved timing accuracies to 1 sec in 30 years (or
30 ms/year). A number of firms started producing quartz crystals for electronic use
during this time. Using what are now considered primitive methods, about 100,000
crystal units were produced in the United States during 1939. During World War II,
the demand for accurate frequency control of military and naval radios and radars

ECE Department, SITAM 53


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

spurred rapid development of the quartz crystal manufacturing industry. Suitable


types of quartz became a critical war material, and much of it was eventually supplied
by Brazil.

In 1968, Juergen Staudte invented a process for manufacturing quartz crystal


oscillators while working at North American Aviation (now Rockwell). Staudte
patented his invention, which used a photolithographic process that is similar to the
way integrated circuits are made. In 1970 he left North American Aviation to start his
own company, Statek, in Orange, California. Statek began manufacturing and
marketing the quartz oscillators in 1971. Although crystal oscillators still most
commonly use quartz crystals, devices using other materials are becoming more
common, such as ceramic resonators.

4.9.1 Quartz Crystal

The equivalent circuit for the quartz crystal


shows an RLC series circuit, which
represents the mechanical vibrations of the
crystal, in parallel with a capacitance, Cp
which represents the electrical connections to
the crystal. Quartz crystal oscillators operate at
"parallel resonance", and the equivalent
impedance of the crystal has a series
resonance where Cs resonates with
inductance, L and a parallel resonance where L
resonates with the series combination of Cs
and Cp as shown.
Fig 4.11 Quartz Crystal Circuit

ECE Department, SITAM 54


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Crystal Reactance

Fig 4.12 Crystal Reactance of Quartz Crystal

The slope of the reactance against frequency above, shows that the series
reactance at frequency ƒs is inversely proportional to Cs because below ƒs and
above ƒp the crystal appears capacitive, i.e. dX/dƒ, where X is the reactance.
Between frequencies ƒs and ƒp, the crystal appears inductive as the two
parallel capacitances cancel out. The point where the reactance values of the
capacitances and inductance cancel each other out Xc = XL is the fundamental
frequency of the crystal.

A quartz crystal has a resonant frequency similar to that of a electrically tuned


tank circuit but with a much higher Q factor due to its low resistance, with typical
frequencies ranging from 4kHz to 10MHz. The cut of the crystal also determines how
it will behave as some crystals will vibrate at more than one frequency. Also, if the
crystal is not of a parallel or uniform thickness it have two or more resonant
frequencies having both a fundamental frequency and harmonics such as second or
third harmonics. However, usually the fundamental frequency is more stronger or
pronounced than the others and this is the one used. The equivalent circuit above has
three reactive components and there are two resonant frequencies, the lowest is a
series type frequency and the highest a parallel type resonant frequency.

ECE Department, SITAM 55


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

We have seen in the previous tutorials, that an amplifier circuit will oscillate if
it has a loop gain greater or equal to one and the feedback is positive. In a Quartz
Crystal Oscillator circuit the oscillator will oscillate at the crystals fundamental
parallel resonant frequency as the crystal always wants to oscillate when a voltage
source is applied to it. However, it is also possible to "tune" a crystal oscillator to any
even harmonic of the fundamental frequency, (2nd, 4th, 8th etc.) and these are known
generally as Harmonic Oscillators while Overtone Oscillators vibrate at odd
multiples of the fundamental frequency, 3rd, 5th, 11th etc). Generally, crystal
oscillators that operate at overtone frequencies do so using their series resonant
frequency.

ECE Department, SITAM 56


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CHAPTER 5
Software
5.1 *Keil software for c programming

What's New in µVision3

µVision3 adds many new features to the Editor like Text Templates ,Quick Function
Navigation, Syntax Coloring with brace high lighting Configuration Wizard for
dialog based startup and debugger setup. µVision3 is fully compatible to µVision2
and can be used in parallel with µVision2.

What is µVision3?

µVision3 is an IDE (Integrated Development Environment) that helps you write,


compile, and debug embedded programs. It encapsulates the following components:

 A project manager.
 A make facility.
 Tool configuration.
 Editor.
 A powerful debugger.
To help you get started, several example programs (located in the \C51\Examples, \
C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.

 HELLO is a simple program that prints the string "Hello World" using the
Serial Interface.
 MEASURE is a data acquisition system for analog and digital systems.
 TRAFFIC is a traffic light controller with the RTX Tiny operating system.
 SIEVE is the SIEVE Benchmark.
 DHRY is the Dhrystone Benchmark.
 WHETS is the Single-Precision Whetstone Benchmark.
Additional example programs not listed here are provided for each device
architecture.

ECE Department, SITAM 57


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Building an Application in µVision2

To build (compile, assemble, and link) an application in µVision2, you must:

1. SelectProject-(forexample,166\EXAMPLES\HELLO\HELLO.UV2).
2. Select Project - Rebuild all target files or Build target.
µVision2 compiles, assembles, and links the files in your project.

Creating Your Own Application in µVision2

To create a new project in µVision2, you must:

1. Select Project - New Project.


2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device
from the Device Database™.
4. Create source files to add to the project.
5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and
add the source files to the project.
6. Select Project - Options and set the tool options. Note when you select the
target device from the Device Database™ all special options are set
automatically. You typically only need to configure the memory map of your
target hardware. Default memory model settings are optimal for most
applications.
7. Select Project - Rebuild all target files or Build target.

Debugging an Application in µVision2

To debug an application created using µVision2, you must:

1. Select Debug - Start/Stop Debug Session.


2. Use the Step toolbar buttons to single-step through your program. You may
enter G, main in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.

ECE Department, SITAM 58


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

Starting µVision2 and Creating a Project

µVision2 is a standard Windows application and started by clicking on the program


icon. To create a new project file select from the µVision2 menu

Project – New Project…. This opens a standard Windows dialog that asks you

for the new project file name.

We suggest that you use a separate folder for each project. You can simply use

the icon Create New Folder in this dialog to get a new empty folder. Then

select this folder and enter the file name for the new project, i.e. Project1.

µVision2 creates a new project file with the name PROJECT1.UV2 which contains

a default target and file group name. You can see these names in the Project

Window – Files.

Now use from the menu Project – Select Device for Target and select a CPU

for your project. The Select Device dialog box shows the µVision2 device

database. Just select the microcontroller you use. We are using for our examples the
Philips 80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+
device and simplifies in this way the tool Configuration

Building Projects and Creating a HEX Files

Typical, the tool settings under Options – Target are all you need to start a
new application. You may translate all source files and line the application with a
click on the Build Target toolbar icon. When you build an application with syntax
errors, µVision2 will display errors and warning messages in the Output Window –
Build page. A double click on a message line opens the source file on the correct
location in a µVision2 editor window.

Once you have successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX
file to download the software into an EPROM programmer or simulator. µVision2

ECE Department, SITAM 59


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

creates HEX files with each build process when Create HEX file under Options for
Target – Output is enabled. You may start your PROM programming utility after the
make process when you specify the program under the option Run User Program #1.

CPU Simulation

µVision2 simulates up to 16 Mbytes of memory from which areas can be

Mapped for read, write, or code execution access. The µVision2 simulator traps

And reports illegal memory accesses.

In addition to memory mapping, the simulator also provides support for the

Integrated peripherals of the various 8051 derivatives. The on-chip peripherals

of the CPU you have selected are configured from the Device

Database selection

you have made when you create your project target. Refer to page 58 for more

Information about selecting a device . You may select and display the on-chip
peripheral components using the Debug menu. You can also change the aspects of
each peripheral using the controls in the dialog boxes.

Start Debugging

You start the debug mode of µVision2 with the Debug – Start/Stop Debug

Session command. Depending on the Options for Target – Debug

configuration, µVision2 will load the application program and run the startup

code µVision2 saves the editor screen layout and restores the screen layout of the last
debug session. If the program execution stops, µVision2 opens an

editor window with the source text or shows CPU instructions in the disassembly
window. The next executable statement is marked with a yellow arrow .During
debugging, most editor features are still available.

ECE Department, SITAM 60


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

For example, you can use the find command or correct program errors. Program
source text of your application is shown in the same windows. The µVision2 debug
mode differs from the edit mode in the following aspects:

_ The “Debug Menu and Debug Commands” described on page 28 are

available. The additional debug windows are discussed in the following.

_ The project structure or tool parameters cannot be modified. All build

commands are disabled.

Disassembly Window

The Disassembly window shows your target program as mixed source and assembly
program or just assembly code. A trace history of previously executed instructions
may be displayed with Debug – View Trace Records. To enable the trace history, set
Debug – Enable/Disable Trace Recording.

If you select the Disassembly Window as the active window all program step
commands work on CPU instruction level rather than program source lines. You can
select a text line and set or modify code breakpoints using toolbar buttons or the
context menu commands.

You may use the dialog Debug – Inline Assembly… to modify the CPU instructions.
That allows you to correct mistakes or to make temporary changes to the target
program you are debugging.

5.2 SOURCE CODE

1. Click on the Keil uVision Icon on DeskTop

2. The following fig will appear

ECE Department, SITAM 61


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

3. Click on the Project menu from the title bar

4. Then Click on New Project

5. Save the Project by typing suitable project name with no extension in u r


own folder sited in either C:\ or D:\

ECE Department, SITAM 62


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

6. Then Click on Save button above.

7. Select the component for u r project. i.e. Atmel……

8. Click on the + Symbol beside of Atmel

ECE Department, SITAM 63


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

9. Select AT89C51 as shown below

10. Then Click on “OK”

11. The Following fig will appear

12. Then Click either YES or NO………mostly “NO”

ECE Department, SITAM 64


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

13. Now your project is ready to USE

14. Now double click on the Target1, you would get another option “Source
group 1” as shown in next page.

15. Click on the file option from menu bar and select “new”

ECE Department, SITAM 65


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

16. The next screen will be as shown in next page, and just maximize it by
double clicking on its blue boarder.

17. Now start writing program in either in “C” or “ASM”

18. For a program written in Assembly, then save it with extension “. asm”
and for “C” based program save it with extension “ .C”

ECE Department, SITAM 66


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

19. Now right click on Source group 1 and click on “Add files to Group
Source”

20. Now you will get another window, on which by default “C” files will
appear.

ECE Department, SITAM 67


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

24. If the file contains no error, then press Control+F5 simultaneously.

25. The new window is as follows

ECE Department, SITAM 68


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

26. Then Click “OK”

27. Now Click on the Peripherals from menu bar, and check your required port
as shown in fig below

28. Drag the port a side and click in the program file.

ECE Department, SITAM 69


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

29. Now keep Pressing function key “F11” slowly and observe.

30. You are running your program successfully

ECE Department, SITAM 70


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

PROGRAM

SOURCE CODE

#include<reg51.h>
#include"lcddisplay.h"
#include"UART.h"
#include<string.h>

sbit buzzer = P2^7;

sbit gsm = P3^3;


sbit gps = P3^2;

sbit toll1 = P2^0;


sbit toll2 = P2^1;
sbit toll3 = P2^2;
sbit toll4 = P2^3;

unsigned char mobilenum[11],mobilenum1[11];


unsigned char msg[10],balance=200;
unsigned char XX,newmsg=0,a;

void readmsg(void);

void convert1(unsigned char temp1_value)


{
unsigned char value,d1,d2,d3,temprature[4] ;
value=temp1_value/10;
d3=temp1_value%10;
temprature[2]=(d3+48);
d1=value/10;
temprature[0]=(d1+48);
d2=value%10;
temprature[1]=(d2+48);

SBUF=temprature[0];
while(TI==0);
TI=0;

SBUF=temprature[1];

ECE Department, SITAM 71


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

while(TI==0);
TI=0;

SBUF=temprature[2];
while(TI==0);
TI=0;

void serintr(void) interrupt 4


{
if(RI==1)
{
XX=SBUF;
if(XX=='+')
newmsg=1;
RI=0;
}
}

void another_acc(void)
{
another:
lcdcmd(0x01);
msgdisplay("Insufficient Bal");
lcdcmd(0xc0);
msgdisplay("Try another acc");
delay(50);
gsm=0;
gps=1;
delay(50);
ES=1;
newmsg=0;
while(newmsg==0);
ES=0;
readmsg();
lcdcmd(0x01);
msgdisplay(msg);
delay(500);
ES=1;

if(!strcmp(msg,"ACC 1234"))
{

ECE Department, SITAM 72


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

lcdcmd(0x01);
msgdisplay("Amount dedected");
lcdcmd(0xc0);
msgdisplay("from another acc");
delay(1000);
}

else
{
lcdcmd(0x01);
msgdisplay("Invalid account");
lcdcmd(0xc0);
msgdisplay(" Try again.. ");
goto another;
}
}

void main()
{
unsigned char i,gpsdata[45],msgtype=0;
lcd_init();
UART_init();
lcdcmd(0x85);

gps=1;
gsm=0;
RI=0;
lcdcmd(0x01);
msgdisplay("searching for");
lcdcmd(0xc0);
msgdisplay("GSM modem");

delay(300);
send_to_modem("ate0"); //to avoid echo signals,
enter();

again:
send_to_modem("at"); // TO CHECKING GSM MODEM...
enter();
if(!RI) // Here we are waiting for data whitch is sending by GSM modem
goto again;
RI=0;

ECE Department, SITAM 73


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

EA=1;
ES=1;
delay(100);
send_to_modem("at+creg=0"); //
enter();
delay(300);
newmsg=0;

xxx:
lcdcmd(0x01);
msgdisplay("CHECKING GSM");
send_to_modem("AT+CPIN?"); //
enter();
delay(500);
if(newmsg==0)
goto xxx;

lcdcmd(0xC0);
msgdisplay("GSM CONNECTED");
delay(500);

send_to_modem("at+cmgf=1"); //
enter();

send_to_modem("at+cmgd=1"); //
enter();
send_to_modem("at+cmgd=2"); //
enter();

lcdcmd(0x01);
msgdisplay("store number:");
delay(200);
newmsg=0;
while(newmsg==0);
ES=0;
readmsg();
lcdcmd(0xc0);
msgdisplay(mobilenum);
delay(300);
strcpy(mobilenum1,mobilenum);
delay(700);

lcdcmd(0x01);

ECE Department, SITAM 74


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

msgdisplay("GSM & GPS BASED");


lcdcmd(0xc0);
msgdisplay("TOLL COLLECTION");
delay(500);

send_to_modem("at+cmgd=1"); //delete the message1


enter();
lcdcmd(1);

st1:
ES=1;
delay(100);
newmsg=0;
ES=0;
gps=0;
gsm=1;
RI=0;
delay(50);

while(1)
{
RI=0;
a=0;
while(a!='$')
{
while(RI==0);

a=SBUF;
RI=0;
}

i=0;
while(RI==0);
i=i+1;
RI=0;
while(RI==0);
RI=0;
i=i+1;
while(RI==0);

if(SBUF=='R')
{
RI=0;

ECE Department, SITAM 75


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

while(RI==0);
i=i+1;
if(SBUF=='M')
{
RI=0;
while(RI==0);
i=i+1;
if(SBUF=='C')
{
RI=0;
while(RI==0);
i=i+1;
while(i<43)
{
while(RI==0);

gpsdata[i]=SBUF;
RI=0;
i++;
}

lcdcmd(0x01);
msgdisplay("LT ");
for(i=19;i<30;i++)
{
lcddata(gpsdata[i]);

lcdcmd(0xc0);
msgdisplay("LG ");

for(i=31;i<43;i++)
{
lcddata(gpsdata[i]);

delay(50);

if(toll1==1)
{
if(balance<10)

ECE Department, SITAM 76


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

another_acc();

else
balance=balance-10;

lcdcmd(0x01);
msgdisplay("Toll_1 tax paid");
lcdcmd(0xc0);
msgdisplay("Paid Rs. 10/-");
msgtype=1;
goto sendmsg;
}

if(toll2==1)
{
if(balance<20)
another_acc();

else
balance=balance-20;

lcdcmd(0x01);
msgdisplay("Toll_2 tax paid");
lcdcmd(0xc0);
msgdisplay("Paid Rs. 20/-");
msgtype=2;
goto sendmsg;
}

if(toll3==1)
{
if(balance<30)
another_acc();

else
balance=balance-30;

lcdcmd(0x01);
msgdisplay("Toll_3 tax paid");
lcdcmd(0xc0);
msgdisplay("Paid Rs. 30/-");
msgtype=3;
goto sendmsg;

ECE Department, SITAM 77


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

if(toll4==1)
{
if(balance<40)
another_acc();

else
balance=balance-40;

lcdcmd(0x01);
msgdisplay("Toll_4 tax paid");
lcdcmd(0xc0);
msgdisplay("Paid Rs. 40/-");
msgtype=4;
goto sendmsg;
}

lcdcmd(0x01);
}
}
}
}

sendmsg:

delay(500);
gsm=0;
gps=1;
delay(50);
buzzer=0;

lcdcmd(0x01);
msgdisplay("sending message");
send_to_modem("at+cmgs=");
ch_send_to_modem('"');
send_to_modem(mobilenum1);
ch_send_to_modem('"');
enter();
delay(100);

ECE Department, SITAM 78


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

if(msgtype==1)
{
send_to_modem("Toll Gate 1 tax paid Rs. 10/- at ");
}

if(msgtype==2)
{
send_to_modem("Toll Gate 2 tax paid Rs. 20/- at ");
}

if(msgtype==3)
{
send_to_modem("Toll Gate 3 tax paid Rs. 30/- at ");
}

if(msgtype==4)
{
send_to_modem("Toll Gate 4 tax paid Rs. 40/- at ");
}

send_to_modem("LT:");
for(i=19;i<30;i++)
ch_send_to_modem(gpsdata[i]);
send_to_modem(" LG:");
for(i=31;i<43;i++)
ch_send_to_modem(gpsdata[i]);

send_to_modem(" Your remaining balance is : ");


convert1(balance);
delay(100);

ch_send_to_modem(0x1a);
ES=1;
delay(3000);
lcdcmd(0x01);
msgdisplay("MESSAGE SENT");
buzzer=1;

delay(2500);
lcdcmd(0x01);

ECE Department, SITAM 79


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

goto st1;

void readmsg(void)
{
unsigned char ss=1,a,b,i,count,numcnt;

delay(100);
ES=1;
delay(200);
ES=0;

while(RI==1)
{
RI=0;
delay(100);
}
send_to_modem("at+cmgr=1");
enter();

count=0;
i=0;
a=0;
numcnt=0;

while(count!=3)
{
while(RI==0);
b=SBUF;

if((b=='O')&&(ss==1))
{
ss=0;
strcpy(msg,"NO MESSAGE !!");

goto down;
}

ECE Department, SITAM 80


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

if((b==',')||(a==1))
{
ss=0;
if(numcnt<15)
{
if(numcnt>4)
{
mobilenum[numcnt-5]=b;

}
a=1;
numcnt++;
}
else
a=0;
}
if(count==2)
{
msg[i++]=SBUF;
}

RI=0;
if(b==10)
count+=1;
}

msg[--i]='\0';
msg[--i]='\0';
mobilenum[10]='\0';
down:
send_to_modem("at+cmgd=1");
enter();
delay(500);
send_to_modem("at+cmgd=2"); //delete the message1
enter();
ss=1;

ECE Department, SITAM 81


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

CONCLUSION
Finally, we would co include by saying that, this project “AUTONOMOUS
ELECTRONIC TOLL GATE USIG GSM AND GPS” is an automatic process which
is unmanned,

This systems is based on a combination of mobile communications technology


(GSM) and the satellite-based global positioning system (GPS). An innovative
element of the automatic log-on system is the On-Board Unit (OBU), which
automatically calculates the amount of charge due and takes into account the
emissions class (ecological aspect) and the number of vehicle axles in calculating this
charge.

The first GPS based system advantage is absence of the need for new road
infrastructure (gantries), operators can keep using the existing infrastructure. System
works without toll booths, extra lanes, speed restrictions or complex structures along
toll roads. The second is much greater flexibility in defining or changing payment by
simply redefining the "virtual" toll areas. It means ability to adapt easily and quickly
to changes in charge parameters (road classes, vehicle types, emission levels, times
slots etc). The third is the systems ability to support other value-added services on the
same technology platform. These services might include fleet and vehicle engine
management systems, emergency response services, payas- you-drive insurance
services and navigation capabilities. These systems were implemented in the
Germany and Hong Kong and will be implemented in UK, India, USA, China, and
Australia. With regard to future expansion and development, this satellite-based toll
collection system will be a better solution, especially with regard to flexibility when it
comes to extending toll collection to every road category, every category of vehicle
and, what's more, in terms of cost efficiency in implementation and operation.

ECE Department, SITAM 82


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

FUTURE SCOPE

A new class of electronic toll collection mechanism will arise which will be an
extension to the present GPS AND GSM based electronic toll collection in which
additional features like, automatic engine engage and shut down mechanism’s, will be
implemented in which any vehicle which violates or is unauthorised under the
aspects of rules and regulations of the concerned authority can be controlled remotely

And also this mechanism can be implemented in extreme cases like , if


the vehicle has been prone to theft, then using the gps system ,the owner of the
vehicle can find the location of his vehicle and can remotely control engine start or
stop.

ECE Department, SITAM 83


AUTONOMOUS ELECTRONIC TOLL GATE USING GPS AND GSM

REFERENCE

[1] Directive 2004/52/EC of the European Parliament


and of the Council of 29 April 2004 on the interoperability
of electronic road toll systems in the Community.
OJ of the EU, L 166/132, 30.04.2004.
[2] SPRINGER J. RCI Steering Committee vice chair
TOLL COLLECT, Final report, Road Charging Interoperability.
RCI project consortium, the European
Commission DG TREN, November 2008.
[3] Proposition of Commission Decision [version 13]
on the definition of the European Electronic Toll Service
and its technical elements. Commission of the
European Communities (SEC 2009).
[4] The Act from 7 of November 2008 on changing act of
public roads and some other acts. Offi cial Journal of
Polish Republic 2008, No 218, position 1391.
[5] http://www.fela.ch/
[6] Nationwide automatic system for toll collection, Berlin
6 October 2008

ECE Department, SITAM 84

You might also like