Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

1.abstract: Unmanned Automated Railway Gate Controller

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 70

Unmanned Automated Railway Gate Controller

1.ABSTRACT
OBJECTIVE: The aim of this project is to Automate unmanned railway gate using
microcontroller.
PROJECT DEFINATION:
The objective of this project is to manage the control system of railway gate using
the microcontroller. When train arrives at the sensing point alarm is triggered at the
railway crossing point so that the people get intimation that gate is going to be closed.
Then the control system activates and closes the gate on either side of the track. once the
train crosses the other end control system automatically lifts the gate. For mechanical
operation of the gates stepper motors are employed. Here we are using embedded
controller built around the 8051 family (AT89C52) for the control according to the data
pattern produced at the input port of the micro controller, the appropriate selected action
will be taken.. The logic is produced by the program written in Embedded C language.
The software program is written, by using the KEIL micro vision environment. The
program written is then converted in HEX code after simulation and burned on to
microcontroller using FLASH micro vision.
WORKING METHODOLOGY:
Present project is designed using 8051 microcontroller to avoid railway accidents
happening at unattended railway gates, if implemented in spirit. This project utilizes two
powerful IR transmitters and two receivers; one pair of transmitter and receiver is fixed at
up side (from where the train comes) at a level higher than a human being in exact
alignment and similarly the other pair is fixed at down side of the train direction. Sensor
activation time is so adjusted by calculating the time taken at a certain speed to cross at
least one compartment of standard minimum size of the Indian railway. We have
considered 5 seconds for this project. Sensors are fixed at 1km on both sides of the gate.
We call the sensor along the train direction as foreside sensor and the other as after side
sensor. When foreside receiver gets activated, the gate motor is turned on in one
direction and the gate is closed and stays closed until the train crosses the gate and
reaches afterside sensors. When afterside receiver gets activated motor turns in opposite
direction and gate opens and motor stops. Buzzer will immediately sound at the fore side
receiver activation and gate will close after 5 seconds, so giving time to drivers to clear
gate area in order to avoid trapping between the gates and stop sound after the train has
crossed.

Unmanned Automated Railway Gate Controller

GATE CONTROL
Railways being the cheapest mode of transportation are preferred over all the other
means .When we go through the daily newspapers we come across many railway
accidents occurring at unmanned railway crossings. This is mainly due to the carelessness
in manual operations or lack of workers. We, in this project has come up with a solution
for the same. Using simple electronic components we have tried to automate the control
of railway gates. As a train approaches the railway crossing from either side, the sensors
placed at a certain distance from the gate detects the approaching train and accordingly
controls the operation of the gate. Also an indicator light has been provided to alert the
motorists about the approaching train.

Unmanned Automated Railway Gate Controller

2.INTRODUCTION
Introduction:
The objective of this project is to manage the control system of railway gate using
the microcontroller. When train arrives at the sensing point alarm is triggered at the
railway crossing point so that the people get intimation that gate is going to be closed.
Then the control system activates and closes the gate on either side of the track. once the
train crosses the other end control system automatically lifts the gate. For mechanical
operation of the gates 1.8 step angle stepper motors are employed. Here we are using
embedded controller built around the 8051 family (AT89C52) for the control according to
the data pattern produced at the input port of the micro controller, the appropriate selected
action will be taken.. The logic is produced by the program written in Embedded C
language. The software program is written, by using the KEIL micro vision environment.
The program written is then converted in HEX code after simulation and burned on to
microcontroller using FLASH micro vision.

AT89C51 Microcontroller
The Micro controller (AT89C51) is a low power; high performance CMOS 8-bit
micro controller with 4K bytes of Flash programmable and erasable read only memory
(PEROM). The on-chip Flash allows the program memory to be reprogrammed in-system
or by a conventional non-volatile memory programmer. By combining a versatile 8-bit
CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer,
which provides a highly flexible and cost-effective solution to many embedded control
applications. By using this controller the data inputs from the smart card is passed to the
parallel port of the pc and accordingly the software responds. The IDE for writing the
embedded program used is KEI L software.

Keil Micro vision Integrated Development Environment.


Keil Software development tools for the 8051 micro controller family support
every level of developer from the professional applications engineer to the student just
learning about embedded software development.The industry-standard Keil C Compilers,
Macro Assemblers, Debuggers, Real-time Kernels, and Single-board Computers support
ALL 8051-compatible derivatives and help you get your projects completed on schedule.
The source code is written in assembly language .It is saved as ASM file with an
extension. A51.the ASM file is converted into hex file using keil software. Hex file is
dumped into micro controller using LABTOOL software. At once the file is dumped and
the ROM is burnt then it becomes an embedded one.

Unmanned Automated Railway Gate Controller


Step Motor Advantages
Step motors convert electrical energy into precise mechanical motion. These
motors rotate a specific incremental distance per each step. The number of steps executed
controls the degree of rotation of the motors shaft. This characteristic makes step motors
excellent for positioning applications. For example, a 1.8 step motor executing 100 steps
will rotate exactly 180 with some small amount of non-cumulative error. The speed of
step execution controls the rate of motor rotation. A 1.8 step motor executing steps at a
speed of 200 steps per second will rotate at exactly 1 revolution per second.
Step motors can be very accurately controlled in terms of how far and how fast they will
rotate. The number of steps the motor executes is equal to the number of pulse commands
it is given. A step motor will rotate a distance and at a rate that is proportional to the
number and frequency of its pulse commands.
Step motors have several advantages over other types of motors. One of the most
impressive is their ability to position very accurately. NMBs standard step motors have
an accuracy of +/-5%. The error does not accumulate from step to step. This means that a
standard step motor can take a single step and travel 1.8 +/-0.09. Then it can take one
million steps and travel 1,800,000 +/-0.09. This characteristic gives a step motor almost
perfect repeatability. In motor terms, repeatability is the ability to return to a previously
held position. A step motor can achieve the same target position, revolution after
revolution.

Unmanned Automated Railway Gate Controller

3.CIRCUIT DIAGRAM

4.COMPONENTS
The project consists of three main parts:

8051 microcontroller
IR Transmitter
IR Receiver
Stepper Motor Circuit
8051 CONTROLLER

The I/O ports of the 8051 are expanded by connecting it to an 8255 chip. The 8255 is
programmed as a simple I/O port for connection with devices such as LEDs, stepper
motors and sensors.
The following block diagram shows the various devices connected to the different
ports of an 8255. The ports are each 8-bit and are named A, B and C. The individual ports
of the 8255 can be programmed to be input or output, and can be changed dynamically.
The control register is programmed in simple I/O mode with port A, port B and port C
(upper) as output ports and port C (lower) as an input port.
IR CIRCUITS
This circuit has two stages: a transmitter unit and a receiver unit. The transmitter
unit consists of an infrared LED and its associated circuitry.

IR TRANSMITTER
The IR LED emitting infrared light is put on in the transmitting unit. To generate
IR signal, 555 IC based astable multivibrator is used. Infrared LED is driven through
transistor BC 548. IC 555 is used to construct an astable multivibrator which has two

Unmanned Automated Railway Gate Controller


quasi-stable states. It generates a square wave of frequency 38kHz and amplitude 5Volts.
It is required to switch ON the IR LED.
IR RECEIVER:
The receiver unit consists of a sensor and its associated circuitry. In receiver
section, the first part is a sensor, which detects IR pulses transmitted by IR-LED.
Whenever a train crosses the sensor, the output of IR sensor momentarily transits through
a low state. As a result the monostable is triggered and a short pulse is applied to the port
pin of the 8051 microcontroller. On receiving a pulse from the sensor circuit, the
controller activates the circuitry required for closing and opening of the gates and for
track switching. The IR receiver circuit is shown in the figure below.

STEP MOTOR ADVANTAGES


Step motors convert electrical energy into precise mechanical motion. These
motors rotate a specific incremental distance per each step. The number of steps executed
controls the degree of rotation of the motors shaft. This characteristic makes step motors
excellent for positioning applications. For example, a 1.8 step motor executing 100 steps
will rotate exactly 180 with some small amount of non-cumulative error. The speed of
step execution controls the rate of motor rotation. A 1.8 step motor executing steps at a
speed of 200 steps per second will rotate at exactly 1 revolution per second.
Step motors can be very accurately controlled in terms of how far and how fast they will
rotate. The number of steps the motor executes is equal to the number of pulse commands
it is given. A step motor will rotate a distance and at a rate that is proportional to the
number and frequency of its pulse commands.
Step motors have several advantages over other types of motors. One of the most
impressive is their ability to position very accurately. NMBs standard step motors have
an accuracy of +/-5%. The error does not accumulate from step to step. This means that a
standard step motor can take a single step and travel 1.8 +/-0.09. Then it can take one
million steps and travel 1,800,000 +/-0.09. This characteristic gives a step motor almost
perfect repeatability. In motor terms, repeatability is the ability to return to a previously
held position. A step motor can achieve the same target position, revolution after
revolution.

Unmanned Automated Railway Gate Controller

5.EMBEDDED SYSTEMS
Introduction:
An Embedded system is a combination of computer hardware and software, and
perhaps additional mechanical or other parts, designed to perform a specific function.
Embedded systems are usually a part of larger, complex system. Dedicated
applications, designed to execute specific activities, are implemented and embedded in
systems. These embedded applications are required to collaborate with the other
components of an enclosed system. Embedded application components interact mostly
with the non-human external environment. They continuously collect data from sensors
or other computer components and process data within real-time constraints. Embedded
systems are usually associated with dedicated hardware and specific software.

