Vous êtes sur la page 1sur 74

AUTOMATIC MOBILE PLATFORM FOR

PHYSICALLY CHALLENGED PEOPLE IN RAILWAY


JUNCTION
A PROJECT REPORT
Submitted by

R.SIVARAMA KRISHNAN

Reg.No:921712107087

P.VELKUMAR

Reg.No:921712107099

A.MOHAMMED AAJIPKHAN

Reg.No:921712107063

in partial fulfillment for the award of the degree


of

BACHELOR OF ENGINEERING
in
ELECTRONICS AND INSTRUMENTATION ENGINEERING

SETHU INSTITUTE OF TECHNOLOGY, VIRUDHUNAGAR

ANNA UNIVERSITY:: CHENNAI 600 025


MARCH 2016
0

ANNA UNIVERSITY:: CHENNAI 600 025


BONAFIDE CERTIFICATE
Certified that this project report entitled AUTOMATIC MOBILE
PLATFORM

FOR

PHYSICALLY

CHALLENGED

PEOPLE

IN

RAILWAY JUNCTION is the bonafide work of R.SIVARAMA


KRISHNAN

(921712107087),

P.VELKUMAR

(921712107099),

A.MOHAMMED AAJIPKHAN (921712107063) who carried out the project


work under my supervision.

SIGNATURE

SIGNATURE

Dr. K. HEMALATHA, M.E.,Ph.D., Mr. V. DHAYANITHI, B.E (M.E).,


HEAD OF THE DEPARTMENT

ASSISTANT PROFESSOR

DEPARTMENT OF

DEPARTMENT OF

ELECTRONICS & INSTRUMENTATION ELECTRONICS & INSTRUMENTATION


ENGINEERING

ENGINEERING

SETHU INSTITUTE OF TECHNOLOGY

SETHU INSTITUTE OF TECHNOLOGY

KARIAPATTI 626 115

KARIAPATTI 626 115

Submitted for the University Examination held on

INTERNAL EXAMINER

EXTERNAL EXAMINER

ACKNOWLEDGEMENT
Apart from my efforts, the success of this project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express
my gratitude to the people who have helped me in this project.
I offer praises to the almighty, without whose grace my dream would not
have come true. I thank my beloved parents for their blessings persistent help
and support to do this project.
We wish to express our earned great fullness to our honourable founder
and chairman, Mr.S.MOHAMMED JALEEL, B.SC., B.L., for his
encouragement extended to us to undertake this project work.
We would like to thank and express our gratitude to our principal,
Dr.A.SENTHIL KUMAR, B.E., M.E., Ph.D., for providing all necessary
facilities for the completion of the project.
We would like to express profusely our deep sense of gratitude to our
head of the department, Dr.K.HEMALATHA,M.E., Ph.D., who extended her
heartiest encouragement, advice and valuable guidance throughout the project.
We immensely gratefull to our guide, supervisor and overseer
Mr.V.DHAYANITHI, B.E., M.E., Assistant Professor (Senior), for
throughout the course of the project.
We render our sincere thanks for this great support in completing this
project successfully. We thank our parents, faculty members, supporting
staff and friends for their help extended during this times.

ABSTRACT
The problem to transfer handicapped or old people is as old as the
transportation system itself. Earlier and even now they are transferred by many
methods like on wheelchairs or with the help of sticks. But all these methods are
time consuming and slow and also dont have any provision for carrying the
luggage. These methods are good in general use, but on platforms these cannot
be used as these methods will complicate the transportation and will disrupt the
free movement of the people on platforms.
So here our aim is to design a system or device which will be able to
transfer the handicapped people from one platform to another, within the given
constraints and should also comply with the societies exiting conditions. The
system may be semi-manually driven or semi-automatic or may be fully
automatic.

TABLE OF
CHAPTER NO

CONTENT

TITLE

PAGE.NO

ABSTRACT
LIST OF FIGURES
LIST OF ABRREVATION
LIST OF TABLES
1

INTRODUCTION
1.1 Overview of project

11

ABOUT EMBEDDED SYSTEM


2.1 Introduction to embedded system

13

2.2 Peripherals

14

2.3 Application areas for embedded system

14

2.4 Flash memory

14

BLOCK DIAGRAM AND ITS EXPLANATION


3.1 Introduction to ATMEGA
3.1.1 Features

19

3.1.2 Pin configuration

21

3.1.3 Overview

21

3.1.4 Block diagram

22

3.1.5 Pin description

24

3.2 AVR CPU core

3.2.1 Introduction

26

3.2.2 Architectural overview

26

CIRCUIT DIAGRAM
4.1 Monitoring unit

32

4.2 Control unit

33

AVR SYNTHESIS
5.1 AVR Synthesis tool

LITERATURE SURVEY
6.1 Review of literature

34

37

SENSORS AND EQUIPMENTS


7.1 Infrared (IR) proximity sensor

40

7.1.1 Overview

40

7.1.2 Object detection using IR light

41

7.1.3 Components positioning

42

7.2 Power supply circuit

43

7.3 UART
7.3.1 Block diagram

44

7.3.2 Circuit diagram

44

7.3.3 Features

45

7.4 MAX 232


7.4.1 RS 232

47

7.5 Light Emitting Diode(LED)


7.5.1 Function

47

7.5.2 Testing an LED

48

7.5.3 Colours of LEDs

48

7.5.4 Calculating LED resistor


value

49

7.5.5 Technical data for LEDs

50

7.5.6 Flashing LEDs

51

7.5.7 LED Display

52

7.5.8 Pin connection of LED


displays

52

7.6 L293D
7.6.1 Features

53

7.6.2 Pin diagram and description

53

7.7 Gear motor


7.7.1 Operation principle

55

7.7.2 Speed reduction

56

7.7.3 Torque multiplication

56

7.7.4 Motor varieties

56

7.7.5 Applications

56

OUTPUT

58

CONCLUSION AND FUTURE SCOPE


9.1 Conclusion

64

9.2 Future scope

64

REFERENCE
APPENDIX

LIST OF FIGURES
FIGURE NO

FIGURE

PAGE NO

2.4

Flash memory

14

3.1.2

Pin configuration ATMEGA 8

21

3.1.4

Block diagram ATMEGA 8

22

3.2.2

Architectural overview of AVR CPU

26

4.1

Monitoring unit

32

4.2

Control unit

33

5.1

