Sie sind auf Seite 1von 34

A SUMMER TRAINING REPORT on

METRO TRAIN PROTOTYPE


Submitted in the partial fulfillment for the award of Degree of Bachelors of Technology in

ELECTRONICS & COMMUNICATION ENGINEERING


From

MD UNIVERSITY, ROHTAK

Submitted by: Sarita Yadav 08-ECE-205

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

GURGAON INSTITUTE OF TECHNOLOGY & MANAGEMENT GURGAON-122413


Oct 1|Page

2|Page

ACKNOWLEDGEMENT

I proudly express my respectful thanks to my esteemed educational institution GITM which has blessed me to continue my technical education and has provided me a bright future. It is a pleasure of mine to find myself penning down these lines to express my sincere thanks to our H.O.D Mr. ALOK KUSHWAHA who gave me this opportunity of industrial training for 6 weeks to enhance my professional practice & to get preliminary industrial exposure in the concerned discipline. We express our sincere gratitude to Mr. Manish Goyal and Mr. Vineet and all the staff members of the company for their guidance and for giving me knowledge about Embedded System Technology. They have been a great source of inspiration for us. My deepest gratitude is to my teachers & all the members of G.I.T.M Gurgaon, for always boosting my morale & providing me encouraging environment. In the last but not the least, I want to thank my Parents without grace of whom nothing was possible.

SARITA YADAV 08 - ECE - 205 GITM

3|Page

INDEX
INTRODUCTION OF E.S APPLICATIONS INTRODUCTION TO PROJECT MC Vs MP DETAILS OF 8051 COMPONENTS & DESCRIPTION PROCEDURE WORKING FUTURE SCOPE CODING REFERNCES

4|Page

5|Page

INTRODUCTION TO EMBEDDED SYSTEM

Embedded technology is software or hardware that is hidden embedded in a large device or system. It typically refers to a fixed function device, as compared with a PC,which runs general purpose application. Embedded technology is nothing new. Its all around us and has been for years. An early example of embedded technology is the engine control unit in a car, which measures what setting to give the engine. Your coffee maker has embedded technology in the form of a microcontroller, which is what tells it to make the coffee at 6 a.m. the vending machine has it too. Overall,billions of devices woven into everydaylife .The past embedded technology existed in stand alone device vending machines and copiers that did their jobs with little regard for what went on around them,. But as technology has learned to connect device to the internet and to each other, embedded technology potential has grown. Suddenly it is and what actions those connections letthem perform. Cell phone companies figured that out a long time ago, which is whycell phones are cheap and the service, plans are expensive. It is not the phone itselfthat matters, but the connectivity to a vast network of other phones, other people andthe internet.Until you download software that lets you find a local restaurant ormange your finances. Let say you make freezers the big, expensive kind that grocerystores buy. You sell ne and you are done with that customer. When it brakes the customer calls a service person, who probably comes thanyour company. But let us say that freezer knows that it is about to go on the fritz. Letsay three refrigerator alerts the customer before it breaks. Better yet, let us say thefreezer alerts the manufacturer and you are able to send a service person to dopreventative work and save a lot of haagendazs from melting. Embedded technology allows all of that to happen. You, the freezer company have transformed yourselffrom a product company to product and services company. The possibilities gobeyond that programming device to communicate with businesses can eliminate theneed for costly call centers. Copy machines that can order their own replacementcartridges will save businesses time and money. Remember, the fact the technology is embedded is not what important, and neither is the device.

6|Page

APPLICATIONS

Telecom Mobile phone systems(handsets and base systems),modems,routers Automotive Applications Braking system,traction control, airbag release system, management units and steer-bywire systems Domestic Application Dishwasher, television, washing machines, microwave ovens, video recorders, security system, garage door controllers, calculators, digital watches, VCRs,digital cameras, remote controls, treadmills Robotic Fire fighting robot, automatic floor cleaners, robot arm Aeroaspace Applications Flight control system, engine controllers,autopilots Medical Equipement Anesthesia monitoring system,ECG monitors, pacemakers, MRI scanners Defense System Radar system, radio systems,missile guidance system Office Automation Laser printers, fax machines, pagers, cash registers, gas pumps,credit/debit card reader,thermostats, grain analysers

7|Page