Embedding an application into system

Application and system are closely tied together

Collaborative application

Dedicated H/W and specific S/W

Interaction with non-human external environment

Unmanned Automated Railway Gate Controller

Real-time systems are embedded systems

Understand
Understanduser
user
requirements
requirements
Choose
optimum
5.1 EMBEDDED PRODUCT
DEVELOPMENT
LIFE CYCLE
Choose
optimum
electronic
electronicchip
chip

S/W Side

H/W Side

HLL/ALL
HLL/ALL
PCB
PCBLayout
Layoutdesign
design

Algorithm
Algorithm
Coding/Editing
Coding/Editing
Compiling/Assembling
Compiling/Assembling

Assembling
Assembling
components
components

Debugging
Debugging
Testing
Testing

Testing
Testing

Simulator
Simulator
S/W
S/W

H/W
H/W
DOWNLOAD

ICE
ICE(In
(InCircuit
Circuit
Emulator)
Emulator)
Embedded
EmbeddedProduct
Product

Unmanned Automated Railway Gate Controller

5.2 DESIGN CONSIDERATIONS FOR AN EMBEDDED SYSTEM

Introduction:
Unlike software designed for general-purpose computers, embedded software
cannot usually be run on other embedded system without significant modification. This is
mainly because of the incredible variety in the underlying hardware. The hardware in
each embedded system is tailored specifically to the application, in order to keep system
costs low. As a result, unnecessary circuitry is eliminated and hardware resources are
shared whenever possible.
In order to have software, there must be a place to store the executable code and
temporary storage for runtime data manipulation. These take the form of ROM and RAM,
respectively. All embedded systems also contain some type of inputs and outputs. It is
almost always the case that the outputs of the embedded system are a function of its
inputs and several other factors. The inputs to the system usually take the form of sensors
and probes, communication signals, or control knobs and buttons. The outputs are
typically displays, communication signals, or changes to the physical world.

Memory
Memory

Inputs
Inputs

Processor
Processor

Outputs
Outputs

Unmanned Automated Railway Gate Controller

Example of an Embedded System


Other common design requirement include

Processing power

Memory

Development cost

Number of Units

Expected Lifetime

Reliability

Processing power
This is the amount of processing power necessary to get the hob done. A common
way to compare processing power is the MIPS (millions of instructions per second)
rating. Other important features of the processor need to be consider is register width,
typically ranges from 8 to 64 bits.
Memory:
The amount of memory (ROM and RAM) required holding the executable
software and data it manipulates. The amount of memory required can also affect the
processor selection. In general, the register width off a processor establishes the upper
limit of the amount of memory it can access.

Unmanned Automated Railway Gate Controller

Development cost:
The development cost of the hardware and software design processes is a fixed,
one-time cost, so it might be that money is no object or that this is the only accurate
measure of system cost.
Number of units:
The tradeoff between production cost and development cost is affected most by
the number of units expected to be produced and sold.

Expected lifetime:
This indicates how long must the system continue to function? This affects all
sorts of design decisions from the selection of hardware components to how much the
system may cost to develop and produce.
Reliability:
How reliable must the final product be? If it is a childrens toy, it doesnt always
have to work right, but if it is part of a space shuttle or a car, it had sure better do what it
is supposed to each and every time.
The Basic Design REALTIME:
Designing Embedded systems is a challenging task. Most of the challenge comes
from the fact that Embedded systems have to interact with real world entities. These
interactions can get fairly complex. A typical Emebbed system might be interacting with
thousands of such entities at the same time. For example, a telephone switching system
routinely handles calls from tens of thousands of subscriber. The system has to connect
each call differently. Also, the exact sequence of events in the call might vary a lot.
Embedded systems have to respond to external interactions in a predetermined
amount of time. Successful completion of an operation depends upon the correct and
timely operation of the system. Design the hardware and the software in the system to
meet the Realtime requirements. For example, a telephone switching system must feed
dial tone to thousands of subscribers within a recommended limit of one second. To meet

Unmanned Automated Railway Gate Controller


these requirements, the off hook detection mechanism and the software message
communication involved have to work within the limited time budget. The system has to
meet these requirements for all the calls being set up at any given time.
The designers have to focus very early on the Realtime response requirements.
During the architecture design phase, the hardware and software engineers work together
to select the right system architecture that will meet the requirements. This involves
deciding inter connectivity of the processors, link speeds, processor speeds, etc.

The main queries to be asked are:

Is the architecture suitable?

If message communication involves too many

nodes, it is likely that the system may not be able to meet the Realtime
requirement due to even mild congestion. Thus a simpler architecture has a better
chance of meeting the Realtime requirements.

Are the processing components powerful enough?

A CPU with really high

utilization will lead to unpredictable Realtime behavior. Also, it is possible that


the high priority tasks in the system will starve the low priority tasks of any CPU
time. This can cause the low priority tasks to misbehave.

Is the Operating System suitable? Assign high priority to tasks that are involved
in processing Realtime critical events. Consider preemptive scheduling if
Realtime requirements are stringent. When choosing the operating system, the
interrupt latency and scheduling variance should be verified.
o Scheduling variance refers to the predictability in task scheduling times.
For example, a telephone switching system is expected to feed dialtone in
less than 500 ms. This would typically involve scheduling three to five
tasks within the stipulated time. Most operating systems would easily meet

Unmanned Automated Railway Gate Controller


these numbers as far as the mean dialtone delay is concerned. But general
purpose operating systems would have much higher standard deviation in
the dialtone numbers.
o Interrupt Latency refers to the delay with which the operating system can
handle interrupts and schedule tasks to respond to the interrupt. Again,
Embedded Systems based on real-time operating systems would have
much lower interrupt latency.

6.MICROCONTROLLER

Introduction:
Microcontrollers are "embedded" inside some other device (often a consumer
product) so that they can control the features or actions of the product. Another name for
a microcontroller, therefore, is "embedded controller."

Microcontrollers are dedicated to one task and run one specific program. The
program is stored in ROM (read-only memory) and generally does not change.

Microcontrollers are often low-power devices.

A microcontroller has a dedicated input device and often (but not always) has a
small LED or LCD display for output. A microcontroller also takes input from the
device it is controlling and controls the device by sending signals to different
components in the device.

For example, the microcontroller inside a TV takes input from the remote control
and displays output on the TV screen. The controller controls the channel selector,
the speaker system and certain adjustments on the picture tube electronics such as
tint and brightness. The engine controller in a car takes input from sensors such as
the oxygen and knock sensors and controls things like fuel mix and spark plug

Unmanned Automated Railway Gate Controller


timing. A microwave oven controller takes input from a keypad, displays output on
an LCD display and controls a relay that turns the microwave generator on and off.

A microcontroller is often small and low cost. The components are chosen to
minimize size and to be as inexpensive as possible.

A microcontroller is often, but not always, ruggedized in some way.

On the other hand, a microcontroller embedded inside a VCR hasn't been


ruggedized at all.

The actual processor used to implement a microcontroller can vary widely.

Atmel 89c51 Microcontroller Description

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer


with 4K bytes of Flash programmable and erasable read only memory (PEROM) based
on the famous 8051 architecture. The device is manufactured using Atmels high-density
nonvolatile memory technology and is compatible with the industry-standard MCS-51
instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible and cost-effective solution to
many embedded control applications.
Features

The AT89C51 provides the following standard features:

Compatible with MCS-51 Products

Endurance: 1,000 Write/Erase Cycles

4K Bytes of In-System Reprogrammable Flash Memory

128 bytes of Internal RAM (128 x 8-bit)

32 Programmable I/O Lines

Unmanned Automated Railway Gate Controller

Two 16-bit Timer/Counters

Five vector two-level interrupt architecture

A full duplex serial port

Three-level Program Memory Lock

Six Interrupt Sources

BLOCK DIAGRAM:

Unmanned Automated Railway Gate Controller

Figure: Block Diagram of AT89c51 Microcontroller

PIN CONFIGURATIONS:

Unmanned Automated Railway Gate Controller

Figure: PDIP Type AT89c51 Pin Diagram

PIN DESCRIPTION
VCC Supply voltage.
GND 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
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups.
The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1
pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs,
Port 1 pins that are externally being pulled low will source current (IIL) because of the

Unmanned Automated Railway Gate Controller


internal pull-ups. Port 1 also receives the low-order address bytes during Flash
programming and verification.
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 uses 16-bit addresses
(MOVX @ DPTR). In this application, it uses strong internal pull-ups when emitting 1s.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups.
The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3
pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source current (IIL) because of the
pull-ups.
Port 3 also serves the functions of various special features of the AT89C51 as listed
below:
Port Pin
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

Alternate Functions
RXD (serial input port)
TXD (serial output port)
INT0 (external interrupt 0)
INT1 (external interrupt 1)
T0 (timer 0 external input)
T1 (timer 1 external input)
WR (external data memory Write
strobe)
RD (external data memory read
strobe)

Unmanned Automated Railway Gate Controller


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.
PSEN

Program Store Enable is the read strobe to external program memory. When the
AT89C51 is executing code from external program memory,
each machine cycle, except that two

PSEN

PSEN

is activated twice

activations are skipped during each access to

external data memory.