AVR studio

34

7.1.1

Overview of IR sensor

40

7.1.5

Components positioning of IR sensor

42

7.2

Power supply circuit

43

7.3

Circuit diagram of UART

44

7.4

Pin diagram of MAX 232

47

7.5.3

Colour of LEDs

48

7.5.8

LED Displays

52

7.6.2

Pin diagram of L293D

53

7.7

Gear motor

55

LIST OF ABBRVIATIONS
SL NO

WORD

ABBREVIATIONS

LED

LIGHT EMITTING DIODE

LCD

LIQUID CRYSTAL DISPLAY

UART

UNIVERSAL ASYNCHRONUS
RECEIVER TRANSMITTER

USART

UNIVERSAL SYNCHRONOUS
AND ASYNCHRONUS
RECEIVER TRANSMITTER

AVR

ADVANCE VIRTUAL RISC

PE

PARRITY ERROR

MPCM

MULTIPROCESSOR
COMMUNICATION MODE

DOR

DATA OVER RUN

SCI

SERIAL COMMUNICATION
INTERFACE

10

USB

UNIVERSAL SERIAL BUS

LIST OF TABLES
TABLE NO
7.5.5

CONTENTS OF TABLE
Technical data for LEDs

10

PAGE NO
50

CHAPTER 1
INTRODUCTION
1.1 OVERVIEW OF PROJECT
In Railway stations, the problem is to transfer handicapped or old people
is as old as the transportation system itself. Earlier and even now they are
transferred by many methods like on wheelchairs or with the help of
sticks. But all these methods are time consuming and slow and also dont
have any provision for carrying the luggage. These methods are good in
general use, but on platforms these cannot be used as these methods will
complicate the transportation and will disrupt the free movement of the
people on platforms.
So here our aim is to design a system or device which will be able to
transfer the handicapped people from one platform to another, within the
given constraints and should also comply with the societies exiting
conditions. The system may be semi-manually driven or semi-automatic
or may be fully automatic.
Here first of all we are defining the Statement of the problem, followed
by the analyzation of the need and then we have given various
alternatives we have thought off, following it is the description of
different alternatives with the problems we are facing in the practical
application of the alternatives.
The alternatives thus produced has been evaluated and the best one was
chosen. Then, morphological analysis, is done on the chosen alternative,
thus giving the final design and specification.
This project is used for automatically close or open the mobile platforms
in between the track trains with Escalator unit. Normally the mobile
11

platform connects the two platforms through which the passenger can
walk on the platform to reach on the next platform on the two sides of
track.
If the train reaches one sensor the mobile platform will automatically
close and allows the train to go through the tracks and then when the train
leaves the second sensor the mobile platform will automatically open the
bridging platforms.
The microcontroller will sense the presence of train by using infrared
sensor. so on sensing the train on one path controller will give pulses to
the movable platform motors to close the mobile platform automatically.

12

CHAPTER 2
ABOUT EMBEDDED SYSTEM
2.1 INTRODUCTION TO EMBEDDED SYSTEM
An embedded system is a special-purpose computer system designed to
perform one or a few dedicated functions, often with real-time computing
constraints. It is usually embedded as part of a complete device including
hardware and mechanical parts. In contrast, a general-purpose computer, such as
a personal computer, can do many different tasks depending on programming.
Embedded systems have become very important today as they control many of
the common devices we use.
Since the embedded system is dedicated to specific tasks, design
engineers can optimize it, reducing the size and cost of the product, or
increasing the reliability and performance. Some embedded systems are massproduced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights,
factory controllers, or the systems controlling nuclear power plants. Complexity
varies from low, with a single microcontroller chip, to very high with multiple
units, peripherals and networks mounted inside a large chassis or enclosure.
In general, "embedded system" is not an exactly defined term, as many
systems have some element of programmability. For example, Handheld
computers share some elements with embedded systems such as the operating
systems and microprocessors which power them but are not truly embedded
systems, because they allow different applications to be loaded and peripherals
to be connected.
13

2.2 PERIPHERALS
Embedded Systems talk with the outside world via peripherals, such as:

Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc

Synchronous Serial Communication Interface: I2C, JTAG, SPI, SSC and


ESSI

Universal Serial Bus (USB)

Networks: Ethernet, Controller Area Network, Lon Works, etc

Timers: PLL(s), Capture/Compare and Time Processing Units

Discrete IO: General Purpose Input/Output (GPIO)

Analog to Digital/Digital to Analog (ADC/DAC)

2.3 APPLICATION AREAS FOR EMBEDDED SYSTEM


Embedded software is present in almost every electronic Device.
Embedded software is present inside your watch, cellular phone
Automobile,
Thermostats, Industrial Control Equipment and Scientific and Medical
Equipment.
Defense Services use embedded software to guide Missiles and Detect
Enemy Aircraft.
Communication Satellites, Medical Instruments and Deep Space Probes
would have been nearly impossible without these systems.

2.4 FLASH MEMORY


Flash Memory Overview
Computerized systems, from simple appliances to complex networks,
contain many different parts for example processors, displays, software, drives,
14

keyboards and mouse, printed circuit boards, switches, modems, and, of course,
memory.

More specifically flash Memory is capable of retaining digital information


under certain conditions. This retained material might be operational code or
data files or a combination of the two. The ideal memory subsystem optimizes
density, preserves critical material in a nonvolatile condition, is easy to program
and re-program, can be read fast, and is cost-effective for the application. Some
memory technologies meet one or more of these requirements very well, but
offsetting limitations can prevent the product from becoming a genuine
solution, especially in newer application.

Working
Flash memory is a nonvolatile memory . which allows the user to
electrically program and erase information. Flash memory uses memory cells
similar to an EPROM, but with a much thinner, precisely grown oxide between
the floating gate and the source (fig below). Flash programming occurs when
electrons are placed on the floating gate. The charge is stored on the floating
gate, with the oxide layer allowing the cell to be electrically erased through the

15

source. Intel Flash memory is an extremely reliable nonvolatile memory


architecture.

Multi-level cell flash memory is suited for high-density applications.


