Professional Documents
Culture Documents
R.SIVARAMA KRISHNAN
Reg.No:921712107087
P.VELKUMAR
Reg.No:921712107099
A.MOHAMMED AAJIPKHAN
Reg.No:921712107063
BACHELOR OF ENGINEERING
in
ELECTRONICS AND INSTRUMENTATION ENGINEERING
FOR
PHYSICALLY
CHALLENGED
PEOPLE
IN
(921712107087),
P.VELKUMAR
(921712107099),
SIGNATURE
SIGNATURE
ASSISTANT PROFESSOR
DEPARTMENT OF
DEPARTMENT OF
ENGINEERING
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
13
2.2 Peripherals
14
14
14
19
21
3.1.3 Overview
21
22
24
3.2.1 Introduction
26
26
CIRCUIT DIAGRAM
4.1 Monitoring unit
32
33
AVR SYNTHESIS
5.1 AVR Synthesis tool
LITERATURE SURVEY
6.1 Review of literature
34
37
40
7.1.1 Overview
40
41
42
43
7.3 UART
7.3.1 Block diagram
44
44
7.3.3 Features
45
47
47
48
48
49
50
51
52
52
7.6 L293D
7.6.1 Features
53
53
55
56
56
56
7.7.5 Applications
56
OUTPUT
58
64
64
REFERENCE
APPENDIX
LIST OF FIGURES
FIGURE NO
FIGURE
PAGE NO
2.4
Flash memory
14
3.1.2
21
3.1.4
22
3.2.2
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
42
7.2
43
7.3
44
7.4
47
7.5.3
Colour of LEDs
48
7.5.8
LED Displays
52
7.6.2
53
7.7
Gear motor
55
LIST OF ABBRVIATIONS
SL NO
WORD
ABBREVIATIONS
LED
LCD
UART
UNIVERSAL ASYNCHRONUS
RECEIVER TRANSMITTER
USART
UNIVERSAL SYNCHRONOUS
AND ASYNCHRONUS
RECEIVER TRANSMITTER
AVR
PE
PARRITY ERROR
MPCM
MULTIPROCESSOR
COMMUNICATION MODE
DOR
SCI
SERIAL COMMUNICATION
INTERFACE
10
USB
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:
keyboards and mouse, printed circuit boards, switches, modems, and, of course,
memory.
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
application some of
Electronic device
1.Removable Storage
2.Cell Phones
3.MP3 Players
4.Digital Still Camera
17
CHAPTER 3
BLOCK DIAGRAM AND ITS EXPLANATION
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.
Active: 3.6 mA
Idle Mode: 1.0 mA
Power-down Mode: 0.5 A
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
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
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.
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.2Architectural Overview
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
31
CHAPTER 4
CIRCUIT DIAGRAM
4.1 Monitoring unit
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
37
2.Suderson.P,Ramkumar.S,Surendar.R,UdhayaShankar.T:"Artificial
Railway
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).
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
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.
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
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
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.
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
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
49
Type
Colour
Standard Red
Standard
Bright
red
IF
VF
max. typ.
VF
VR
High
intensity
Super
bright
Luminous Viewing
Blue
Red
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.
5mcd
2mA
60
625nm
VF typ.
VF max.
VR max.
Maximum
reverse
voltage
You can ignore this for LEDs connected the correct way
round.
Luminous
intensity
millicandela.
Viewing angle
Wavelength
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
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)
54
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.
What power can openers, garage door openers, stair lifts, rotisserie
motors, timer cycle knobs on washing machines, power drills, cake mixers and
56
57
CHAPTER 8
OUTPUT
8.1 Screenshots
58
59
60
61
62
63
CHAPTER 9
CONCLUSION AND FUTURE SCOPE
9.1 Conclusion
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>
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;
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;
_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