EA

/VPP
External Access Enable 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.

Unmanned Automated Railway Gate Controller


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
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1.
Either a quartz crystal or ceramic resonator may be used.
To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking
circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.

Figure1: Oscillator Connections


Note: C1, C2 = 30 pF 10 pF for Crystals

Unmanned Automated Railway Gate Controller


= 40 pF 10 pF for Ceramic Resonators

Figure 2: External Clock Drive Configuration


How Oscillator works
When quartz crystal is subjected to mechanical pressure, they produce
a measurable electrical voltage conversely when an electric current is applied to a crystal,
it will induce mechanical movement. If an ac is passed through the crystal plate the
charges

oscillate

back

and

f=12 ((1+C/CP)/(LC)))

front

at

the

resonant

frequency

of

crystal.

Unmanned Automated Railway Gate Controller

Quartz crystal exhibits a property called the piezo-electric effect that is they
produce an electric voltage. When subjected to pressure along certain direction of the
crystal because of this property quartz crystal has important application in electronics
industry for controlling the frequency of radio waves.When piezo-electric crystal is used
in place of LC circuit for higher frequency stability, the oscillator is called as crystal
oscillator.

Crystal oscillator is used for stability frequency for a long period of time. The
resolution of 0.01 nm/s can be obtained. Crystal operates between fp and fs frequency (a
very narrow bandwidth).
Status of External Pins during Idle and Power-down Modes

Mode
Idle
Idle
Powerdown
Powerdown

Program

ALE

PSEN

Port 0

Port 1

Port 2

1
1

1
1

Data
Float

Data
Data

Data
Data
Address Data

Internal

Data

Data

Data

Data

External

Float

Data

Data

Data

Memory
Internal
External

Program Memory Lock Bits

Port3

Unmanned Automated Railway Gate Controller


On the chip are three lock bits which can be left un-programmed (U) or can be
programmed (P) to obtain the additional features listed in the table below. When lock bit
1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the
device is powered up without a reset, the latch initializes to a random value, and holds
that value until reset is activated. It is necessary that the latched value of EA be in
agreement with the current logic level at that pin in order for the device to function
properly.

Lock Bit Protection Modes

Program Lock Bits


1

LB1

LB2

LB3

Protection Type
No program lock features
MOVC instructions executed

from

external

program memory are disabled from fetching code


2

bytes from internal memory, EA is sampled and


latched on reset, and further programming of the

Flash is disabled
Same as mode 2, also verify is disabled
Same as mode 3, also external execution is
disabled

Programming the Flash


The AT89C51 is normally shipped with the on-chip Flash memory array in the
erased state (that is, contents = FFH) and ready to be programmed. The programming

Unmanned Automated Railway Gate Controller


interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable
signal.
The low-voltage programming mode provides a convenient way to program the
AT89C51 inside the users system, while the high-voltage programming mode is
compatible with conventional third-party Flash or EPROM programmers.
Reading the Signature Bytes:
The signature bytes are read by the same procedure as a normal verification of
locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low.
The values returned are as follows.
(030H) = 1EH indicates manufactured by Atmel
(031H) = 51H indicates 89C51
(032H) = FFH indicates 12V programming
(032H) = 05H indicates 5V programming.
Programming Interface
Every code byte in the Flash array can be written and the entire array can be
erased by using the appropriate combination of control signals. The write operation cycle
is self timed and once initiated, will automatically time itself to completion. All major
programming vendors offer worldwide support for the Atmel microcontroller series.
Please contact your local programming vendor for the appropriate software revision.
Flash Programming Modes
Mode

RST

PSEN

Write Code Data

Read Code Data

Bit-1

Bit-2
Bit-3

ALE/PROG

P2.6 P2.7 P3.6


VPP
H/12V L
H
H

P3.7

H/12V H

H/12V H

H/12V H

Chip Erase
H
Read Signature H

L
L

H/12V H
H
L

L
L

L
L

L
L

Write
Lock

EA

Unmanned Automated Railway Gate Controller


Byte
Note: Chip Erase requires a 10 ms PROG pulse.
EXTERNAL PROGRAM MEMORY READ CYCLE

External Data Memory Read Cycle

External Data Memory Write Cycle

Unmanned Automated Railway Gate Controller

External Clock Drive Waveforms

External Clock Drive

Symbol
1/tCLCL
tCLCL
techs
talc
talc
techs

Parameter
Oscillator Frequency
Clock Period
High Time
Low Time
Rise Time
Fall Time

Min
0
41.6
15
15

Max
24

20
20

Units
MHz
ns
ns
ns
ns
ns

Unmanned Automated Railway Gate Controller

7.HARDWARE DISCRIPTION
7.1 STEPER MOTOR
Introduction:
Stepper motors convert electrical energy into precise mechanical motion. These
motors rotate a specific incremental distance per each step. The number of steps executed
controls the degree of rotation of the motors shaft. This characteristic makes step motors
excellent for positioning applications. For example, a 1.8 step motor executing 100 steps
will rotate exactly 180 with some small amount of non-cumulative error. The speed of
step execution controls the rate of motor rotation. A 1.8 step motor executing steps at a
speed of 200 steps per second will rotate at exactly 1 revolution per second.
Stepper motors can be very accurately controlled in terms of how far and how fast
they will rotate. The number of steps the motor executes is equal to the number of pulse
commands it is given. A step motor will rotate a distance and at a rate that is proportional
to the number and frequency of its pulse commands.
Basic Stepper Motor System

Unmanned Automated Railway Gate Controller


The diagram above shows a typical step motor based system. All of these parts
must be present in one form or another. Each components performance will have an
effect on the others. By altering the frequency of the pulse train, the pulse generator can
instruct the motor to accelerate, run at a speed, decelerate or stop. A pulse generator must
be present otherwise the motor will not move. Next is the motor driver.

The driver takes the pulses from the pulse generator and determines how and
when the windings should be energized. The windings must be energized in a specific
sequence to generate motion. Finally there is the step motor itself. A step motor has two
primary parts; the rotor, the moving piece, and the stator, the stationary piece. The stator
contains coils of wire called windings. The rotor spins on bearings or bushings inside the
stator. All step motors operate through the principle of the rotor following a rotating
magnetic field created by sequencing the flow of current through the stator windings.
Each NMB step motor has two phases, which are groups of electrically connected
windings. As current is passed through each phase, the motor takes steps or small
movements to keep in synchronism with the magnetic field. The degree of rotation per
step depends on the style of driver used and the construction of the motor.
Step Motor Advantages:
Accuracy & Repeatability Ability to position accurately.
Responsiveness & Quick Acceleration Step motors have low rotor inertia,
allowing them to get up to speed quickly. This makes step motors an excellent choice for
short, quick moves.
Excellent torque for their size Step motors have the highest torque per cubic
inch of any motor.
Positioning Stability Unlike other types of motors, step motors can be held
completely motionless in their stopped position.

Unmanned Automated Railway Gate Controller


Construction and Operating the Hybrid STEP MOTOR
Figure 1a depicts a 1.8 hybrid step motor. The rotor contains a permanent magnet
similar to those found in permanent magnet step motors. Hybrid rotors are axially
magnetized, one end polarized north and the other polarized south. Both the rotor and the
stator assemblies of hybrid motors have tooth-like projections. To understand the rotors
interaction with the stator, examine the construction of a 1.8 (the most common
resolution) hybrid step motor.
The two cups are oriented so that the teeth of the top cup are offset to the teeth of
the bottom cup by 3.6. Second, the stator has a two-phase construction. The winding
coils, 90 apart from one another, make up each phase. Each phase is wound so that the
poles 180 apart are the same polarity, while the poles 90 apart are the opposite polarity.
When the current in a phase is reversed, is the polarity, meaning that any winding coil can
be either a north pole or a south pole. As shown in fig. 1b below, when phase A is
energized, the windings at 12 oclock and 6 oclock are north poles and the windings at 3
oclock and 9 oclock are south poles.
The windings at 12 and 6 would attract the teeth of the magnetically south end of
the rotor, and windings at 3 and 9 would attract the teeth of the magnetically north end of
the rotor.
.

Unmanned Automated Railway Gate Controller

7.2 CAPACITORS
Introduction:
An electrolytic capacitor is a type of capacitor typically with a larger capacitance
per unit volume than other types, making them valuable in relatively high-current and
low-frequency electrical circuits. This is especially the case in power-supply filters,
where they store charge needed to moderate output voltage and current fluctuations, in
rectifier output, and especially in the absence of rechargeable batteries that can provide
similar low-frequency current capacity. They are also widely used as coupling capacitors
in circuits where AC should be conducted but DC should not; the large value of the
capacitance allows them to pass very low frequencies.
The electrolytic capacitor was invented in 1886 by Charles Pollack. It was largely
responsible for the development of mains-powered radio receivers, since it permitted the
filtering of the 50-60 hertz power supplied to residences, after it was rectified to power
the radio tubes. This was not practical without the small volume and low cost of
electrolytic capacitors.

Construction
Aluminum electrolytic capacitors are constructed from two conducting aluminum
foils, one of which is coated with an insulating oxide layer, and a paper spacer soaked in
electrolyte. The foil insulated by the oxide layer is the anode while the liquid electrolyte
and the second foil act as cathode. This stack is then rolled up, fitted with pin connectors
and placed in a cylindrical aluminum casing. The two most popular geometries are axial
leads coming from the center of each circular face of the cylinder, or two radial leads or
lugs on one of the circular faces. Both of these are shown in the picture