Programming and Erasing the Flash Memory
Programming Flash memory is most commonly done in a byte or word wide
mode; however, several devices provide 32-byte write buffers. These buffers
allow data to be queued in advance for up to 2 s effective byte programming
speeds. Erase of the flash device is done through a Block Erase(Only possible in
Flash Memory ) command, and the completion time is dependent upon the
block size and technology. Functions, such as program-suspend, programresume, erase-suspend, and erase-resume, allow the device to pause and read
data, then resume the previous operation. multi-partition architecture allows the
system processor to read from one partition while completing a write/erase in
the other partition. For example, this permits executing code and programming
data from the same flash device at the same time.
Advantages
Low cost , high density, high speed ,low power and high reliability.
16

End Product Applications


Flash memory finds

lot of applications in consumer as well as industrial

application some of

them are mentioned below are popular hand-held

Electronic device
1.Removable Storage
2.Cell Phones
3.MP3 Players
4.Digital Still Camera

17

CHAPTER 3
BLOCK DIAGRAM AND ITS EXPLANATION

In our project we use two AVR microcontroller, one is for monitoring


and another one is for controlling. In monitoring unit, IR sensors are used to
sense the metal product . we use this sensors to detect the position of the train.
we use four sensors for safety purpose to avoid mechanical problem. The sensor
gives two output. If train is near to platform, else far away from platform. In
control unit, we use gear motors, voice announcement and signal leds. Gear
motors are used to move the mobile platform. If train comes near to platform,
The IR sensor sense the train position and gives its output to AVR micro
controller. It has already have a programed structure in it which helps to
execute. The output of micro controller is given to Speaker to give an alert to
the people move quickly. After that the mobile platform starts to move inside
18

the platform step by step. And gives way to train to stay in platform. If the train
is far away from the platform then the sensor sends the signal to AVR micro
controller and that AVR micro controllers output is given to speaker and mobile
platform comes outside the platform for transferring the peoples.
These two controllers are communicated through the RS232 protocol
using MAX 232 IC.

3.1 INTRODUCTION TO ATMEGA


3.1.1Features
High-performance, Low-power AVR 8-bit Microcontroller
Advanced RISC Architecture
130 Powerful Instructions Most Single-clock Cycle Execution
32 x 8 General Purpose Working Registers
Fully Static Operation
Up to 16 MIPS Throughput at 16 MHz
On-chip 2-cycle Multiplier
Nonvolatile Program and Data Memories
8K Bytes of In-System Self-Programmable Flash
Endurance: 10,000 Write/Erase Cycles
Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
512 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
1K Byte Internal SRAM
Programming Lock for Software Security
Peripheral Features
Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
19

One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and


Capture Mode
Real Time Counter with Separate Oscillator
Three PWM Channels
8-channel ADC in TQFP and MLF package
Eight Channels 10-bit Accuracy
6-channel ADC in PDIP package
Eight Channels 10-bit Accuracy
Byte-oriented Two-wire Serial Interface
Programmable Serial USART
Master/Slave SPI Serial Interface
Programmable Watchdog Timer with Separate On-chip Oscillator
On-chip Analog Comparator
Special Microcontroller Features
Power-on Reset and Programmable Brown-out Detection
Internal Calibrated RC Oscillator
External and Internal Interrupt Sources
Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down,
and Standby
I/O and Packages
23 Programmable I/O Lines
28-lead PDIP, 32-lead TQFP, and 32-pad MLF
Operating Voltages
2.7 - 5.5V (ATmega8L)
4.5 - 5.5V (ATmega8)
Speed Grades
0 - 8 MHz (ATmega8L)
0 - 16 MHz (ATmega8)
Power Consumption at 4 Mhz, 3V, 25C
20

Active: 3.6 mA
Idle Mode: 1.0 mA
Power-down Mode: 0.5 A

3.1.2 PIN CONFIGURATION

3.1.3 Overview
The ATmega8 is a low-power CMOS 8-bit microcontroller based on the
AVR RISC architecture. By executing powerful instructions in a single clock
cycle, the ATmega8 achieves throughputs approaching 1 MIPS per MHz,

21

allowing the system designer to optimize power consumption versus processing


speed.
3.1.4 Block Diagram

22

The AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic
Logic Unit (ALU), allowing two independent registers to be accessed in one
single instruction executed in one clock cycle. The resulting architecture is more
code efficient while achieving throughputs up to ten times faster than
conventional CISC microcontrollers.
The ATmega8 provides the following features: 8K bytes of In-System
Programmable Flash with Read-While-Write capabilities, 512 bytes of
EEPROM, 1K byte of SRAM, 23 general purpose I/O lines, 32 general purpose
working registers, three flexible Timer/Counters with compare modes, internal
and external interrupts, a serial programmable USART, a byte oriented Twowire Serial Interface, a 6-channel ADC (eight channels in TQFP and MLF
packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal
Oscillator, an SPI serial port, and five software selectable power saving modes.
The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, SPI
port, and interrupt system to continue functioning. The Power-down mode saves
the register contents but freezes the Oscillator, disabling all other chip functions
until the next Interrupt or Hardware Reset. In Power-save mode, the
asynchronous timer continues to run, allowing the user to maintain a timer base
while the rest of the device is sleeping. The ADC Noise Reduction mode stops
the CPU and all I/O modules except asynchronous timer and ADC, to minimize
switching

noise

during

ADC

conversions.

In

Standby

mode,

the

crystal/resonator Oscillator is running while the rest of the device is sleeping.


This allows very fast start-up combined with low-power consumption. The
device is manufactured using Atmels high density non-volatile memory
technology. The Flash Program memory can be reprogrammed In-System
through an SPI serial interface, by a conventional non-volatile memory
programmer, or by an On-chip boot program running on the AVR core. The
boot program can use any interface to download the application program in the
23

Application Flash memory. Software in the Boot Flash Section will continue to
run while the Application Flash Section is updated, providing true Read-WhileWrite operation. By combining an 8-bit RISC CPU with In-System SelfProgrammable Flash on a monolithic chip, the Atmel ATmega8 is a powerful
microcontroller that provides a highly-flexible and cost-effective solution to
many embedded control applications. The ATmega8 AVR is supported with a
full suite of program and system development tools, including C compilers,
macro assemblers, program debugger/simulators, In-Circuit Emulators, and
evaluation kits.

3.1.5 Pin Descriptions

VCC Digital supply voltage.


GND Ground.
Port B (PB7..PB0)
XTAL1/XTAL2/TOSC1/TOSC2
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port B output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port B pins that are
externally pulled low will source current if the pull-up resistors are activated.
The Port B pins are tri-stated when a reset condition becomes active, even if the
clock is not running. Depending on the clock selection fuse settings, PB6 can be
used as input to the inverting Oscillator amplifier and input to the internal clock
operating circuit. Depending on the clock selection fuse settings, PB7 can be
used as output from the inverting Oscillator amplifier. If the Internal Calibrated
RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for
the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. The various
special features of Port B are elaborated in Alternate Functions of Port B
and System Clock and Clock Options.
24

Port C (PC5..PC0) Port C is an 7-bit bi-directional I/O port with internal pullup resistors (selected for each bit). The Port C output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port C
pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port C pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
PC6/RESET If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin.
Note that the electrical characteristics of PC6 differ from those of the other pins
of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset
input. A low level on this pin for longer than the minimum pulse length will
generate a Reset, even if the clock is not running. Shorter pulses are not
guaranteed to generate a Reset.
Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pullup resistors (selected for each bit). The Port D output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port D
pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
RESET Reset input. A low level on this pin for longer than the minimum pulse
length will generate a reset, even if the clock is not running. Shorter pulses are
not guaranteed to generate a reset.
AVCC AVCC is the supply voltage pin for the A/D Converter, Port C (3..0),
and ADC (7..6). Itshould be externally connected to VCC, even if the ADC is
not used. If the ADC is used,it should be connected to VCC through a low-pass
filter. Note that Port C (5..4) use digitalsupply voltage, VCC.
AREF AREF is the analog reference pin for the A/D Converter.
ADC7..6 (TQFP and MLF Package Only)

25

In the TQFP and MLF package, ADC7..6 serve as analog inputs to the A/D
converter. These pins are powered from the analog supply and serve as 10-bit
ADC channels.

3.2 AVR CPU Core


3.2.1 Introduction
The main function of the CPU core is to ensure correct program
execution. The CPU must therefore be able to access memories, perform
calculations, control peripherals, and handle interrupts.

3.2.2Architectural Overview

In order to maximize performance and parallelism, the AVR uses a


Harvard architecture with separate memories and buses for program and data.
Instructions in the Program memory are executed with a single level pipelining.
While one instruction is being executed, the next instruction is pre-fetched from
26

the Program memory. This concept enables instructions to be executed in every


clock cycle. The Program memory is In System Reprogrammable Flash
memory. The fast-access Register File contains 32 x 8-bit general purpose
working registers with a single clock cycle access time. This allows single-cycle
Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, two
operands are output from the Register File, the operation is executed, and the
result is stored back in the Register File in one clock cycle.
Six of the 32 registers can be used as three 16-bit indirect address register
pointers for Data Space addressing enabling efficient address calculations.
One of the these address pointers can also be used as an address pointer for look
up tables in Flash Program memory. These added function registers are the 16bit X-, Y-, and Z-register, described later in this section. The ALU supports
arithmetic and logic operations between registers or between a constant and a
register. Single register operations can also be executed in the ALU. After an
arithmetic operation, the Status Register is updated to reflect information about
theresult of the operation. The Program flow is provided by conditional and
unconditional jump and call instructions, able to directly address the whole
address space. Most AVR instructions have a single 16-bit word format. Every
Program memory address contains a 16- or 32-bit instruction. Program Flash
memory space is divided in two sections, the Boot program section and the
Application program section. Both sections have dedicated Lock Bits for write
and read/write protection. The SPM instruction that writes into the Application
Flash memory section must reside in the Boot program section. During
interrupts and subroutine calls, the return address Program Counter (PC) is
stored on the Stack. The Stack is effectively allocated in the general data
SRAM, and consequently the Stack size is only limited by the total SRAM size
and the usage of the SRAM. All user programs must initialize the SP in the reset
routine (before subroutines or interrupts are executed). The Stack Pointer SP is

27

read/write accessible in the I/O space. The data SRAM can easily be accessed
through the five different addressing modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory
maps. A flexible interrupt module has its control registers in the I/O space with
an additional global interrupt enable bit in the Status Register. All interrupts
have a separate Interrupt Vector in the Interrupt Vector table. The interrupts
have priority in accordance with their Interrupt Vector position. The lower the
Interrupt Vector address, the higher the priority. The I/O memory space contains
64 addresses for CPU peripheral functions as Control Registers, SPI, and other
I/O functions. The I/O Memory can be accessed directly, or as the Data Space
locations following those of the Register File, 0x20 - 0x5F.
Arithmetic Logic Unit ALU
The high-performance AVR ALU operates in direct connection with all
the 32 general purpose working registers. Within a single clock cycle, arithmetic
operations between general purpose registers or between a register and an
immediate are executed. The ALU operations are divided into three main
categories arithmetic, logical, and bit-functions. Some implementations of the
architecture also provide a powerful multiplier supporting both signed/unsigned
multiplication and fractional format.

Status Register
The Status Register contains information about the result of the most
recently executed arithmetic instruction. This information can be used for
altering program flow in order to perform conditional operations. Note that the
Status Register is updated after all ALU operations, as specified in the
Instruction Set Reference. This will in many cases remove the need for using
the dedicated compare instructions, resulting in faster and more compact code.

28

The Status Register is not automatically stored when entering an interrupt


routine and restored when returning from an interrupt. This must be handled by
software.
The AVR Status Register SREG is defined as:
Bit 7 I: Global Interrupt Enable
The Global Interrupt Enable bit must be set for the interrupts to be enabled. The
individual interrupt enable control is then performed in separate control
registers. If the Global Interrupt Enable Register is cleared, none of the
interrupts are enabled independent of the individual interrupt enable settings.
The I-bit is cleared by hardware after an interrupt has occurred, and is set by the
RETI instruction to enable subsequent interrupts. The Ibit can also be set and
cleared by the application with the SEI and CLI instructions.
Bit 6 T: Bit Copy Storage
The Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit
as source or destination for the operated bit. A bit from a register in the Register
File can be copied into T by the BST instruction, and a bit in T can be copied
into a bit in a register in the Register File by the BLD instruction.
Bit 5 H: Half Carry Flag
The Half Carry Flag H indicates a Half Carry in some arithmetic operations.
Half Carry is useful in BCD arithmetic.
Bit 4 S: Sign Bit, S = N V
The S-bit is always an exclusive or between the Negative Flag N and the Twos
Complement Overflow Flag V.
Bit 3 V: Twos Complement Overflow Flag
The Twos Complement Overflow Flag V supports twos complement
arithmetics.
Bit 2 N: Negative Flag
The Negative Flag N indicates a negative result in an arithmetic or logic
operation.
29

Bit 1 Z: Zero FlagThe Zero Flag Z indicates a zero result in an arithmetic or


logic operation.
Bit 0 C: Carry Flag
The Carry Flag C indicates a Carry in an arithmetic or logic operation.

3.4 Analog-to-Digital Converter


Features
10-bit Resolution
0.5 LSB Integral Non-linearity
2 LSB Absolute Accuracy
13 - 260 s Conversion Time
Up to 15 kSPS at Maximum Resolution
6 Multiplexed Single Ended Input Channels
2 Additional Multiplexed Single Ended Input Channels (TQFP and MLF
Package only)
Optional Left Adjustment for ADC Result Readout
0 - VCC ADC Input Voltage Range
Selectable 2.56V ADC Reference Voltage
Free Running or Single Conversion Mode
Interrupt on ADC Conversion Complete
Sleep Mode Noise Canceler
The ATmega8 features a 10-bit successive approximation ADC. The
ADC is connected to an 8-channel Analog Multiplexer which allows eight
single-ended voltage inputs constructed from the pins of Port C. The singleended voltage inputs refer to 0V (GND). The ADC contains a Sample and Hold
circuit which ensures that the input voltage to the ADC is held at a constant
level during conversion. The ADC has a separate analog supply voltage pin,
AVCC. AVCC must not differ more than 0.3V from VCC. Internal reference
30

voltages of nominally 2.56V or AVCC are provided On-chip. The voltage


reference may be externally decoupled at the AREF pin by a capacitor for better
noise performance.

31

CHAPTER 4
CIRCUIT DIAGRAM
4.1 Monitoring unit

In this ciruit, the four IR sensors are connected to PORTC (PC0-PC3)


gives input to the controller and the output of the controller PORTD (PD0-PD1)
are connected to MAX-232 IC used for transmitting the signal to another
controller.
32

4.2 Control unit

In this circuit, L293D IC is used for connecting two motors


simultaneously. This IC is connected to PORTB(PB1-PB4) for moving the
platform and one motor is directly connected to PORTB(PB0) for escalator
setup. PORTD are connected to MAX-232 IC for receiving the input signal
from the above unit and the output is connected to the motors.

33

CHAPTER 5
AVR SYNTHESIS TOOL
5.1 AVR Studio:
For writing an Assembly Level Programming we must have editor,
debugger and compiler to generate HEX files which will be downloaded into
the Chip through AVR ISP software.

To write the source code we use editor, while writing the source code to
check the syntax error simultaneously we use debugger finally the error free
source code is compiled to generate the HEX file.

34

AVR ISP:
The generated source code after compilation, it is transformed into HEX
file which will be fed into the Microcontroller using AVR ISP software byte by
byte till the end of HEX file through Parallel port.

Terminal Window:
The following windows shows the screen shot of the Terminal window used to
perform serial communication between the processors.

35

The user has to check the following points with respect to the setup.
1.check port settings to com1 or com2 depending upon the PC setup
2.setup baud rate to 9600 typically.
3.data bits is set to 8
4.parity bits is set to none
5.stop bits is set to one
6.handshaking is set to none.
7.press connect to start connecting to the com port of the PC.

36

CHAPTER 6
LITERATURE SURVEY

6.1 REVIEW OF LITERATURE:

1.Pradhantha.B.Y,Harisha.S:"Smart Railway crossing Embedded With


Automated Platform Bridge".(AUG 2015 )

37

2.Suderson.P,Ramkumar.S,Surendar.R,UdhayaShankar.T:"Artificial

Railway

Platform for Domestic Railway Station".( IRF International Conference MAR


2015).
The objective of their paper(Smart Railway crossing Embedded With
Automated Platform Bridge) deals with automatic railway gate opening at a
level crossing without human intervention. In the present work it is proposed to
substitute fully automated railway gate opening feature and as well as
automated platform bridge facility in the station which helps peoples to move
from flat form to flat form. Now a day all over the world accidents are common
because of lack of technology, human carelessness at right time. And these
accidental barriers cannot be completely avoidable but some fruitful steps
definitely reduced to some extent, in account of this the initiative steps is
required to avoid many humans death at any place and time by introducing new
technologies, this effort has been taken in this work by adopting automatic
railway gate opening without gate keeper near level crossing and automated
platform bridge. The above said system works on microcontroller based
technique and rack and pinion mechanism which is employed to operate
Platform Bridge .
The main aim of their project(Artificial Railway Platform for Domestic
Railway Station) is to automate railway track pedestrian crossing without use
staircase for platform users. In this system is also used to avoid train collision
problems. Because, now a days train accidents are occurring frequently in India.
The one of the main reason for train accident is the traveling of two trains in
same track in opposite direction. In order to avoid the accidents due to the above
reason we have designed this project. This project identifies the status of each
train using IR transceivers and informs it to microcontroller. If the sensor unit
identifies both train in same track means microcontroller automatically trip the
supply of the trains, which is more than sufficient to avoid this kind of accident.
38