INTRODUCTION TO PROJECT
This project is designed so as to understand the technology used in the now a days driver less metro train which is used in most of the developed countries like Germany, France, and Japan etc. These trains are equipped with the CPU, which control the train. The train is programmed for the specific path. Every station on the path is defined; stoppage timing of the train and distance between the two stations is predefined. This is very wonderful project to control the working of the train without driver. These train are equipped with the CPU which control the train. 1.8051 Microcontroller 2. ULN 2003 3. L239D 4. Stepper motor 5. LCD In this project we try to give the same prototype for this type of trains.We are using ATMEL microcontroller 8051 to control all the function as CPU.Microcontroller controls the rotation of motor.First the motor is controlled and name of each station is displayed over LCD and accordingly the different delay for each station is provided. So this project works for metro train without driver.The motion of the train is controlled by the Stepper Motor, for displaying message in the train we are using Intelligent LCD Display of two lines. The train is designed for three stations, named as Huda city centre,iffco chowk,mg road,arjangarh,saket. The Stoppage time is of 2ms and time between two consecutive stations is 10ms .There is a LCD display for showing various messages in the train for passengers. There are indicators, which are used to show the train direction i.e. UP path and down path. Before stopping at station the train blows the buzzer. It also includes an emergency brake system due to which the train stops as soon as thebrakes are applied and resumes journey when the emergency situation is over.

8|Page

MICROCONTROLLERS FOR EMBEDDED


Microcontrollers are widely used in Embedded System products. An Embedded product uses the microprocessor (or microcontroller) to do one task & one task only. A printer is an example of embedded system since the processor inside it performs one task only namely getting the data and printing it. Contrast this with Pentium based PC. A PC can be used for any no. of applications such as word processor, print server, bank teller terminal, video game player, network server or internet terminal. Software for variety of applications can be loaded and run. Of course the reason a PC can perform multiple task is that it has RAM memory and an operating system that loads the application software into RAM & lets the CPU run it. In an embedded system there is only one application software. An x86PC Contain or its connected to variousEmbedded Products such as keyboard, printer, modem, Disc controller, Soundcard, CD-Rom Driver, Mouse & so on. Each one of these peripherals has a microcontroller inside it that performs only one task. For example inside every mouse there is microcontroller to perform the task of finding the mouse position and sending it to PC.

MICROCONTROLLERS Vs MICROPROCESSOR
MICROCONTROLLERS (MCU): Figure shows the block diagram of a typical microcontroller, which is a true computer ona chip. The design incorporates all of the features found in microprocessor CPU:ALU, PC, SP, and registers. It also added the other features needed to make a complete computer: ROM, RAM, parallel I/O, serial I/O, counters, and clock circuit

9|Page

I/O

RAM

ROM A SINGLE CHIP

CPU

TIMER

SERIAL COM PORT

MICROPROCESSOR (MPU): A microprocessor is a general-purpose digital computer central processing unit (CPU) .Although popularly known as computer on a chip is in no sense a complete digital computer .The block diagram of microprocessor CPU is shown,which contains an arithmetic and logical unit (ALU), program counter (PC), a stack pointer (SP),some working registers, a clock timing circuit, and interrupt circuits.

DATA BUS CPU RAM ROM I/O TIM -ER


SERIAL COM PORT

ADDRESS BUS

10 | P a g e

FEATURES OF 8051
4Kbytes of ROM,128 bytes of RAM,32 I/O lines ,two 16-bit timer/counters, a five vector twolevel interrupt architecture, a full duplex serial port ,on-chip oscillator and clock circuitry. In addition, the 8051 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode Stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power Down Mode Saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

ARCHITECTURE OF 8051

11 | P a g e

LIST OF COMPONENTS USED

S.RO. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.

EQUIPEMENT
IC 8501 MC(AT89S52) IC ULN 2003 Transformer Voltage Regulator 7805 2 Line LCD Display Crystal oscillator LED L293D Motor Drive Motor

Qunatity 1 1 1 1 1 1 1 1 1 7 7 1 2

Resistors(330K,2.2k,1.2K,10k,100K) Capacitors(33pf,0.1MFD,1000MFD,10MFD) Buzzer Switch

DESCRIPTION OF COMPONENTS USED


AT89S52 MICROCONTROLLERS: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non volatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. 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 in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-

12 | P a g e

flexible and cost-effective solution to many embedded control applications. . The AT89S52 provides the following standard features 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. PIN CONFIGURATION:

1. VCC: Supply voltage 2. GND:Ground. 3. Port 0: Port 0 is an 8-bit open drain bidirectional 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 can 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.
13 | P a g e

P0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. 4.Port 1: Port 1 is an 8-bit bidirectional 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 internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verication. Port Pin P1.0 P1.1 P1.5 P1.6 P1.7 Alternate Functions T2 (external count input to Timer/Counter 2), clock-out T2EX (Timer/Counter 2 capture/reload trigger and direction control) MOSI (used for In-System Programming) MISO (used for In-System Programming) SCK (used for In-System Programming)

5.Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification

14 | P a g e

6.Port 3: Port 3 is an 8-bit bidirectional 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 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table: 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)

7. RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. 8. ALE/PROG: Address Latch Enable (ALE) is an 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. 9. PSEN: Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
15 | P a g e

10. EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. 11. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. 12. XTAL2: Output from the inverting oscillator amplifier

IC ULN2003: The ULN2003 is a monolithic high voltage and high current darlington transistor arrays. It consists of seven NPN darlington pairs that features high-voltage outputs with commoncathode clamp diode for switching inductive loads. The collector-current rating of a single darlington pair is 500mA. The darlington pairs may be parrlleled for higher current capability. Applications include relay drivers,hammer drivers, lampdrivers,display drivers(LED gas discharge),line drivers, and logic buffers. The ULN2003 has a 2.7k series base resistor for each darlington pair for operation directly with TTL or 5V CMOS devices. Features : . Logic diagram: Schematic(each darlington pair) 500mA rated collector current(Single output) High-voltage outputs: 50V Inputs compatibale with various types of logic Relay driver application

16 | P a g e

17 | P a g e

PIN CONFIGURATION OF ULN2003:

L239D MOTOR DRIVE: L293D is a dual H-Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all the four I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF ouput diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V A simple schematic for interfacing a DC motor using L293D is shown below

18 | P a g e

LCD 16x2: Liquid crystal displays (LCDs) offer several advantages over traditionalcathode-ray tube displays that make them ideal for several applications. Ofcourse, LCDs are flat and they use only a fraction of the power required by cathode-ray tubes.

16x2 LCD is used in this project to display data to user. There are two rows and 16 columns. It is possible to display 16 characters on each of the 2 rows. It has two registers, command register and data register.

They are easier to read and more pleasant to work with for long periods of time than most ordinary video monitors. There are several trade offs as well, such as limited view angle, brightness, and contrast, not to mention high manufacturing cost.

19 | P a g e

Pin No 1 2 3

Function Ground (0V) Supply voltage; 5V (4.7V 5.3V) Contrast adjustment; through a variable resistor

Name Ground Vcc VEE

4 5 6 7 8 9 10

Selects command register when low; and data register when high Low to write to the register; High to read from the register Sends data to data pins when a high to low pulse is given

Register Select Read/write Enable DB0 DB1 DB2 DB3

8-bit data pins 11 12 13 14 15 16 Backlight VCC (5V) Backlight Ground (0V) DB4 DB5 DB6 DB7 Led+ Led-

0.5

D7

0.4

D6

0.3

D5

20 | P a g e

8051 & LCD INTERFACE LCD is interfaced to the microcontroller as shown in the above figure. It is connected to the port 0.The EN and RS pins control the data transfer operations.

MICROCONTROLLER AND LCD INTERFACING

Figure gives us the clear view of the interactions between microcontroller and LCD. 1. RS, Register Select (Pin 4): This pin is used to select command register and data register. If RS=0, instruction command register is selected, allowing the user to send a command such as clear display, cursor at home, etc. If RS =1, the data register is selected, allowing the user to send data to be displayed on the LCD. 2. EN Enable (Pin 6):The LCD to latch information presented to its data pins uses the enable pin. When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide. 3. D4 D7 (Pin 11 Pin 14):Data to be displayed is sent to LCD on these pins. First MSB is sent, followed by LSB. 4. D0 D3 (Pin 7 Pin 10):These pins are connected to ground, as they are not used to display data.
21 | P a g e

5. Vcc (Pin 2):This pin is connected to +5v power supply. 6. Vss (Pin 1):This pin is connected to ground. BUZZER:The buzzer subsystem produces a 2 KHz audible tone when powered The buzzer will sound when the signal coming into the driver is high. It must be connected to a transistor, Darlington or transducer driver subsystem.