Polarity
In aluminum electrolytic capacitors, the layer of insulating aluminum oxide on the
surface of the aluminum plate acts as the dielectric, and it is the thinness of this layer that
allows for a relatively high capacitance in a small volume. The aluminum oxide layer can

Unmanned Automated Railway Gate Controller


withstand an electric field strength of the order of 109 volts per meter. The combination of
high capacitance and high voltage result in high energy density.
Unlike most capacitors, electrolytic capacitors have a voltage polarity
requirement. The correct polarity is indicated on the packaging by a stripe with minus
signs and possibly arrowheads, denoting the adjacent terminal that should be more
negative than the other. This is necessary because a reverse-bias voltage will destroy the
center layer of dielectric material via electrochemical reduction (see redo reactions).
Without the dielectric material the capacitor will short circuit, and if the short circuit
current is excessive, then the electrolyte will heat up and either leak or cause the
capacitor to explode.
Modern capacitors have a safety valve, typically either a scored section of the can,
or a specially designed end seal to vent the hot gas/liquid, but ruptures can still be
dramatic. Electrolytic can withstand a reverse bias for a short period of time, but they will
conduct significant current and not act as a very good capacitor. Most will survive with
no reverse DC bias or with only AC voltage, but circuits should be designed so that there
is not a constant reverse bias for any significant amount of time. A constant forward bias
is preferable, and will increase the life of the capacitor.

These are the different schematic symbols for electrolytic capacitors. The minus or N
marked side of the physical capacitor is equivalent to the node opposite to the plus sign
on its symbolic equivalent. Tip: Take notice of the shape of the symbols and the
placement of the positive and negative nodes, because most schematics do not print the
"+", but rely on the symbol itself instead.

note: caps in metal can have the color mark at the minus side !

Unmanned Automated Railway Gate Controller

Polarity of caps with wires:

axial: the minus wire is connected to the case, the plus wire is isolated.
radial = single ended: a vertical color stripe indicates the minus side.

For the polarity of SMD caps see pica:

Electrolyte
The electrolyte is usually boric acid or sodium borate in aqueous solution together
with various sugars or ethylene glycol which are added to retard evaporation. Care should
be taken to avoid ingestion of or eye contact with the electrolyte, and any areas of the
body where skin contact has occurred should be washed in good time. It is important to
follow safe working practice and to use appropriate protective equipment, notably gloves
and safety glasses, when working with the electrolyte. Some very old tantalum
electrolytic, often called "Wet-slug", contain the more hazardous sulfuric acid, however
most of these are no longer in service due to corrosion.

Capacitance
The capacitance value of any capacitor is a measure of the amount of electric
charge stored per unit of potential difference between the plates. The basic unit of
capacitance is a farad, however this unit has been too large for general use until the
invention of the Double-layer capacitor, so microfarad, nanofarad and microfarad are
more commonly used. These are usually abbreviated to if or of, no and puff
Many conditions determine a capacitor's value, such as the thickness of the
dielectric and the plate area. In the manufacturing process, electrolytic capacitors are
made to conform to a set of preferred numbers. By multiplying these base numbers by a
power of ten, any practical capacitor value can be achieved, which is suitable for most
applications.
A standardized set of capacitor base numbers was devised so that the value of any
modern electrolytic capacitor could be derived from multiplying one of the modern
conventional base numbers 1.0, 1.5, 2.2, 3.3, 4.7 or 6.8 by a power of ten. Therefore, it is
common to find capacitors with values of 10, 15, 22, 33, 47, 68, 100, 220, and so on.
Using this method, values ranging from 0.1 to 4700 are common in most applications.
Values are generally in microfarads (F).
Most electrolytic capacitors have a tolerance range of 20 %, meaning that the
manufacturer is stating that the actual value of the capacitor lies within 20 % of its
labeled value. Selection of the preferred series ensures that any capacitor can be sold as a
standard value, within the tolerance.

Unmanned Automated Railway Gate Controller

Super capacitor

MC and BC series super capacitors (up to 3000 farad capacitance) produced by Maxwell
Technologies
Super capacitors, also known as ultra capacitors or electrochemical double layer
capacitors (EDLC), are electrochemical capacitors that have an unusually high energy
density when compared to common capacitors, typically on the order of thousands of
times greater than a high-capacity electrolytic capacitor. For instance, a typical D-cell
sized electrolytic capacitor will have a storage capacity measured in microfarads, while
the same size super capacitor would store several farads, an improvement of about 10,000
times. Larger commercial super capacitors have capacities as high as 5,000 farads.
Super capacitors have a variety of commercial applications, notably in "energy
smoothing" and momentary-load devices. Some of the earliest uses were motor startup
capacitors for large engines in tanks and submarines, and as the cost has fallen they have
started to appear on diesel trucks and railroad locomotives. More recently they have
become a topic of some interest in the green energy world, where their ability to quickly
soak up energy makes them particularly suitable for regenerative braking applications,
whereas batteries have difficulty in this application due to slow charging times. If the
LEES or Ester devices can be commercialized, they will make an excellent replacement
for batteries in all-electric cars and plug-in hybrids, as they combine quick charging,
temperature stability and excellent safety properties.

Unmanned Automated Railway Gate Controller


Concept
Comparison of construction diagrams of three capacitors. Left: "normal" capacitor,
middle: electrolytic, right: super capacitor

In a conventional capacitor, energy is stored by the removal of charge carriers, typically


electrons, from one metal plate and depositing them on another. This charge separation
creates a potential between the two plates, which can be harnessed in an external circuit.
The total energy stored in this fashion is a combination of the number of charges stored
and the potential between the plates.
In contrast with traditional capacitors, super capacitors do not have a conventional
dielectric, as such. They are based on a structure that contains an electrical double layer.
In a double layer, the effective thickness of the "dielectric" is exceedingly thinon the
order of nanometersand that, combined with the very large surface area, is responsible
for their extraordinarily high capacitances in practical sizes.
In an electrical double layer, each layer by itself is quite conductive, but the
physics at the interface where the layers are effectively in contact means that no
significant current can flow between the layers. However, the double layer can withstand
only a low voltage, which means that super capacitors rated for higher voltages must be
made of matched series-connected individual super capacitors, much like seriesconnected cells in higher-voltage batteries.

Unmanned Automated Railway Gate Controller


History:
The super capacitor effect was first noticed in 1957 by General Electric engineers
experimenting with devices using porous carbon electrode. It was believed that the
energy was stored in the carbon pores and it exhibited "exceptionally high capacitance",
although the mechanism was unknown at that time.
General Electric did not immediately follow up on this work, and it was Standard
Oil of Ohio that eventually developed the modern version of the devices in 1966 after
accidentally re-discovering the effect while working on experimental fuel cell designs.
Their cell design used two layers of activated charcoal separated by a thin porous
insulator. Standard Oil also failed to commercialize their invention, licensing the
technology to NEC, who finally marketed the results as super capacitors in 1978, to
provide backup power for maintaining computer memory. In 2005, the ultra capacitor
market was between US $272 million and $400 million, depending on the source. It is
rapidly growing, especially in the automotive sector.
Recently, all solid state micrometer-scale super capacitors based on advanced
supersonic conductors had been recognized as critical electron component of future subvoltage and deep-sub-voltage nanoelectronics and related technologies (22 nm
technological node of CMOS and beyond).

Technology advantages
Due to the capacitor's high number of charge-discharge cycles (millions or more
compared to 2001000 for most commercially available rechargeable batteries) there
were no disposable parts during the whole operating life of the device, which makes the
device environmentally friendly. storing energy from other sources for load balancing
purposes and then using any excess energy to charge the batteries only at opportune
times.
Other advantages of super capacitors compared with rechargeable batteries are
extremely low internal resistance or ESR, high efficiency (up to 97-98%), high output
power, extremely low heating levels, and improved safety. According to ITS (Institute of
Transportation Studies, Davis, CA) test results, the specific power of super capacitors can
exceed 6 kW/kg at 95% efficiency
The idea of replacing batteries with capacitors in conjunction with novel
alternative energy sources became a conceptual umbrella of the Green Electricity (GEL)
Initiative, introduced by Dr. Alexander Bell.

Unmanned Automated Railway Gate Controller


Transportation applications
China is experimenting with a new form of electric bus (casabas) that runs
without power lines using power stored in large onboard super capacitors, which are
quickly recharged whenever the electric bus stops at any bus stop (under so-called
electric umbrellas), and fully charged in the terminus. A few prototypes were being
tested in Shanghai in early 2005. In 2006, two commercial bus routes began to use super
capacitor buses; one of them is route 11 in Shanghai.
In 2001 and 2002, VAG, the public transport operator in Nuremberg, Germany
tested a bus which used a diesel-electric drive system with super capacitors.
Other companies from the public transport manufacturing sector are developing
super capacitor technology: The Transportation Systems division of Siemens AG is
developing a mobile energy storage based on double-layer capacitors called Subic Energy
Storage and also Sitars SES, a stationary version integrated into the trackside power
supply. The company Cudgeled is also developing a super capacitor-based energy storage
system.

Resistors, capacitors and inductors

Resistor values are always coded in ohms, capacitors in microfarads (pF),


inductors in micro henries (H), and transformers in volts.