This project is used to avoid the train collusion, thus we save the valuable
human lives and losses. So this project is useful for railway departments.
In the above projects they are using PIC controller for their process.But
in our process we are using AVR(Advance Virtual Risc) controller for the
operation.We use four IR sensors for detect the train and also we add some
additional features like Voice announcement,Gear motor for escallator unit and
signal LEDs.The platform users can know the arrival of the train by using the
voice announcement system automaticaly and our system is fully automated.

39

CHAPTER 7
SENSORS AND EQUIPMENTS
7.1 Infra-Red Proximity Sensor (I)
7.1.1Overview:
Based on a simple basic Idea, this proximity
sensor, is easy to build, easy to calibrate and
still, it provides a detection range of 35 cm
(range can change depending on the ambient
light

intensity).

This sensor can be used for most indoor


applications where no important ambient
light is present. For simplicity, this sensor
doesn't provide ambient light immunity, but
a more complicated, ambient light ignoring
sensor should be discussed in a coming
article. However, this sensor can be used to
measure the speed of object moving at a
very high speed, like in industry or in
tachometers. In such applications, ambient
light ignoring sensor, which rely on sending
40 Khz pulsed signals cannot be used
because there are time gaps between the
pulses where the sensor is 'blind'...
The solution proposed doesn't contain any special components, like photodiodes, photo-transistors, or IR receiver ICs, only a couple if IR leds, an Op
amp, a transistor and a couple of resistors. In need, as the title says, a standard
40