The buzzer is connected between the supply rail (+ V) and the input signal. This acts as load on the driver. When the input signal coming into the buzzer subsystem is low, a potential difference across the buzzer causes current to flow. It is this flow of current that causes the buzzer to sound.Buzzer is connected to microcontroller port pin, so microcontroller will give high or low to switch on/off buzzer. In this project it is used to indicate the arrival and departure of train.

VOLAGE REGULATOR
Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variableoutput voltages. The maximum current they can pass also rates them. Negativevoltage regulators are available, mainly for use in dual supplies. Most regulatorsinclude some automatic protection from excessive current (over load protection) andoverheating (thermal protection). Many of fixed voltage regulator ICs has 3 leads.They include a hole for attaching a heat sink if necessary.

22 | P a g e

These voltage regulators are monolithic circuit integrated circuit designed as fixedvoltage regulators for a wide variety of applications including local, on cardregulation. These regulators employ internal current limiting, thermal shutdown, and safe-area compensation. With adequate heat sinking they can deliver output current inexcess of 1.0 A. Although designed primarily as a fixed voltage regulator, thesedevicescan be used with external components to obtain adjustable voltage and current FEATURES Output current in Excess of 1.0 A No external component required Internal thermal overload protection Internal short circuit current limiting Output transistor safe-area compensation Output voltage offered in 2% and 4% tolerance Available I n surface mount D2PAK and standard 3-lead transistor packages Previous commercial temperature range has been extended to a junction temperature range of -40 degree C to +125 degree C

RESISTORS
The flow of charge through any material encounters an opposing force similar in many respectsto mechanical friction .this opposing force is called resistance of the material .in some electriccircuit resistance is deliberately introduced in form of resistor. Resistor used fall in threecategories , only two of which are color coded which are metal film and carbon film resistor.the third category is the wire wound type ,where value are generally printed on the vitreouspaint finish of the component. Resistors are in ohms and are represented in Greek letter omega,looks as an upturned horseshoe. Most electronic circuit require resistors to make them workproperly and it is obliviously important to find out something about the different types of resistors available. Resistance is measured in ohms, the symbol for ohm is an omega ohm.1 ohm is quite small for electronics so resistances are often given in kohm and Mohm.Resistors used in electronics can have resistances as low as 0.1 ohm or as high as 10 Mohm

23 | P a g e

CAPACITORS
A capacitor is a little like a battery. Although they work in completely different ways, capacitors and batteries both store electrical energy. If you have read How Batteries Work, then you know that a battery has two terminals. Inside the battery, chemical reactions produce electrons on one terminal and absorb electrons at the other terminal.

Different types of capacitors

LED
LED falls within the family of P-N junction devices. The light emitting diode (LED)is a diode that will give off visible light when it is energized. In any forward biased P-N junction there is, with in the structure and primarily close to the junction, are combination of hole and electrons. This recombination requires that the energy possessed by the unbound free electron be transferred to another state. The process of giving off light by applying an electrical source is called electroluminescence

24 | P a g e

Different sections of LED

DC MOTOR
A dc motor system is an electro-mechanical rotary actuator that converts electrical pulses into unique shaft rotations. This rotation is directly related to the number of pulses.Motion Control, in electronic terms, means to accurately control the movement of an object based on speed, distance, load, inertia or a combination of all these factors.. This motor can be operated inforward/reverse with controllable speed from a BASIC Stamp or any other microcontroller through a transistor driver circuit.

A view of dc motor

PCB LAYOUT
A Printed Circuit Board is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate.Below is the pcb used in the project

25 | P a g e

PROCEDURE OF BUILDING PROTOTYPE OF METRO


Step 1: Circuit diagram of the proposed system is designed and finalized. Step 2: All the components and software platform to be used are selected which are also mentioned above Step 3: All the hardware components are soldered on their respective printed circuit boards with the help of soldering ion, solder and flux according to the hardware schematic Step 4: Code/program of the proposed system is developed using assembly language with the help of software platform (Keil u vision3). Step 5: The hex code of the program being created by the software platform is burnt into the flash code memory of our microcontroller
26 | P a g e

Step 6: Testing is done at various levels to finalize the appropriate program for the most proper working of the system

WORKING OF METRO
When the power is turned on a message (welcome to metro) is displayed on LCD. Then a after the delay of 10ms message Current station is huda city centre is displayed and door is opens. A buzzer is turned on when door opens. After some delay the door is closed and metro is started to move forward. After some delay a message next station is say iffco chowk is displayed. After the delay of 10ms the train stops and a message current station is iffco chowk is displayed. This process is continued for five stations. In the end a message End of line is displayeon LCD. This whole process is repeated until we turned off the power