band A is first significant figure of component value


band B is the second significant figure
band C is the decimal multiplier
band D if present, indicates tolerance of value in percent (no color means 20%)

For example, a resistor with bands of yellow, violet, red, and gold will have first
digit 4 (yellow in table below), second digit 7 (violet), followed by 2 (red) zeros:
4,700 ohms. Gold signifies that the tolerance is 5%, so the real resistance could lie
anywhere between 4,465 and 4,935 ohms.
Resistors manufactured for military use may also include a fifth band which
indicates component failure rate (reliability); refer to MIL-HDBK-199 for further details.
The Standard EIA Color Code Table per EIA-RS-279 is as follows:

Unmanned Automated Railway Gate Controller


Color 1st band 2nd band 3rd band (multiplier) 4th band (tolerance) Temp. Coefficient
Black 0

100

Brown 1

101

1% (F)

100 pap

Red

102

2% (G)

50 pap

Orange 3

103

15 pap

Yellow 4

104

25 pap

Green 5

105

0.5% (D)

Blue

106

0.25% (C)

Violet 7

107

0.1% (B)

Grey

108

0.05% (A)

White 9

109

Gold

0.1

5% (J)

Silver

0.01

10% (K)

None

20% (M)

Note: red to violet are the colors of the rainbow where red is low energy and violet is
higher energy.

Unmanned Automated Railway Gate Controller

7.3 POWER SUPPLY:

CIRCUIT DIAGRAM:
7805
1

230 V
AC
SUPPL
4
Y TRANSFORMER
50 HZ

IN4007

2
6

1 100u

IN400
7

1k
1

2 1000u
1f

LED

POWER SUPPLY:
To run the electronic gadget at home it is provided by some power supply. The
microcontroller used (at89c51) requires 12v D.C supply. The DTMF receiver used
(mt8870) requires 5v D.C. so design of these regulated power supply is also an important
part in hardware design. The A.C power supply from mains is taken and regulated using
the rectifiers.
For design of a regulated power supply components used are:
Transformer.
Diodes.
Rectifiers.
Regulated IC chips.
Capacitive filters.
Trans former:
A transformer is required to couple the mains to the actual power supply circuit.
This is required to isolate the mains from the actual regulated power supply circuit and
the other part of the kit. This isolation eliminates the dame of the kit to any power supply
variations or from a faulty shock.

Unmanned Automated Railway Gate Controller

For a transformer shown below:


:
i1

i2

V1

V2

V1 = i2 = n1
V2 i1 n2

Diodes:
In bride rectifier four diodes are used. The specifications of diodes are chosen
as:
PIV > input voltage.
Si diode is better.
Power dissipation is kept fixed with respect to current through the diode.
Junction capacitance need not be considered for frequencies <1 kHz.

RECTIFIERS:
Rectification is a process of conversion of AC to DC. Here, the AC of transformer
output is given to the rectifier input, which converts it to DC output. Basically, bridge
rectifiers or diodes arranged in bridge called Diode arrangement are used for power
supply design.
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve
full-wave rectification. This is a widely used configuration, both with individual diodes
wired as shown and with single component bridges where the diode bridge is wired
internally

Unmanned Automated Railway Gate Controller

Current Flow in the Bridge Rectifier

For both positive and


negative swings of
the transformer, there
is a forward path through the diode bridge. Both conduction paths cause current to
flow in the same direction through the load resistor, accomplishing full-wave
rectification.
While one set of diodes is forward biased, the other set is reverse biased and
effectively eliminated from the circuit.
Diode Bridge:
A diode bridge is an arrangement of four diodes connected in a bridge circuit as
shownbelow, that provides the same polarity of output voltage for any polarity of the
input voltage. When used in its most common application, for conversion of alternating
current (AC) input into direct current (DC) output, it is known as a bridge rectifier. The
diagram describes a diode-bridge design known as a full-wave rectifier or Graetz circuit.
This design can be used to rectify single phase AC when no transformer center tap
is available
Bridge Rectifier Circuit:

Unmanned Automated Railway Gate Controller


The essential feature of this arrangement is that for both polarities of the voltage
at the bridge input, the polarity of the output is constant.

Capacitors:
Capacitive filters are used stabilized or perfect regulation of the voltage. The
capacitive filters are opted because, they are more efficient. But they are also more costly.
Different types of capacitors are:
1. Ceramic capacitors.
2. Electrolyte capacitors.
3. Paper/Mica capacitors.
4. Silver capacitors.
5. Tantalum capacitors.
Ceramic, Paper/Mica, Silver are nonpolarized capacitors. Electrolyte and Tantalum
are polarized capacitors. For high frequency, Ceramic capacitors are used. For low
frequencies, Electrolyte capacitors are used.

Linear regulated ICs:


Linear regulated ICs are used for best regulated output. The output from these
regulated ICs is given to microcontroller and DTMF receiver. These linear regulated ICs
are self protective (any accidental shot circuit in the IC is grounded automatically).
78xx series ICs are used for +ve supply.
79xx series ICs are used for -ve supply.
78xx and 79xx series ICs are fixed voltage regulators. LM 317 is a variable
voltage regulator.

Unmanned Automated Railway Gate Controller

ULN2803buffer:
Features:
500-mA Rated Collector Current (Single
Output)

High-Voltage Outputs . . . 50 V

Output Clamp Diodes

Inputs Compatible With Various Types of


logic

Relay Driver Applications

Compatible with ULN2800A Series

description/ordering information:
The ULN2803A is a high-voltage, highcurrent Darlington transistor array. The device
consists of eight nun Darlington pairs that feature high-voltage outputs with commoncathode clamp diodes for switching inductive loads. The collector-current rating of each
Darlington pair is 500 mA. The Darlington pairs may be connected in parallel for higher
current capability.
Applications include relay drivers, hammer drivers, lamp drivers, display drivers
(LED and gas discharge), line drivers, and logic buffers. The ULN2803A has a 2.7kseries base resistor for each Darlington pair for operation directly with TTL or 5-V
CMOS devices.

Unmanned Automated Railway Gate Controller

Logic diagram:

LOGIC DIAGRAM FOR THE ULN2803buffer

Unmanned Automated Railway Gate Controller

M NEMONICS
A useful mnemonic for remembering the first ten color codes matches the first letter
of the color code, by order of increasing magnitude. There are many variations:

Bad Beer Rots Our Young Guts But Vodka Goes Well
Bright Boys Rave Over Young Girls But Veto Getting Wed
B. B. R O Y of Great Britain has a Very Good Wife
Big Boys Race Our Young Girls But Violet Generally Wins
Better Be Right Or Your Great Big Venture Goes West
Black Beauty Ran Over Yellow Grass By Violent Grey Waters
Bad Boys Race Over Yonder Green But Victory Goes Wanting
Black Birds Roam Over Your Garden But Vultures Go West
Bye Bye Rosie Off You Go Birmingham Via Great Weston

The word "Bad" in the first mnemonic and "Bright" in the second mnemonic are often
replaced with the word "Black" since black comes before brown in the color code. While
the second mnemonic is certainly the most offensive of these, all except the third lack a
sobriety that might be desirable, especially in a teaching context. A more staid memory
aide uses the fact that the central part of the code follows the color spectrum, without the
i for indigo. That is,

Black Brown Roy G. Big Gray White