IR led is used for the purpose of detection. Due to that fact, the circuit is
extremely simple, and any novice electronics hobbyist can easily understand
and build it.
7.1.2 Object Detection using IR light:
It is the same principle in ALL Infra-Red proximity sensors. The basic idea is
to send infra red light through IR-LEDs, which is then reflected by any object in
front of the sensor.
Then all you have to do is to pick-up
the reflected IR light. For detecting
the reflected IR light, we are going
to use a very original technique: we
are going to use another IR-LED, to
detect the IR light that was emitted
from another led of the exact same
type!
This is an electrical property of Light
Emitting Diodes (LEDs) which is the
fact that a led Produce a voltage
difference across its leads when it is
subjected to light. As if it was a
photo-cell, but with much lower
output current. In other words, the
voltage generated by the leds can't be
- in any way - used to generate
electrical power from light, It can
barely be detected. that's why as you
will notice in the

41

schematic, we are going to use a Op-Amp (operational Amplifier) to accurately


detect very small voltage changes.
7.1.3 Components positioning:
The correct positioning of the sender LED, the receiver LED with regard to
each other and to the Op-Amp can also increase the performance of the sensor.
First, we need to adjust the position of the sender LED with respect to the
receiver LED, in such a way they are as near as possible to each others , while
preventing any IR light to be picked up by the receiver LED before it hit and
object and returns back. The easiest way to do that is to put the sender(s)
LED(s) from one side of the PCB, and the receiver LED from the other side, as
shown in the 3D model below.
This 3D model shows the position of
the LEDs. The green plate is the PCB
holding the electronic components of
the sensor. you can notice that the
receiver LED is positioned under the
PCB, this way, there wont be ambient
light falling directly on it, as ambient
light usually comes from the top.

It is also clear that this way of


positioning the LEDs prevent the
emitted IR light to be detected before
hitting an eventual obstacle.

Another important issue about components positioning, is the distance between


the receiver LED and the Op-Amp. which should be as small as possible.
Generally speaking, the length of wires or PCB tracks before an amplifier
42

should be reduced, otherwise, the amplifier will amplify - along with the
original signal - a lot of noise picked up form the electromagnetic waves
traveling the surrounding.
Here is an example PCB where the distance between
the LED and the Op-Amp is shown. Sure this
distance is not as critical as you may think, it can be
up to 35mm without causing serious problems, but
trying to reduce this distance will Always give you
better results.

7.2 Power supply circuit


In this power supply circuit we have to create a +5V DC which is given
to the micro controller. The below components are used to create the power
supply.

230V AC
supply

Step down
transformer

Bridge
rectifier

Filter

Regulator

Filter

Description:
230V AC supply is given to the step down transformer. It may be a 230V
to 9V or 12V step down transformer. The output of the step down transformer is
given to bridge rectifier. The bridge rectifier is formed with 1N4007 diodes. The
bridge rectifier converts the AC Voltage into DC Voltage. But the output DC
Voltage contains sone AC component (ripples). So we have to use a capacitor2200uF/25V as a filter for removing ripples. That output DC Voltage is given to
the positive voltage regulator 7805. The output will be the regulated +5V DC.
43

7.3 UART
7.3.1 Block diagram

Computer

UART
driver

Microcontroller

Atmel microcontroller features a full duplex (separate receive and transmit


registers) Universal Asynchronous Receiver and Transmitter (UART).
7.3.2 Circuit diagram

44

7.3.3 Features
The main features are:
Baud rate generator that can generate a large number of baud rates (bps)
High baud rates at low XTAL frequencies
8 or 9 bits data
Noise filtering and Overrun detection
Framing Error detection and False Start Bit detection
Three separate interrupts on TX Complete, TX Data Register Empty and
RX Complete
The alternative function of portd0, portd1 is UART. Portd0 is the receiver pin
and portd1 is the transmitter pin. Here we are using IC MAX232 as a UART
driver.

45

7.4 MAX -232:

46

7.4.1 RS 232:
Serial Communication:
In computing, a serial port is a serial communication physical interface
through which information transfers in or out one bit at a time (contrast parallel
port). Throughout most of the history of personal computers, data transfer
through serial ports connected the computer to devices such as terminals or
modems. Mice, keyboards, and other peripheral devices also connected in this
way. While such interfaces as Ethernet, FireWire, and USB all send data as a
serial stream, the term "serial port" usually identifies hardware more or less
compliant to the RS-232 standard, intended to interface with a modem or with a
similar communication device.

7.5 Light Emitting Diodes (LEDs)

Example:

Circuit symbol:

7.5.1 Function
LEDs emit light when an electric current passes through them.
Connecting and soldering
LEDs must be connected the correct way round, the diagram may be
labelled a or + for anode and k or - for cathode (yes, it really is k, not c, for
cathode!). The cathode is the short lead and there may be a slight flat on the
body of round LEDs. If you can see inside the LED the cathode is the larger
electrode (but this is not an official identification method). LEDs can be
damaged by heat when soldering, but the risk is small unless you are very slow..

47

7.5.2 Testing an LED


Never connect an LED directly to a battery or power supply!
It will be destroyed almost instantly because too much current will pass
through and burn it out.
LEDs must have a resistor in series to limit the current to a safe value,
for quick testing purposes a 1k

resistor is suitable for most LEDs if

your supply voltage is 12V or less.


7.5.3 Colours of LEDs
LEDs are available in red, orange, amber, yellow,
green, blue and white. Blue and white LEDs are
much more expensive than the other colours.
The colour of an LED is determined by the
semiconductor material, not by the colouring of the 'package' (the plastic body).
LEDs of all colours are available in uncoloured packages which may be
diffused (milky) or clear (often described as 'water clear'). The coloured
packages are also available as diffused (the standard type) or transparent.

Tri-colour LEDs
The most popular type of tri-colour LED has a red and a green LED combined
in one package with three leads. They are called tri-colour because mixed red
and green light appears to be yellow and this is produced when both the red and
green LEDs are on.
The diagram shows the construction of a tri-colour LED. Note the different
lengths of the three leads. The centre lead (k) is the common cathode for both
48