BLOCK DIAGRAM

CIRCUIT DIAGRAM

27 | P a g e

28 | P a g e

PROBLEMS FACED First problem faced in the making of the metro prototype is that the it is difficult to match
time with the rotation of motor and LCD display We have to take exta care while soldering the 2 line LCD display A leg of the cyrsatl oscillator was broken while mounting so it has to be replaced Micrcontrollers burnt due to short circuit LED get damaged so it was replaced

TROUBLESHOOT
Care should be taken while soldering.There should be no shorting of joints Proper power supply should be maintained Project should be handled with care since IC are delicate Component change and check again circuit

FUTURE SCOPE
Stainless steel exteriors instead of an aluminium car body. Thinner, stronger stainless steel seats that offer more leg room. Each car would have 64 cloth-padded, taller seats with seat-back grab handles. A total end to carpeting. Floors would be rubberized. Interactive maps on LCD screens that would also likely display advertisements y Automated station announcements. Security cameras on all rail cars. The 7000 series won't be ready for service for at least five years. The latest models are in the 6000 series, which were introduced last year.

29 | P a g e

CODING

#include<reg51.h> void lcd_data(char[]); void lcd_ok(bit); void delay(unsigned int); void delay1(unsigned int); void lcd_code(char); void check(); void lcd_init(); sbit rs = P2^0; sbit rw = P2^1; sbit en = P2^2; sbit busy = P1^7; sbit mot1 = P2^3; sbit mot2 = P2^4; sbit door1=P2^5; sbitt door2 = P2^6; sbit buzz = P2^7; #define lcd_port P1 main() { char index1; char stations[][16] = {{"huda city centre"}, {"iffco chowk"}, {"MG road"}, {"Arjangarh"}, {"Saket"}}; mot1 = 0; mot2 = 0; buzz = 1; door1 = 1; door2 = 1; lcd_init(); lcd_code(0x01); lcd_data("Welcome To Metro0"); delay1(1000); lcd_code(0x80); for(index1 = 0; index1 != 5; index1++

{ lcd_code(0x01);
30 | P a g e

lcd_code(0x80); lcd_data("CurrentStation:huda cuty centre"); lcd_code(0xC0); lcd_data(stations[index1]); delay1(200); buzz = 0; delay1(200); buzz = 1; //------------------------------Door Open door1 = 0; delay1(500) door1 = 1; //------------------------------Door Open delay1(3500); //------------------------------Door Close door2 = 0; delay1(1000); door2 = 1; //------------------------------Door Close delay1(300); mot1 = 1; mot2 = 0; if(index1 < 4) { delay1(2000); lcd_code(0x01); lcd_code(0x80); lcd_data("NextStation:iffco chowk"); lcd_code(0xC0); lcd_data(stations[index1+1]); delay1(2000); mot1 = 0; mot2 = 0 lcd_code(0*10); } Else { lcd_code(0x01); lcd_data("End Of Line0"); delay1(1000); } } } void lcd_data(char ch[]) { int index1; for(index1 = 0; ch[index1] != '0'; index1++)
31 | P a g e

{ check(); lcd_port = ch[index1]; lcd_ok(1) }

Return; } void lcd_ok(bit mybit) { if(mybit) { rs = 1; } else { rs = 0; } rw = 0; en = 1; delay(1); en = 0; return; } void delay1(unsigned int itime) { unsigned int i,j; for(i = 0; i < itime; i++) for(j = 0; j < 500; j++); return; } Void delay(unsigned int time) { Int i=0;

for(; time > 0; time--) for(; i < 353; i++); return;

void lcd_init() { lcd_code(0x38);


32 | P a g e

lcd_code(0x0C); lcd_code(0x01); lcd_code(0x06); return; }

void lcd_code(char ch) { check(); lcd_port = ch; lcd_ok(0); return; } void check() { rs = 0; rw = 1; while(busy == 1) { en = 0; delay(1); en = 1; } Return; }

33 | P a g e

REFERENCES
1. Wikipedia - The free encyclopedia 2. http://www.8051projects.info/ 3. http://www.instructables.com/

34 | P a g e

Das könnte Ihnen auch gefallen