The most common variation of the mnemonic for the EIA color code generally
doesn't stay posted on this page for long due to its choice of words which is more
offensive to many today than when it was originated (mid 1920's). Refer to the discussion
for details.
Besides the ten colors of the main value code, the tolerance code is often
remembered as "for Gold or Silver" appended to the more offensive mnemonic, or "Get
Some Now" where Now refers to none for 20%.
If it is difficult to recall that black comes before brown in the color code, it may
be helpful to use the position of white at the end of the color code as a key to remember
that black (and not brown) is at the beginning.

Unmanned Automated Railway Gate Controller


Other languages have other mnemonics for this color code. A rough translation of
the French is "Don't eat anything or I'll beat you violently, big animal."

Examples

From top to bottom:

Green-Blue-Black-Black-Brown
o 560 1%
Red-Red-Orange-Gold
o 22,000 5%
Yellow-Violet-Brown-Gold
o 470 5%
Blue-Gray-Black-Gold
o 68 5%

Note: The sizes of the resistors depend only on the power they can dissipate, and do not
affect their value.

What do resistors do?


Resistors limit current. In a typical application, a resistor is connected in series
with an LED:

Unmanned Automated Railway Gate Controller

Enough current flows to make the LED light up, but not so much that the LED is
damaged. Later in this Chapter, you will find out how to calculate a suitable value for this
resistor. (LEDs are described in detail in Chapter 5.)
The 'box' symbol for a fixed resistor is popular in the UK and Europe. A 'zig-zag'
symbol is used in America and Japan:

Resistors are used with transducers to make sensor subsystems. Transducers are
electronic components which convert energy from one form into another, where one of
the forms of energy is electrical. A light dependent resistor, or LDR, is an example of
an input transducer. Changes in the brightness of the light shining onto the surface of
the LDR result in changes in its resistance. As will be explained later, an input transducer
is most often connected along with a resistor to to make a circuit called a potential
divider. In this case, the output of the potential divider will be a voltage signal which
reflects changes in illumination.
Microphones and switches are input transducers. Output transducers include
loudspeakers, filament lamps and LEDs. Can you think of other examples of transducers
of each type?

Unmanned Automated Railway Gate Controller

7.4 COLOR CODING

How can the value of a resistor be worked out from the colours of the bands?
Each color represents a number according to the following scheme:
Number

Color

black

brown

red

orange

yellow

green

blue

violet

grey

white

The first band on a resistor is interpreted as the FIRST DIGIT of the resistor
value. For the resistor shown below, the first band is yellow, so the first digit is 4:

Unmanned Automated Railway Gate Controller


The second band gives the SECOND DIGIT. This is a violet band, making the
second digit 7. The third band is called the MULTIPLIER and is not interpreted in quite
the same way. The multiplier tells you how many nougats you should write after the
digits you already have. A red band tells you to add 2 nougats. The value of this resistor is
therefore 4 7 0 0 ohms, that is, 4 700 , or 4.7
. Work through this example again to
confirm that you understand how to apply the color code given by the first three bands.
The remaining band is called the TOLERANCE band. This indicates the
percentage accuracy of the resistor value. Most carbon film resistors have a gold-colored
tolerance band, indicating that the actual resistance value is with + or - 5% of the nominal
value. Other tolerance colours are:
Tolerance

Color

1%

brown

2%

red

5%

gold

10%

silver

When you want to read off a resistor value, look for the tolerance band, usually
gold, and hold the resistor with the tolerance band at its right hand end. Reading resistor
values quickly and accurately isn't difficult, but it does take practice!

Unmanned Automated Railway Gate Controller

8.SOFTWARE DISCRIPTION
8.1

KEIL MICROVISION

-An IDE for Microcontrollers

Introduction:
Keil development tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to the student just
learning about embedded software development.
The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-time
Kernels, Single-board Computers, and Emulators support all 8051 derivatives and help
you get your projects completed on schedule
The Keil 8051 Development Tools are designed to solve the complex problems facing
embedded software developers.

When starting a new project, simply select the microcontroller you use from the
Device Database and the Vision IDE sets all compiler, assembler, linker, and
memory options for you.
Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and test applications before target hardware is available.
When you are ready to begin testing your software application with target
hardware, use the MON51, MON390, MONADI, or FlashMON51 Target
Monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to
download and test program code on your target system.

The Vision3 IDE is a Windows-based software development platform that combines


a robust editor, project manager, and make facility. Vision3 integrates all tools including
the C compiler, macro assembler, linker/locator, and HEX file generator.

Vision3 helps expedite the development process of your embedded applications


by providing the following:

Unmanned Automated Railway Gate Controller

Full-featured source code editor,


Device database for configuring the development tool setting,
Project manager for creating and maintaining your projects,
Integrated make facility for assembling, compiling, and linking your embedded
applications,
Dialogs for all development tool settings,
True integrated source-level Debugger with high-speed CPU and peripheral
simulator,
Advanced GDI interface for software debugging in the target hardware and for
connection to Keil ULINK,
Flash programming utility for downloading the application program into Flash
ROM,
Links to development tools manuals, device datasheets & users guides.

The Vision3 IDE offers numerous features and advantages that help you quickly and
successfully develop embedded applications. They are easy to use and are guaranteed to
help you achieve your design goals.
The Vision3 IDE and Debugger is the central part of the Keil development tool chain.
Vision3 offers a Build Mode and a Debug Mode.
In the Vision3 Build Mode you maintain the project files and generate the application.
In the Vision3 Debug Mode you verify your program either with a powerful CPU and
peripheral simulator or with the Keil ULINK USB-JTAG Adapter (or other AGDI
drivers) that connect the debugger to the target system. The ULINK allows you also to
download your application into Flash ROM of your target system.

ABOUT THE ENVIRONMENT

Unmanned Automated Railway Gate Controller


The Vision3 screen provides you with a menu bar for command entry, a tool bar
where you can rapidly select command buttons, and windows for source files, dialog
boxes, and information displays. Vision3 lets you simultaneously open and view
multiple source files.Vision3 has two operating modes:
Build Mode: Allows you to translate all the application files and to generate
executable programs. The features of the Build Mode are described under
Creating Applications.
Debug Mode: Provides you with a powerful debugger for testing your
application. The Debug Mode is described in Testing Programs.
In both operating modes you may use the source editor of Vision3 to modify your
source code. The Debug mode adds additional windows and stores an own screen layout.
The following picture shows a typical configuration of Vision3 in the Debug Mode.
The tabs of the Project Workspace give you access to:
o
o
o
o
o

Files and Groups of the project.


CPU Registers during debugging.
Tool and project specific on-line Books.
Text Templates for often used text blocks.
Function in the project for quick editor navigation.

The tabs of the Output Window provides: Build messages and fast error access;
Debug Command input/output console; Find in Files results with quick file
access.
The Memory Window gives access to the memory areas in display various
formats.
The Watch & Call Stack Window allows you to review and modify program
variables and displays the current function call tree.
The Workspace is used for the file editing, disassembly output, and other debug
information.
The Peripheral Dialogs help you to review the status of the on-chip peripherals
in the microcontroller.

8.2 SOFTWARE DEVELOPMENT CYCLE

Unmanned Automated Railway Gate Controller


Home Vision3 Overview Software Development Cycle
When you use the Keil Vision3, the project development cycle is roughly the same
as it is for any other software development project.
1. Create a project, select the target chip from the device database, and configure the
tool settings.
2. Create source files in C or assembly.
3. Build your application with the project manager.
4. Correct errors in source files.
5. Test the linked application.
The following block diagram illustrates the complete Vision3 software development
cycle. Each component is described below.

Vision3 IDE
The Vision3 IDE combines project management, a rich-featured editor with
interactive error correction, option setup, make facility, and on-line help. Use Vision3 to
create your source files and organize them into a project that defines your target
application. Vision3 automatically compiles, assembles, and links your embedded
application and provides a single focal point for your development efforts.

C Compiler & Macro Assembler


Source files are created by the Vision3 IDE and are passed to the C or EC++
Compiler or Macro Assembler. The compiler and assembler process source files and
create reloadable object files.

Library Manager
The library manager allows you to create object library from the object files
created by the compiler and assembler. Libraries are specially formatted, ordered
program collections of object modules that may be used by the linker at a later time.
When the linker processes a library, only those object modules in the library that are
necessary to create the program are used.

Linker/Locator
The Linker/Locator creates an executable program file using the object modules
extracted from libraries and those created by the compiler and assembler. An executable
program file (also called absolute object module) contains no reloadable code or data. All
code and data reside at fixed memory locations.

Unmanned Automated Railway Gate Controller


This executable program file may be used:

To program an Flash ROM or other memory devices,


With the Vision3 Debugger for simulation and target debugging,
With an in-circuit emulator for the program testing.

Vision3 Debugger
The Vision3 symbolic, source-level debugger is ideally suited for fast, reliable
program debugging. The debugger includes a high-speed simulator that let you simulate
an microcontroller system including on-chip peripherals and external hardware. The
Vision3 Debugger provides several ways for you to test your programs on real target
hardware.

Use the Keil ULINK USB-JTAG adapter for Flash downloading and software test
of your program via on-chip debugging system like the Embedded ICE macro cell
that is integrated in many ARM devices.
Use the AGDI interface to attach use the Vision3 Debugger front end with your
target system using other debuggers like Monitor, In-System Debugger, or
Emulator.

At Keil Software, we are dedicated to provide you with the best embedded
development tools and documentation available. If you have suggestions or comments
regarding any of the on-line manuals accompanying this product, please contact us. If
you think you have discovered a problem with the software, do the following before
calling technical support.
1. Read the sections in this manual that pertains to the job or task you are trying to
accomplish.
2. Make sure you are using the most current version of the software and utilities.
Check www.keil.com/update to make sure that you have the latest software
version.
3. Isolate the problem to determine if it is a problem with the assembler, compiler,
linker, debugger, or another development tool.
4. Further isolate software problems by reducing your code to a few lines.

If you are still experiencing problems after following these steps, report them to
our technical support group. Please include your product serial number and version
number. We prefer that you send the problem via email. If you contact us by fax, be sure
to include your name and telephone numbers (voice and fax) where we can reach you.
Try to be as detailed as possible when describing the problem you are having. The
more descriptive your example, the faster we can find a solution. If you have a singlepage code example demonstrating the problem, please email it to us. If possible, make

Unmanned Automated Railway Gate Controller


sure that your problem can be duplicated with the Vision3 Simulator. Please try to avoid
sending complete applications or long listings as this slows down our response to you.
The Vision3 User Interface consists of menus, toolbar buttons, keyboard shortcuts,
dialog boxes, and windows that you use as you interact with and manage the various
aspects of your embedded project.

The menu bar provides menus for editor operations, project maintenance,
development tool option settings, program debugging, external tool control,
window selection and manipulation, and on-line help.
The toolbar buttons allow you to rapidly execute Vision3 commands. A Status
Bar provides editor and debugger information. The various toolbars and the status
bar can be enabled or disabled from the View Menu commands.
Keyboard shortcuts offer quick access to Vision3 commands and may be
configured via the menu command Edit Configuration - Shortcut Key.

The following sections list the Vision3 commands that can be reached by menu
commands, toolbar buttons, and keyboard shortcuts. The Vision3 commands are
grouped mainly based on the appearance in the menu bar:

File Menu and File Commands


Edit Menu and Editor Commands
o Outlining Menu
o Advanced Menu
o Selecting Text Commands
View Menu
Project Menu and Project Commands
Debug Menu and Debug Commands
Flash Menu
Peripherals Menu
Tools Menu
SVCS Menu
Window Menu
Help Menu

CREATING APPLICATIONS
Home Creating Applications
This chapter describes the Build Mode of Vision3 and is grouped into the
following sections:

Create a Project: explains the steps required to setup a simple application


and to generate HEX output.

Unmanned Automated Railway Gate Controller

Project Target and File Groups: shows how to create application variants
and organized the files that belong to a project.
Tips and Tricks: provides information about the advanced features of the
Vision3 Project Manager.

CREATE PROJECT
Home Creating Applications Create Project
Vision3 is a standard Windows application and started by clicking on the
program icon. About the Environment describes the different window areas of
Vision3.
Vision3 includes a project manager which makes it easy to design applications
for an ARM based microcontroller. You need to perform the following steps to create
a new project:

Select the Toolset (only required for ARM Projects).


Create Project File and Select CPU.
Project Workspace - Books.
Create New Source Files.
Add Source Files to the Project.
Create File Groups.
Set Tool Options for Target Hardware.
Configure the CPU Startup Code.
Build Project and Generate Application Program Code.
Create a HEX File for PROM Programming.

The section provides a step-by-step tutorial that shows you how to create a
simple Vision3 project.

PROJECT TARGETS

AND

FILE GROUPS

Home Creating Applications Project Targets and File Groups


By using different Project Targets Vision3 lets you create several programs
from a single project. You may need one target for testing and another target for a
release version of your application. Each target allows individual tool settings within
the same project file.
Files Groups let you group associated files together in a project. We have
already used file groups in our example to separate the CPU related files from other

Unmanned Automated Railway Gate Controller


source files. With these technique it is easily possible to maintain complex projects
with several 100 files in Vision3.
The dialog Project Components, Environment, Books... Project
Components allows you to create project targets and file groups. We have already
used this dialog to add system configuration files in a file group. An example project
structure is shown below.

The Project Workspace shows all groups and the related files. Files are built
and linked in the same order as shown in this window. You can move file positions
with Drag & Drop. You may select a target or group name and Click to rename it.
The local menu opens with a right mouse Click and allows you for each item:

to
to
to
to

set tool options


remove the item
add files to a group
open the file.

In the build toolbar you can quickly change the current project target to build.

PROJECT COMPONENTS
Home Dialogs Project
You may add, delete, or re-arrange the items with the list box buttons in
Project Targets, Groups, and Files.
Project Targets
Shows all Project Targets in your project. Project Targets let you create
several programs form a single project. You may need one target for testing
and another target for a release version of your application.
Groups

Unmanned Automated Railway Gate Controller

Files

Shows all File Groups in your current project. File Groups let you group
associated files together in a project. This is useful for grouping files into
functional blocks or for identifying engineers in your software team.

Shows all files of the selected File Group.


Set as Current Target
Set the selected Project Target as the current target.
Add Files
Add files to the selected File Group.

FILE EXTENSIONS
Home Creating Applications Tips and Tricks File Extensions
The dialog Project Components, Environment and Books allows you to
set the file extension for the various file types of a project. You can enter several
extensions when you separate them by semi-colon. The file extensions are project
specific.

Selecting a Generic Device


Under the Generic section in the device database, you will find the following
generic devices:

8031 (all Variants)


8032 (all Variants)
8051 (all Variants)
8052 (all Variants)
C166 (all Variants) - Supports CPUs with no extended instruction set
C167 (all Variants) - Supports CPUs with an extended instruction set
ARM7 (all Variants) - Supports ARM7 based microcontrollers

Unmanned Automated Railway Gate Controller


You may select one of these devices and then specify any necessary chip options in
the in the Options for Target Target dialog. For example on-chip memory may
be specified as External Memory.

Importing Vision 1 Projects


Home Creating Applications Tips and Tricks Importing Vision 1 Projects
You can import project files from Vision1 by using the menu item Project Import Vision1 Project. This starts the following procedure:
1. Create a new Vision project file. It is important that the new Vision2/3
project file is created in the existing Vision1 project folder.
2. Select a CPU from the device database.
3. Select the old Vision1 project file that exists in the project folder.
4. This import the old Vision1 linker settings into the L166 dialogs. However, we
recommend that you use the dialog Vision Options for Target Target to
define the memory structure of the target hardware. Once you have done
that, you should open the dialog Options for Target L166 / Lx51
Locate. Enable the option Use Memory Layout from Target and remove
the settings for User Classes, User Segments, or User Sections in this
dialog.
5. Check carefully if all settings are copied correctly to the new Vision project
file.
6. You may now create file groups in the new Vision project. Then you can Drag
& Drop files into the new file groups.

Debugging
Home Debugging
This chapter describes the Debug Mode of Vision3 and shows you how to use the
user interface to test a sample program. Also discussed are simulation mode and the
different options available for program debugging.
You can use Vision3 Debugger to test the applications you develop. The
Vision3 Debugger offers two operating modes that are selected in the Options for
Target Debug dialog.

Use Simulator configures the Vision3 Debugger as software-only product


that simulates most features of a microcontroller without actually having
target hardware. You can test and debug your embedded application before
the hardware is ready. Vision3 simulates a wide variety of peripherals

Unmanned Automated Railway Gate Controller

including the serial port, external I/O, and timers. The peripheral set is
selected when you select a CPU from the device database for your target.
Use Advanced GDI drivers, like the ULINK Debugger to interface to your
target hardware. For Vision3 various drivers are available that interface to:
o JTAG/OCDS Adapter: which connects to on-chip debugging systems
like the ARM Embedded ICE.
o Monitor: that may be integrated with user hardware or is available on
many evaluation boards.
o Emulator: which connects to the CPU pins of the target hardware.
o In-System Debugger: which is part of the user application program
and provides basic test functions.
o Test Hardware: such as the Infineon Smartcard ROM Monitor RM66P
or the Philips Smarm Box.

Flash Programming
Home Flash Programming
Vision3 integrates Flash Programming Utilities in the project environment. All
configurations are saved in context with your current project.
You may use external command-line driven utilities (usually provided by the chip
vendor) or the Keil ULINK USB-JTAG Adapter. The Flash Programming Utilities are
configured under Project - Options - Utilities.
Flash Programming may be started from the Flash Menu or before starting the
Vision3 Debugger when you enable Project - Options - Utilities - Update Target
before Debugging.

Measure - Project File


Home Example Programs Measure: A Remote Measurement System
Measure - Project File
The project file for the MEASURE sample program is called Measure.UV2. To
load this project file, use Open Project from the Project menu and select
Measure.UV2 in the folder ...\ARM\...\Examples\Measure.

The Files page in the Project Workspace shows the source files that compose
the MEASURE project. The three application related source files that are located in
the Source Files group. The function of the source files is described below. To open
a source file, double-click on the filename.

Unmanned Automated Railway Gate Controller

Measures: contains the main C function for the measurement system and
the interrupt routine for timer 0. The main function initializes all peripherals of
the ARM and performs command processing for the system. The timer
interrupt routine, timer0, manages the real-time clock and the measurement
sampling of the system.
MCommand.C: processes the display, time, and interval commands. These
functions are called from main. The display command lists the analog values
in floating-point format to give a voltage between 0.00V and 5.00V.
GetLine.C: contains the command-line editor for characters received from
the serial port.
IRQ.S: is an interface module for the interrupt service routine.

Compiling and Linking Measure


Home Example Programs Measure: A Remote Measurement System
Compiling and Linking Measure
When you are ready to compile and link the MEASURE project, use the Build
Target command from the Project menu or the toolbar. Vision3 begins to compile
and link the source files in MEASURE and displays a message when the build is
finished.
Once the project is built, you are ready to browse the symbol information or
begin testing.

Testing Measure
Home Example Programs Measure: A Remote Measurement System Testing
Measure

Unmanned Automated Railway Gate Controller


The MEASURE sample program is designed to accept commands from the onchip serial port. If you have actual target hardware, you can use a terminal
simulation to communicate with the ARM CPU. If you do not have target hardware,
you can use Vision3 to simulate the hardware. You can also use the serial window in
Vision3 to provide serial input.
Once the MEASURE program is build, you can test it. Use the Start/Stop Debug
Session command from the Debug menu to start the Vision3 debugger.

Remote Measurement System Commands


The serial commands that MEASURE supports are listed in the following table.
These commands are composed of ASCII text characters.
CommandSerial Text
Description
Clear
C
Clears the measurement record buffer.
Display
D
Displays the current time and input values.
T
Time
Sets the current time in 24-hour format.
hh:mm:ss
Sets the interval time for the measurement samples. The
Interval
I mm:ss.ttt interval time must be between 0:00.001 (for 1ms) and
60:00.000 (for 60 minutes).
Starts the measurement recording. After receiving the start
Start
S
command, MEASURE samples all data inputs at the specified
interval.
Displays the recorded measurements. You may specify the
number of most recent samples to display with the read
command. If no count is specified, the read command
Read
R [count]
transmits all recorded measurements. You can read
measurements on the fly if the interval time is more than 1
second. Otherwise, the recording must be stopped.
Quit
Q
Quits the measurement recording.

View Program Code


Home Example Programs Measure: A Remote Measurement System View
Program Code
Vision3 lets you view the program code in the Disassembly Window that
opens with the View menu or the toolbar button. The Disassembly Window shows
intermixed source and assembly lines. You may change the view mode or use other
commands from the local menu that opens with the right mouse button.

Unmanned Automated Railway Gate Controller

View Memory Contents


Home Example Programs Measure: A Remote Measurement System View
Memory Contents
Vision3 displays memory in various formats. The Memory Window opens via
the View menu or the toolbar button. You can enter the address of four different
memory areas in the pages. The local menu allows you to modify the memory
contents or select different output formats.

Unmanned Automated Railway Gate Controller

Program Execution
Home Example Programs Measure: A Remote Measurement System
Program Execution
Before you begin simulating MEASURE, open the Serial Window #1 that
displays the serial output with the View menu or the Debug toolbar. You may
disable other windows if your screen is not large enough.
You can use the Step toolbar buttons on assembler instructions or source
code lines. If the Disassembly Window is active, you single step at assembly
instruction basis. If an editor window with source code is active, you single step at
source code level.

Call Stack
Home Example Programs Measure: A Remote Measurement System Call
Stack
Vision3 internally tracks function nesting as the program executes. The Call
Stack page of the Watch Window shows the current function nesting. A double
click on a line displays the source code that called the selected function.

Breakpoints Dialog
Home Example Programs Measure: A Remote Measurement System
Breakpoints Dialog

Unmanned Automated Railway Gate Controller


Vision3 also supports complex breakpoints as discussed on page 109. You
may want to halt program execution when a variable contains a certain value. The
example shows how to stop when the value 3 is written to current.time.sec.
Open the Breakpoints dialog from the Debug menu. Enter as expression
current.time.sec==3. Select the Write check box (this option specifies that the
break condition is tested only when the expression is written to). Click on the Define
button to set the breakpoint.
To test the breakpoint condition perform the following steps:
Symbol

Description
Reset CPU.
If program execution is halted begin executing the MEASURE program.

After a few seconds, Vision3 halts execution. The program counter line in the debug
window marks the line in which the breakpoint occurred.

Using Peripheral Dialog Boxes


Vision3 provides dialogs for: I/O Ports, Interrupts, Timers, A/D Converter, Serial
Ports, and chip-specific peripherals. These dialogs can be opened from the Debug
menu. For the MEASURE application you may open I/O Ports:Port2 and A/D
Converter.
Each of these dialogs lists the related SFR symbols and shows the current
status of the peripherals. To change the inputs, change the values of the Pins or
Analog Input Channels.

Using VTREG Symbols


In the Command page of the Output Window, you may make
assignments to the VTREG symbols just like variables and registers. For
example:
PORT2=0xDA00 set digital input PORT2 to 0xDA00.
AIN1=3.3 set analog input AIN1 to 3.3 volts.

Using User and Signal Functions


You may combine the use of VTREG symbols defined by the CPU driver and
Vision3 user and signal functions to create a sophisticated method of providing
external input to your target programs. The Analog Example shows a signal function
that provides input to AIN0.

Unmanned Automated Railway Gate Controller

9.CODING
Program written in C language
#include<stdio.h>
#include<reg51.h>
void delay(into);
void medley(void);
sit sen1=P1^0;
sit sen2=P1^1;
sit buzz=P1^3;
sit sig1=P1^4;
sit sig2=P1^5;
sit laser=P1 ^6;
void close();
void open();
void buzzer();
into m=10000;
void main()
{
P0=P2=P3=0x00;
P1=0xff;
buzzer();
sig1=0x00; //train stop/road go
sig2=0x01;
open();
for(;;)
{
if(sen1==0x00)
{
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
medley();
while(sen2==0x01){}
while(sen2==0x00){}
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
}
if(sen2==0x00)
{
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
medley();
while(sen1==0x01){}

Unmanned Automated Railway Gate Controller


while(sen1==0x00){}
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
}
}
}
void medley(void)
{
into l=0;
for(l=0;l<=200;l++)
{
TMOD=0x10;
TL1=0xfe;
TH1=0xa5;
TR1=1;
while(TF1==0)
{
if(laser==0x00)
{
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
while(laser==0x00){}
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
}
}
TR1=0;
TF1=0;
}
}
void buzzer()
{
into y;
for(y=0;y<=8;y++)
{
buzz=0x01;deley(15000);
buzz=0x00;deley(15000);
}
}
void open()
{
P2=0x11;deley(m);

Unmanned Automated Railway Gate Controller


P2=0x33;deley(m);
P2=0x22;deley(m);
P2=0x66;deley(m);
P2=0x44;deley(m);
P2=0xcc;deley(m);
P2=0x88;deley(m);
P2=0x99;deley(m);
P2=0x11;deley(m);
P2=0x33;deley(m);
P2=0x22;deley(m);
P2=0x66;deley(m);
P2=0x44;deley(m);
P2=0xcc;deley(m);
P2=0x88;deley(m);
P2=0x99;deley(m);
}
void close()
{
P2=0x99;deley(m);
P2=0x88;deley(m);
P2=0xcc;deley(m);
P2=0x44;deley(m);
P2=0x66;deley(m);
P2=0x22;deley(m);
P2=0x33;deley(m);
P2=0x11;deley(m);
P2=0x99;deley(m);
P2=0x88;deley(m);
P2=0xcc;deley(m);
P2=0x44;deley(m);
P2=0x66;deley(m);
P2=0x22;deley(m);
P2=0x33;deley(m);
P2=0x11;deley(m);
}
void delay(k)
{
into i=0;
for(i=0;i<=kid++){}
}

Unmanned Automated Railway Gate Controller

PROGRAM HEX CODE:


:04022E00020C271087
:10014B00E4F5B0F5A0F5807590FF1201E4C294D2EE
:10015B009512008F2090191201E01200ED120199F7
:10016B002091FD3091FDC294D2951201E412008FC3
:10017B002091E11201E01200ED1201992090FD3067
:0E018B0090FDC294D2951201E412008F80C63E
:10019900E4F508F509F508F509758910758BFE75FB
:1001A9008DA5D28E208F182096FAC294D29512016D
:1001B900E412008F3096FD1201E01200ED80E5C2D5
:1001C9008EC28F0509E50970020508D394C8E508B0
:0601D9006480948040C325
:0101DF0022FD
:0401E000D294C2955E
:1001E400E4F50AF50BD2937F987E3A120216C29375
:1001F4007F987E3A120216050BE50B7002050AD3AE
:0A0204009408E50A6480948040DB52
:01020E0022CD
:10008F0075A01112021212020F75A0221202127520
:10009F00A06612021275A04412021275A0CC1202B1
:1000AF001275A08812021275A09912021275A01172
:1000BF0012021212020F75A02212021275A06612FE
:1000CF00021275A04412021275A0CC12021275A072
:0E00DF008812021275A099AF0DAE0C02021627
:1000ED0075A09912021275A08812021275A0CC1279
:1000FD00021275A04412021275A06612021275A0AA
:10010D002212021212020F75A01112021275A0997D
:10011D0012021275A08812021275A0CC120212756D
:10012D00A04412021275A06612021275A0221202CC
:0E013D001212020F75A011AF0DAE0C020216C9
:07020F0075A033AF0DAE0C2A
:10021600E4FDFCD3ED9FEE6480F8EC648098500713
:070226000DBD00010C80EC8E
:01022D0022AE
:03000000020003F8
:0C000300787FE4F6D8FD75810D02004AFC
:10000F0002014BE493A3F8E493A34003F68001F2BB
:10001F0008DFF48029E493A3F85407240CC8C333F2
:10002F00C4540F4420C8834004F456800146F6DFC1
:10003F00E4800B010204081020408090022EE47E21
:10004F00019360BCA3FF543F30E509541FFEE493B6
:10005F00A360010ECF54C025E060A840B8E493A37D
:10006F00FAE493A3F8E493A3C8C582C8CAC583CAA8
:10007F00F0A3C8C582C8CAC583CADFE9DEE780BE60
:0102320000CB
:00000001FF

Unmanned Automated Railway Gate Controller

10. CONCLUSIONS :

Hence the Unmanned railway gates operate according to the data input from
sensors to microcontroller. First an alarm is triggered and then the gate is operated.
Specifications:

Mechanical gate arrangement


Atmel 89C51 an 8051 family microcontroller
SN7404 for microcontroller interfacing.
IR sensors for sensing train
Stepper motor to operate gates
ULN 2803 for driving Stepper motor

Unmanned Automated Railway Gate Controller

11. BIBLIOGRAPHY
Name of the sites:
1. www.mitel.databook.com
2. www.atmel.databook.com
3. www.franklin.com
4. www.keil.com

References:

www.8052.com/tutorial.phtml
8051 microcontroller by Kenneth J. Ayala
www.electronicsforu.com/electronicsforu/articles/hits.asp?id=1431

Programming Embedded Systems: With C and GNU Development Tools


by Michael Barr
Basic electronics By: GROB
Practical transistor circuit design and analysis By: GERALD E. WILLIAMS
Sensor - Electronic circuit guide book Volume 1 By: JOSEPH J.CARR
Programming and Customizing the 8051 Micro-controller By: Mike Prado
The concepts and Features of Micro-controllers - By: Raj Kamala
The 8051 Micro-controller Architecture, programming & Applications
By: Kenneth J. Ayala
CMOS/TTL IC Data Manuals

You might also like