LEDs, the outer leads (a1 and a2) are the anodes to the LEDs allowing each one
to be lit separately, or both together to give the third colour.
Bi-colour LEDs
A bi-colour LED has two LEDs wired in 'inverse parallel' (one forwards, one
backwards) combined in one package with two leads. Only one of the LEDs can
be lit at one time and they are less useful than the tri-colour LEDs described
above.
7.5.4 Calculating an LED resistor value
An LED must have a resistor connected in series to limit the current through the
LED, otherwise it will burn out almost instantly.
The resistor value, R is given by:
R = (VS - VL) / I

VS= supply voltage


VL = LED voltage (usually 2V, but 4V for blue and white LEDs)
I = LED current (e.g. 20mA), this must be less than the maximum permitted
If the calculated value is not available choose the nearest standard resistor value
which is greater, so that the current will be a little less than you chose. In fact
you may wish to choose a greater resistor value to reduce the current (to
increase battery life for example) but this will make the LED less bright.

49

7.5.5 Technical data for LEDs


Suppliers' catalogues usually include tables of technical data for components
such as LEDs. These tables contain a good deal of useful information in a
compact form but they can be difficult to understand if you are not familiar with
the abbreviations used. The table below shows typical technical data for some
5mm diameter round LEDs with diffused packages (plastic bodies). Only three
columns are important and these are shown in bold. Please see below for
explanations of the quantities.

Type

Colour

Standard Red

Standard

Bright
red

IF

VF

max. typ.

VF

VR

max. max. intensity

30mA 1.7V 2.1V 5V

30mA 2.0V 2.5V 5V

Standard Yellow 30mA 2.1V 2.5V 5V

Standard Green 25mA 2.2V 2.5V 5V

High
intensity
Super
bright

Luminous Viewing

Blue

30mA 4.5V 5.5V 5V

Red

30mA 1.85V 2.5V 5V

50

5mcd

angle
@

10mA
80mcd

10mA
32mcd

10mA
32mcd

10mA
60mcd

20mA
500mcd @
20mA

Wavelength

60

660nm

60

625nm

60

590nm

60

565nm

50

430nm

60

660nm

Low
current

Red

IF max.

30mA 1.7V 2.0V 5V

5mcd
2mA

60

625nm

Maximum forward current, forward just means with the LED


connected correctly.

VF typ.

Typical forward voltage, VL in the LED resistor calculation.


This is about 2V, except for blue and white LEDs for which it
is about 4V.

VF max.

Maximum forward voltage.

VR max.

Maximum

reverse

voltage

You can ignore this for LEDs connected the correct way
round.
Luminous

Brightness of the LED at the given current, mcd =

intensity

millicandela.

Viewing angle

Standard LEDs have a viewing angle of 60, others emit a


narrower beam of about 30.

Wavelength

The peak wavelength of the light emitted, this determines the


colour of the LED.
nm = nanometre.

7.5.6 Flashing LEDs


Flashing LEDs look like ordinary LEDs but they contain an integrated circuit
(IC) as well as the LED itself. The IC flashes the LED at a low frequency,
typically 3Hz (3 flashes per second). They are designed to be connected directly
to a supply, usually 9 - 12V, and no series resistor is required. Their flash
frequency is fixed so their use is limited and you may prefer to build your own
51

circuit to flash an ordinary LED, for example our Flashing LED project which
uses a 555 astable circuit.
7.5.7 LED Displays
LED displays are packages of many LEDs arranged in a pattern, the most
familiar pattern being the 7-segment displays for showing numbers (digits 0-9).
The pictures below illustrate some of the popular designs:

Bargraph

7-segment

Starburst

Dot matrix

7.5.8 Pin connections of LED displays


There are many types of LED display and a supplier's catalogue should be
consulted for the pin connections. The diagram on the right shows an example
from the Rapid Electronics catalogue. Like many 7-segment displays, this
example is available in two versions: Common Anode (SA) with all the LED
anodes connected together and Common Cathode (SC) with all the cathodes
connected together. Letters a-g refer to the 7 segments, A/C is the common
52

anode or cathode as appropriate (on 2 pins). Note that some pins are not present
(NP) but their position is still numbered.

7.6 L293D
7.6.1 Features
_ Wide Supply-Voltage Range: 4.5 V to 36 V
_ Separate Input-Logic Supply
_ Internal ESD Protection
_ Thermal Shutdown
_ High-Noise-Immunity Inputs
_ Functionally Similar to SGS L293 and SGS L293D
_ Output Current 1 A Per Channel (600 mA for L293D)
_ Peak Output Current 2 A Per Channel (1.2 A for L293D)
_ Output Clamp Diodes for Inductive Transient Suppression (L293D)

7.6.2 Pin Diagram/Description


The L293 is designed to provide bidirectional drive currents of up to 1 A
at voltages from 4.5 V to 36 V. The L293D is designed to provide bidirectional
53

drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are


designed to drive inductive loads such as relays, solenoids, dc and bipolar
stepping motors, as well as other high-current/high-voltage loads in positivesupply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive
circuit, with a Darlington transistor sink and a pseudo- Darlington source.
Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers
3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers
are enabled, and their outputs are active and in phase with their inputs. When
the enable input is low, those drivers are disabled, and their outputs are off and
in the high-impedance state. With the proper data inputs, each pair of drivers
forms a full-H (or bridge) reversible drive suitable for solenoid or motor
applications.

54

7.7 GEAR MOTOR

Gear motors are complete motive force systems consisting of an electric


motor and a reduction gear train integrated into one easy-to-mount and
configure package. This greatly reduces the complexity and cost of designing
and constructing power tools, machines and appliances calling for high torque at
relatively low shaft speed or RPM. Gear motors allow the use of economical
low-horsepower motors to provide great motive force at low speed such as in
lifts, winches, medical tables, jacks and robotics. They can be large enough to
lift a building or small enough to drive a tiny clock.
7.7.1 Operation Principle
Most synchronous AC electric motors have output ranges of from 1,200
to 3,600 revolutions per minute. They also have both normal speed and stallspeed torque specifications. The reduction gear trains used in gear motors are
designed to reduce the output speed while increasing the torque. The increase in
torque is inversely proportional to the reduction in speed. Reduction gearing
allows small electric motors to move large driven loads, although more slowly
than larger electric motors. Reduction gears consist of a small gear driving a

55

larger gear. There may be several sets of these reduction gear sets in a reduction
gear box.
7.7.2 Speed Reduction
Sometimes the goal of using a gear motor is to reduce the rotating shaft
speed of a motor in the device being driven, such as in a small electric clock
where the tiny synchronous motor may be spinning at 1,200 rpm but is reduced
to one rpm to drive the second hand, and further reduced in the clock
mechanism to drive the minute and hour hands. Here the amount of driving
force is irrelevant as long as it is sufficient to overcome the frictional effects of
the clock mechanism.
7.7.3 Torque Multiplication
Another goal achievable with a gear motor is to use a small motor to
generate a very large force albeit at a low speed. These applications include the
lifting mechanisms on hospital beds, power recliners, and heavy machine lifts
where the great force at low speed is the goal.

7.7.4 Motor Varieties


Most industrial gear motors are AC-powered, fixed-speed devices,
although there are fixed-gear-ratio, variable-speed motors that provide a greater
degree of control. DC gear motors are used primarily in automotive applications
such as power winches on trucks, windshield wiper motors and power seat or
power window motors.
7.7.5 Applications

What power can openers, garage door openers, stair lifts, rotisserie
motors, timer cycle knobs on washing machines, power drills, cake mixers and
56

electromechanical clocks have in common is that they all use various


integrations of gear motors to derive a large force from a relatively small
electric motor at a manageable speed. In industry, gear motor applications in
jacks, cranes, lifts, clamping, robotics, conveyance and mixing are too
numerous to count.

57

CHAPTER 8
OUTPUT
8.1 Screenshots

58

59

60

61

62

63

CHAPTER 9
CONCLUSION AND FUTURE SCOPE
9.1 Conclusion

I. Automatic mobile pedestrian crossing platform helps disable people &


older people to cross the platforms without any support. By using this
project, Indian railways can use this project to enhance the service to
people.
II. Replacing manned type by adopting unmanned type i.e. fully automatic
microcontroller based system, this helps the old aged and pedestrian
peoples to cross the platforms without any struggles or problems. It
consumes less time to cross the platforms.
9.2 Future Scope
Automatic platform can be used where the distance between two
platforms are large.
Automatic platform can also used to travel between 2 opposite platforms.
Automatic platform leads to less time Consumption.
Reduce the chances of human error.
Fatalities are less.
Enhance reliability near level crossing.
Enhance reliability at plat form crossing.

64

REFERENCE
[1] Acy M. Kottalil, Abhijith S, Ajmal M, Abhilash L J, Ajith Babu:
Automatic Railway Gate Control System, Vol.3, February 2014.
[2] Hnin Ngwe Yee Pwint, Zaw Myo Tun, Hla Myo Tun: Automatic Railway
Gate Control System Using Microcontroller, Vol.3, May-2014.
[3] J. Banuchandar, V.kaliraj, P.Balasubramanian, N.Thamilarsi, Automated
Unmanned Railway Level Crossing System Vol.1, Jan-Feb 2012 PP-458-463.
[4] Krishna, Shashi Yadav, and Nidhi: Automatic Railway Gate Control Using
Microcontroller, Vol.6, No.(4), Pgs.435-440.
[5]. Handoff Performance Improvements in MIMO-Enable CommunicationBased Train Control Systems Li Zhu, F.Richard Yu, Senior Member, IEEE,
Bin Ning, and Tao Tang.
[6]. Multi-Sensor System for Passenger Safety in Railway Applications
Sehchan Oh, Sunghuk Park and Changmu Lee Korea Railroad Research
Institute.

65

APPENDIX
Transmitter:
#include<avr/io.h>
#include<util/delay.h>
int main (void)
{
DDRC = 0x00;
PORTC = 0x0F;
usart_init();
while(1)
{
_delay_ms(500);
while((PINC&0x01)!=0)
{
while((PINC&0x02)!=0)
{
tx_data('A');
_delay_ms(1000);
}
}

66

while((PINC&0x02)!=0)
{
while((PINC&0x01)!=0)
{
tx_data('B');
_delay_ms(1000);
}
}
while((PINC&0x04)!=0)
{
while((PINC&0x08)!=0)
{
tx_data('B');
_delay_ms(1000);
}
}
while((PINC&0x08)!=0)
{
while((PINC&0x04)!=0)

67

{
tx_data('A');
_delay_ms(1000);
}
}
}
}

Receiver:
#include<avr/io.h>
#include<util/delay.h>

// Gear Motor - 3 (PB.0, PB.1, PC.5), LCD - 6 (PD.2-PD.7), Voice - 2 (PC0PC1)


int main (void)
{
DDRC = 0xFF;
PORTC = 0xFF;

DDRB = 0xFF;
PORTB = 0x00;
68

init_lcd();
clear_data();

usart_init();

lcd_posi(1,0);
lcd_puts("TRAIN PLATFORM");
_delay_ms(1000);
unsigned int count=1, count_out;

while(1)
{
lcd_posi(1,0);
lcd_puts("Waiting 4 Cmd...");
_delay_ms(500);

PORTC = 0Xff;

unsigned char data = rx_data();

69

if(data == 'A')
{
if(count == 0)
{
PORTC = 0x0f;
count=1;

_delay_ms(500);

PORTB = 0x00;
PORTC = 0x01;
//PORTC &= ~(0x10);
_delay_ms(5);
_delay_ms(5);
//PORTC |= 0x10;
PORTC |= 0x01;

_delay_ms(1000);

70

//Escalator Stop

_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
PORTC = 0xFF;

PORTB = 0x02;
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
//_delay_ms(200);
PORTB =0x00;
}
}

if(data == 'B')
{
if(count == 1)
{

71

//Platform close

count=0;

_delay_ms(500);

PORTC = 0x10;

//Train Departure Voice Cmd

//PORTC &= ~(0x10);


_delay_ms(5);
//PORTC &= ~(0x10);
_delay_ms(5);
PORTC |= 0x10;
PORTC = 0xF0;

_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
PORTC = 0xFF;

72

_delay_ms(1000);

PORTB = 0x01;

//Platform Open

_delay_ms(1000);
_delay_ms(1000);
_delay_ms(1000);
PORTB = 0x00;
_delay_ms(1000);

PORTC = 0x20;
PORTB = 0x04;
_delay_ms(500);
}

}
}

73

//Escalator On

Vous aimerez peut-être aussi