metro train pro

59
METRO TRAIN PROTOTYPE USING 8051 SUBMITTED BY: SHOBHIT CHAUDHARY(EC 2nd ) IIMT MEERUT Sumit KUMAR SINGH (EC 2nd ) IIMT MEERUT Sumit ARORA (EC 2nd ) CERT MEERUT SWADESH KUMAR MISHRA (EC 2nd ) BIT KANPUR Semiconductor Technologies VEDANT EDUCATION AND TRAINING

Upload: shobhit-chaudhary

Post on 29-Dec-2014

179 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Metro Train Pro

METRO TRAIN PROTOTYPE USING 8051SUBMITTED BY:

SHOBHIT CHAUDHARY(EC 2nd ) IIMT MEERUT Sumit KUMAR SINGH (EC 2nd ) IIMT MEERUTSumit ARORA (EC 2nd ) CERT MEERUTSWADESH KUMAR MISHRA (EC 2nd ) BIT KANPUR

CERTIFICATETo whom it May concern

Semiconductor TechnologiesVEDANT

EDUCATION AND TRAINING

Page 2: Metro Train Pro

This is to certified that sumit,Swadesh,shobhit

Has successfully completed their project on :

“ Metro train prototype using 8051 ”

with all its functionalities during the summer training course from Semiconductor Technologies, “Vedant ” his work was authentic and conduct was diligent & sincere. The project satisfies the norms of the company and was developed under the guidance of Mr. Ma noj kr. Srivastava, Ms. Nirmal Chauhan

Certificate is awaited

CERTIFIED BY:

Ms.Nirmal chauhan Mr.Sachin Kr. Kanodia (Project Guide) (Center Head)

ACKNOWLEDGEMENT

No academic endeavor can be single handedly

accomplished. This work is no exception.

1

Page 3: Metro Train Pro

At the outset, we would like to record our gratitude to Mr.

Sachin Kr. Kanodia for initiating us into this training.

We sincerely acknowledge our thanks to our project guide

Mr. Manoj kr. Srivastava, Ms. Nirmal Chauhan, for their

valuable suggestions and time to time consultation.

Last, but not the least, we would like to thank all the staff of

Design Department, Semiconductor Technologies, Vedant,

Lucknow especially Ms. Shilpa for their kind cooperation and

assistance during our training period.

-SUMIT KUMAR SINGH-SUMIT ARORA-SHOBHIT -SWADESH

PREFACE

"Any sufficiently advanced technology is indistinguishable from magic,"wrote ARTHUR C. CLARKE. Today, we can drive in a voice activated car, get our clothes washed and dried in a washing machine with in minutes, and read the temperature and air pressure from our wrist watch .A musical greeting card has more computing power than NASA'S lunar Lander had in 1969.

2

Page 4: Metro Train Pro

Thousand of people have embedded processors beneath their skin, as pacemaker or hearing aids.

It is the embedded technology that makes all this possible. Embedded system not only sit in our microwave ovens but also help drive our cars, giving us directions to follow entertainment through our journey, keeping us connected with anyone across the globe and even warning us of potential danger. And is not far off when you'll have a car similar to what JAMES BOND drives!

Embedded technology plays a key role not only in consumer electronics but also in much safety critical application like avionics, space, railways and transport, process control and medicine. But complexity creates problems too. A faulty microprocessor or software may prove to be a costly affair. Your favorite song on the MP3 player may sing a different tune. A car can go up in flames if spark plugs misfire. Even the Boeing aircraft may go off course. Fingers are then pointed at the system developer or software engineer for writing a code that is not robust. It's imperative for embedded application to be much more reliable than their desktop counterparts.

3

Page 5: Metro Train Pro

INDEX

S.No. Title Page

1. Introduction To Semiconductor technologies - Vedant.

6

2. Introduction to Embedded Systems 8

3. Introduction to the Microcontroller 13

4

Page 6: Metro Train Pro

4. Block Diagram of the System 16

5. Introduction to the Keil Software 19

6. Introduction To The Project 20

7. Circuit Diagram 26

8. Program Code 27

9. Program List File 33

10. Bibliography 50

SEMICONDUCTOR TECHNOLOGIES- VEDANT

AN ISO 9001:2000 CERTIFIED INSTITUTION Semiconductor Technologies has always been in sync with the future. It has understood and appreciated the needs of India, its people and its ever-growing industry. Over the last six 20 years tell the saga of VEDANT contribution in leading the national effort in the vital areas of microelectronics.

5

Page 7: Metro Train Pro

M/s Semiconductor Technologies-VEDANT is India’s premier VLSI Design & Embedded System Design organization since 2002. While VEDANT is India’s pioneer in the field of VLSI Design & Embedded System Design and Testing. VEDANT is providing Education & Training on VLSI Design & Embedded System Design through ‘state-of-the-art’ lab facilities, equipped with the Industry Standard tools. VLSI Design / Embedded Systems Design Engineer design such Silicon chips…making a career in VLSI Design / ESD is highly respected & rewarding one. Furthermore we would like to bring in your notice that VEDANT is a member of “Indian Semiconductor Association” as well. Semiconductor Technologies-VEDANT (Now an ISO 9001: 2000 Certified Institution) is center for the training crafted in VLSI/ESD education module followed with VLSI Design software along with the FPGA programming & 8051 Microcontroller kit.

VedantVEDANT (VLSI design and training) is one of the prestigious projects of SCL, a pioneer with vertically integrated facility in the country.

SCL VEDANT program covers the complete spectrum of VLSI design inclusive of “front end”, “back end” and provides of exposure to the IC fabrication process. Industry standard CAD tools are used for the purpose of training backed up by project work under the guidance of experts.

6

Page 8: Metro Train Pro

VEDANT (LUCKNOW CENTER) is the institute, which provides training in VLSI design to students. The working environment is concentrated on front-end design process. It runs two programs ‘PG diploma in VLSI designing of four months and certificate course of two months. It also provides Summer & Winter Training in VLSI Design or Embedded System.

It has an advanced lab which is equipped with latest industry standard Electronic Design Automation (EDA) and FPGA tools and 8051 Development Kits inclusive of

Model Sim 6.0aXilinx toolsFPGA Kit8051 Development KitKeil SoftwareFlash Magic (Rom burning)

Introduction to Embedded Systems

The embedded system is a combination of computer hardware, software additional electrical & mechanical parts. A computer is used in such devices primarily as a means to simplify the system design and to provide flexibility.

• Often the user of the device is not even aware that a computer is present.

• Electronic devices that incorporate a computer (usually a microprocessor) within their implementation

These are Real-time systems process events.These events occur on external inputs cause other events to occur as outputs.Minimizing

7

Page 9: Metro Train Pro

response time is usually a primary objective, or otherwise the entire system may fail to operate properly.

Therefore Embedded systems employ the use of a RTOS (Real-Time Operating System)It is an Operating Systems with the necessary features to support a Real-Time SystemReal-Time SystemA system where correctness depends not only on the correctness of the logical result of the computation, but also on the result delivery time. It responds in a timely, predictable way to unpredictable external stimuli arrivals.

The real Time Systems can be further divided into two types: Soft Real-Time System

Compute output response as fast as possible, but no specific deadlines that must be met.

Hard Real-Time SystemOutput response must be computed by specified deadline or system

fails.

8

Page 10: Metro Train Pro

Programming

Logical/DigitalDesign

Computer Systems

Organization

Embedded Systems

Embedded&

Real Time

Systems

Advanced Digital Design

(Synthesis)

VLSI/ASIC&

SoCDesign

Control Systems

DSP

9

Page 11: Metro Train Pro

Programming Languages Used in New Embedded Designs

10

Page 12: Metro Train Pro

Micro Controllers Trend in the Embedded Systems

11

Page 13: Metro Train Pro

Application of embedded systems in sphere of life

Consumer electronics

Telecommunication

Automobile

Medical instrumentation

Industrial control equipment

Defense

Communication satellite

Data communication

Internet appliances

12

Page 14: Metro Train Pro

Introduction to microcontroller

A microcontroller is a computer-on-a-chip, or, if you prefer, a single-chip computer. Micro suggests that the device is small, and controller tells you that the device might be used to control objects, processes, or events. Another term to describe a microcontroller is embedded controller, because the microcontroller and its support circuits are often built into, or embedded in, the devices they control.

You can find microcontrollers in all kinds of things these days. Any device that measures, stores, controls, calculates, or displays information is a candidate for putting a microcontroller inside. The largest single use for microcontrollers is in automobiles—just about every car manufactured today includes at least one microcontroller for engine control, and often more to control additional systems in the car. In desktop computers, you can find microcontrollers inside keyboards, modems, printers, and other peripherals. In test equipment, microcontrollers make it easy to add features such as the ability to store measurements, to create and store user routines, and to display messages and waveforms. Consumer products that use microcontrollers include cameras, video recorders, compact-disk players, and ovens. And these are just a few examples.

Microcontroller Basics

13

Page 15: Metro Train Pro

A microcontroller is similar to the microprocessor inside a personal computer. Examples of microprocessors include Intel’s 8086, Motorola’s 68000, and Zilog’s Z80. Both microprocessors and microcontrollers contain a central processing unit, or CPU. The CPU executes instructions that perform the basic logic, math, and data-moving functions of a computer. To make a complete computer, a microprocessor requires memory for storing data and programs, and input/output (I/O) interfaces for connecting external devices like keyboards and displays. In contrast, a microcontroller is a single-chip computer because it contains memory and I/O interfaces in addition to the CPU. Because the amount of memory and interfaces that can fit on a single chip is limited, microcontrollers tend to be used in smaller systems that require little more than the microcontroller and a few support components. Examples of popular microcontrollers are Intel’s 8052 (including the 8052-BASIC, which is the focus of this book), Motorola’s 68HC11, and Zilog’s Z8.

Microcontroller History

To understand how microcontrollers fit into the always-expanding world of computers, we need to look back to the roots of microcomputing.In its January 1975 issue, Popular Electronics magazine featured an article describing the Altair 8800 computer, which was the first microcomputer that hobbyists could build and program themselves. The basic Altair included no keyboard, video display, disk drives, or other elements we now think of as essential elements of a personal computer. Its 8080 microprocessor was programmed by flipping toggle switches on the front panel. Standard RAM was 256 bytes and a kit version cost $397 ($498 assembled). A breakthrough in the Altair’s usability occurred when a small company called Microsoft offered a version of the BASIC programming language for it. Of course, the computer world has changed a lot since the introduction of the Altair. Microsoft has become an enormous software publisher, and a typical personal computer now includes a keyboard, video display, disk drives, and Megabytes of RAM. What’s more, there’s no longer any need to build a

14

Page 16: Metro Train Pro

personal computer from scratch, since mass production has drastically lowered the price of assembled systems. At most, building a personal computer now involves only installing assembled boards and other major components in an enclosure. A personal computer like Apple’s Macintosh or IBM’s PC is a general-purpose machine, since you can use it for many applications—word processing, spreadsheets, computer-aided design, and more—just by loading the appropriate software from disk into memory. Interfaces to personal computers are for the most part standard ones like those to video displays, keyboards, and printers.But along with cheap, powerful, and versatile personal computers has developed a new interest in small, customized computers for specific uses. Each of these small computers is dedicated to one task, or a set of closely related tasks. Adding computer power to a device can enable it to do more, or do it faster, better, or more cheaply. For example, automobile engine controllers have helped to reduce harmful exhaust emissions. And microcontrollers inside computer modems have made it easy to add features and abilities beyond the basic computer-to-phone-line interface. In addition to their use in mass-produced products like these, it’s also become feasible to design computer power into one-of-a-kind projects, such as an environmental controller for a scientific study or an intelligent test fixture that ensures that a product meets its specifications before it’s shipped to a customer. At the core of many of these specialized computers is a microcontroller. The computer’sprogram is typically stored permanently in semiconductor memory such as ROM or EPROM. The interfaces between the microcontroller and the outside world vary with the application, and may include a small display, a keypad or switches, sensors, relays, motors, and so on.These small, special-purpose computers are sometimes called single-board computers, or SBCs. The term can be misleading, however, since the computer doesn’t have to be on a single circuit board, and many types of computer systems, such as laptop and notebook computers, are now manufactured on a single board.

15

Page 17: Metro Train Pro

Block diagram of the 80C51 Microcontroller

16

Page 18: Metro Train Pro

Pin Diagram of the 40 Pin DIP package of the 80C51

17

Page 19: Metro Train Pro

8051 architecture contains the following:

8 bit CPU with registers A and B

18

Page 20: Metro Train Pro

16 bit program counter(PC) and data pointer(DPTR)

8 bit program status word(PSW)

8 bit stack pointer

Internal ROM of 0(8031) to 4K(8051)

Internal RAM of 128 Bytes

4 register banks 00-1f

16 bytes(bit addressable) 20-2f

80 bytes of general purpose data memory 30-7f

32 I/O pins arranged as four 8 bit ports (P0 – P3)

2 16-bit timer/counters: T0 and T1

Full duplex serial data receiver/transmitter: SBUF

Control registers: TCON, TMOD, SCON, PCON, IPand IE

2 external and 3 internal interrupt sources

Oscillator and clock circuitsINTRODUCTION TO THE KEIL SOFTWARE

The Keil Software 8051 development tools are listed below. These are the programs that will perform the following:

19

Page 21: Metro Train Pro

Compile C Code Assemble the assembly source files. Link & Locate the object modules & the libraries. Create the HEX files. Debug the Target Program.

Micro Vision 2 is an interegated development Environment that Combines

Project management Source Code Editing Program debugging.

CSI ANSI: It is an optyimizing c Cross compiler that creates relocatable object modules from the C code.

ASI Macro Assembler : It assembles the assembly language program from the source code.

The BL51 linker/locator: It combines relocatable object modules that are created by the relocatable object6 modules created by the c51 compiler and the A51 assembler into absolute object module.

The LIB51 library manager combines object modules into libraries that may be used by the linker.

The OH51 Object HEX converter creates Intel Hex files fro0m the absolute object module.

The RTX51 real time operating system simpifies the design of the complex, time critical software projects.

INTRODUCTION TO THE PROJECT

20

Page 22: Metro Train Pro

This project is designed to demonstrate the technology used in the now a

day’s 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 controls 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.

In this project

In this project we try to give the same prototype for this type of trains.

We are using microcontroller 89c51 as CPU. 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 Bodhgaya, Rajgir, Nalanda .the stoppage time is

of 3 sec and time between two consecutive stations is 6sec.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 the brakes are applied and resumes journey when

the emergency situation is over.

So this project gives an illustration of actual modern metro train

controlled through embedded electronics control system.

Implementation: This project is implemented using the following kit

21

Page 23: Metro Train Pro

VPL-ET: VPL-ET Embedded trainer has been design by using

Phillips 879C61X2/ microchip PIC16F877/ Motorola 68HC11 Micro

controller. This controller provide in –system as well as in application

programming so that one may be able to write program and download

directly in the controller through serial port without removing it from

the system

System Specification

1. CPU: Phillips 879C61X2/ microchip PIC16F877/ Motorola 68HC11

2. 16 x 2 LCD Module (HY1602F4)

3. Six seven segment display

4. Stepper motor controller interface

5. 8 x 8 LED Matrix Display

6. ADC/DAC interface

7. Four data switches

8. Switch array

9. AT 24C16 Serial EEPROM

22

Page 24: Metro Train Pro

Interfacing an LCD to the 8051

LCD Operation: Our project chose LCD over Seven Segment Displays due to the following reasons:1)Ease of program of charcters.2)Ascii Values could be directly sent to the LCD.3)In built command words to control Display.

23

Page 25: Metro Train Pro

PIN DESCRIPTION OF LCD

PIN Symbol I/O Description1 V -- Ground2 V -- +5V Power

supply3 V -- Power supply

for contrast control

4 RS I 0 :Command Reg.1 : Data Reg.

5 R/W I 0: Write1: Read6 E I/O Enable7 DB0 I/O 8-bit Data Bus8 DB1 I/O 8-bit Data Bus9 DB2 I/O 8-bit Data Bus10 DB3 I/O 8-bit Data Bus11 DB4 I/O 8-bit Data Bus12 DB5 I/O 8-bit Data Bus13 DB6 I/O 8-bit Data Bus14 DB7 I/O 8-bit Data Bus

V CC , V SS , V EE

VCC- provides +5 volt

24

Page 26: Metro Train Pro

VSS provides gnd VEE is used to control LCD contrast

RS ( Register Select )

RS pin is used to select between the two different registers : DATA register & the COMMAND register . RS=0 => Select the command register RS=1 => Select the data register R/W ( Read / Write ) R/W input allows the user to write information to the LCD or read information from it. R/W =1 => when reading R/W =0 => when writing E ( Enable)

The Enable pin is used by the LCD to latch information presented to its data pins . 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 in the data pins. This pulse must be a minimum of 450 ns wide.

D0 – D7

25

Page 27: Metro Train Pro

The 8 – bit data pins ( d0 – D7) are used to send information to the LCD or read the content of the LCD internal Register. To display letters and numbers , we send ASCII codes for the letter A-Z , a-z & 0-9 to these pins while makin RS = 1. There are also Instruction Command Codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor.

The following table lists the instruction command codes:

Code ( HEX) Command to LCD instuction Register 1 Clear display screen2 Return Home 4 Decrement Cursor ( shift cursor to Left)6 Increment cursor (shift cursor to right )5 Shift display right7 Shift display left8 Display off , Cursor offA Display off , Cursor onC Display on , Cursor offE Display on , Cursor blinkingF Display on , Cursor Blinking10 Shift cursor position to left14 Shift cursor position to right18 Shift the entire display to the left1C Shift the entire display to the right80 Force cursor to beginning of 1st lineC0 Force cursor to beginning of 2nd line38 2 Lines and 5x7 matrix

26

Page 28: Metro Train Pro

CIRCUIT DIAGRAM

8051

LCD DISPLAY (For displaying the message)

LEDs

Port 0 pins connected to LCD data lines

Port 2 pins connected to LCD control lines (p2.0- RW/p2.1- RS/p2.2-EN)

27

Page 29: Metro Train Pro

Project Code

/*PROGRAM FOR METRO RAILWAY PROTOTYPE */

org 300hc1:db 'WELCOME TO LKO',0c2:db 'U R IN:-',0c3:db 'NEXT STATION:-',0c4: db 'MORADABAD',0c6:db 'BAREILY',0c5:db 'MEERUT',0c7:db'MADE BY SHOBHIT',0c8:db'TAUFIQUE',0org 0hmov a,#38h acall cmnwrtacall delaymov a,#01hacall cmnwrtacall delaymov a,#0ehacall cmnwrtacall Delaymov a,#80h acall cmnwrt acall delay mov dptr,#c1

28

Page 30: Metro Train Pro

a1:mov a,#0h movc a,@a+dptr acall datawrt acall delay acall delay jz loop inc dptr sjmp a1 loop:mov a,#01hacall cmnwrtacall delayacall delayacall delaymov a,#081hacall cmnwrtmov dptr,#c2 a2: clr a movc a,@a+dptr acall datawrt acall delay1 acall delay1 acall delay1 jz pl inc dptr sjmp a2pl:mov a,#089hacall cmnwrt mov dptr,#c4 a3: clr a movc a,@a+dptr acall datawrt acall delay jz ul

29

Page 31: Metro Train Pro

inc dptr sjmp a3 ul:mov a,#01h acall cmnwrt acall delay acall delay acall delay mov a,#81h acall cmnwrt mov dptr,#c6 a4: clr a movc a,@a+dptr acall datawrt acall delay1 acall delay1 acall delay1 jz df inc dptr sjmp a4df:mov a,#01hacall cmnwrtacall delaymov a,#80hacall cmnwrt mov dptr,#c3 a5:clr a movc a,@a+dptr acall datawrt acall delay1 acall delay1 acall delay1 jz ty inc dptr sjmp a5

30

Page 32: Metro Train Pro

ty: mov a,#0c9h acall cmnwrt mov dptr,#c5 a6:clr a movc a,@a+dptr acall datawrt acall delay acall delay acall delay jz rv inc dptr sjmp a6 rv:mov a,#01h acall cmnwrt acall delay mov a,#80h mov dptr,#c7 a7:clr a movc a,@a+dptr acall datawrt acall delay1 acall delay1 acall delay1 jz gh inc dptr sjmp a7 gh:mov a,#0c0h acall cmnwrt acall delay mov dptr,#c8 a8:clr a movc a,@a+dptr acall datawrt acall delay

31

Page 33: Metro Train Pro

acall delay inc dptr sjmp a8 again:sjmp again cmnwrt: mov p0,a clr p2.0 clr p2.1 setb p2.2 acall delay clr p2.2 ret datawrt: mov p0,a setb p2.1 clr p2.0 setb p2.2 acall delay clr p2.2 retdelay:mov r3,#70 here2:mov r4,#250 here:djnz r4,here djnz r3,here2 delay1:mov r1,#240 def:mov r2,#250 jkl:djnz r2,jkl djnz r1,def ret end

32

Page 34: Metro Train Pro

Program List File

A51 MACRO ASSEMBLER METRO2 07/04/2009 16:09:48 PAGE 1

MACRO ASSEMBLER A51 V8.00OBJECT MODULE PLACED IN .\metro2.objASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE \\System-7\E\ribhu1\metro2.asm SET(SMALL) DEBUG PRINT(.\metro2.lst) OBJECT (.\metro2.obj) EP

LOC OBJ LINE SOURCE

0300 1 org 300h0300 57454C43 2 c1:db 'WELCOME TO lko',00304 4F4D4520 0308 544F206C 030C 6B6F00 030F 55205220 3 c2:db 'U R IN:-',00313 494E3A2D 0317 00 0318 4E455854 4 c3:db 'NEXT STATION:-',0031C 20535441 0320 54494F4E 0324 3A2D00 0327 554E4E41 5 c4: db 'UNNAO',0032B 4F00 032D 47414E47 6 c6:db'GANGA RIVER',00331 41205249 0335 56455200 0339 4B414E50 7 c5:db 'KANPUR',0033D 555200 0340 4D414445 8 c7:db'MADE BY PREETI',00344 20425920 0348 50524545 034C 544900 034F 52494248 9 c8:db'RIBHU & RUCHIKA',00353 55202620 0357 52554348 035B 494B4100 0000 10 org 0h0000 7438 11 mov a,#38h 0002 11DD 12 acall cmnwrt0004 11F7 13 acall delay0006 7401 14 mov a,#01h0008 11DD 15 acall cmnwrt

33

Page 35: Metro Train Pro

000A 11F7 16 acall delay000C 740E 17 mov a,#0eh000E 11DD 18 acall cmnwrt0010 11F7 19 acall Delay0012 7480 20 mov a,#80h0014 11DD 21 acall cmnwrt0016 11F7 22 acall delay0018 900300 23 mov dptr,#c1001B 7400 24 a1:mov a,#0h001D 93 25 movc a,@a+dptr001E 11EA 26 acall datawrt0020 11F7 27 acall delay0022 11F7 28 acall delay0024 6003 29 jz loop0026 A3 30 inc dptr0027 80F2 31 sjmp a1 0029 32 loop:0029 7401 33 mov a,#01h002B 11DD 34 acall cmnwrt002D 11F7 35 acall delay002F 11F7 36 acall delay0031 11F7 37 acall delay0033 7481 38 mov a,#081h0035 11DD 39 acall cmnwrt

34

Page 36: Metro Train Pro

A51 MACRO ASSEMBLER METRO2 07/04/2009 16:09:48 PAGE 2

0037 90030F 40 mov dptr,#c2003A E4 41 a2: clr a003B 93 42 movc a,@a+dptr003C 11EA 43 acall datawrt003E 11FF 44 acall delay10040 11FF 45 acall delay10042 11FF 46 acall delay10044 6003 47 jz pl0046 A3 48 inc dptr0047 80F1 49 sjmp a20049 50 pl:0049 7489 51 mov a,#089h004B 11DD 52 acall cmnwrt004D 900327 53 mov dptr,#c40050 E4 54 a3: clr a0051 93 55 movc a,@a+dptr0052 11EA 56 acall datawrt0054 11F7 57 acall delay0056 6003 58 jz ul0058 A3 59 inc dptr0059 80F5 60 sjmp a3005B 7401 61 ul:mov a,#01h005D 11DD 62 acall cmnwrt005F 11F7 63 acall delay0061 11F7 64 acall delay0063 11F7 65 acall delay0065 7481 66 mov a,#81h0067 11DD 67 acall cmnwrt0069 90032D 68 mov dptr,#c6006C E4 69 a4: clr a006D 93 70 movc a,@a+dptr006E 11EA 71 acall datawrt0070 11FF 72 acall delay10072 11FF 73 acall delay10074 11FF 74 acall delay10076 6003 75 jz df0078 A3 76 inc dptr0079 80F1 77 sjmp a4007B 78 df:007B 7401 79 mov a,#01h007D 11DD 80 acall cmnwrt007F 11F7 81 acall delay0081 7480 82 mov a,#80h0083 11DD 83 acall cmnwrt0085 900318 84 mov dptr,#c30088 E4 85 a5:clr a0089 93 86 movc a,@a+dptr008A 11EA 87 acall datawrt

35

Page 37: Metro Train Pro

008C 11FF 88 acall delay1008E 11FF 89 acall delay10090 11FF 90 acall delay10092 6003 91 jz ty0094 A3 92 inc dptr0095 80F1 93 sjmp a50097 94 ty:0097 74C9 95 mov a,#0c9h0099 11DD 96 acall cmnwrt009B 900339 97 mov dptr,#c5009E E4 98 a6:clr a009F 93 99 movc a,@a+dptr00A0 11EA 100 acall datawrt00A2 11F7 101 acall delay00A4 11F7 102 acall delay00A6 11F7 103 acall delay00A8 6003 104 jz rv00AA A3 105 inc dptr

36

Page 38: Metro Train Pro

A51 MACRO ASSEMBLER METRO2 07/04/2009 16:09:48 PAGE 3

00AB 80F1 106 sjmp a600AD 7401 107 rv:mov a,#01h00AF 11DD 108 acall cmnwrt00B1 11F7 109 acall delay00B3 7480 110 mov a,#80h00B5 900340 111 mov dptr,#c700B8 E4 112 a7:clr a00B9 93 113 movc a,@a+dptr00BA 11EA 114 acall datawrt00BC 11FF 115 acall delay100BE 11FF 116 acall delay100C0 11FF 117 acall delay100C2 6003 118 jz gh00C4 A3 119 inc dptr00C5 80F1 120 sjmp a700C7 74C0 121 gh:mov a,#0c0h00C9 11DD 122 acall cmnwrt00CB 11F7 123 acall delay00CD 90034F 124 mov dptr,#c800D0 E4 125 a8:clr a00D1 93 126 movc a,@a+dptr00D2 11EA 127 acall datawrt00D4 11F7 128 acall delay00D6 11F7 129 acall delay00D8 A3 130 inc dptr00D9 80F5 131 sjmp a800DB 80FE 132 again:sjmp again00DD 133 cmnwrt:00DD F580 134 mov p0,a00DF C2A0 135 clr p2.000E1 C2A1 136 clr p2.100E3 D2A2 137 setb p2.200E5 11F7 138 acall delay00E7 C2A2 139 clr p2.200E9 22 140 ret00EA 141 datawrt:00EA F580 142 mov p0,a00EC D2A1 143 setb p2.100EE C2A0 144 clr p2.000F0 D2A2 145 setb p2.200F2 11F7 146 acall delay00F4 C2A2 147 clr p2.200F6 22 148 ret00F7 7B46 149 delay:mov r3,#7000F9 7CFA 150 here2:mov r4,#25000FB DCFE 151 here:djnz r4,here00FD DBFA 152 djnz r3,here200FF 79F0 153 delay1:mov r1,#240

37

Page 39: Metro Train Pro

0101 7AFA 154 def:mov r2,#2500103 DAFE 155 jkl:djnz r2,jkl0105 D9FA 156 djnz r1,def0107 22 157 ret 158 end

38

Page 40: Metro Train Pro

A51 MACRO ASSEMBLER METRO2 07/04/2009 16:09:48 PAGE 4

SYMBOL TABLE LISTING------ ----- -------

N A M E T Y P E V A L U E ATTRIBUTES

A1 . . . . . . . . C ADDR 001BH A A2 . . . . . . . . C ADDR 003AH A A3 . . . . . . . . C ADDR 0050H A A4 . . . . . . . . C ADDR 006CH A A5 . . . . . . . . C ADDR 0088H A A6 . . . . . . . . C ADDR 009EH A A7 . . . . . . . . C ADDR 00B8H A A8 . . . . . . . . C ADDR 00D0H A AGAIN. . . . . . . C ADDR 00DBH A C1 . . . . . . . . C ADDR 0300H A C2 . . . . . . . . C ADDR 030FH A C3 . . . . . . . . C ADDR 0318H A C4 . . . . . . . . C ADDR 0327H A C5 . . . . . . . . C ADDR 0339H A C6 . . . . . . . . C ADDR 032DH A C7 . . . . . . . . C ADDR 0340H A C8 . . . . . . . . C ADDR 034FH A CMNWRT . . . . . . C ADDR 00DDH A DATAWRT. . . . . . C ADDR 00EAH A DEF. . . . . . . . C ADDR 0101H A DELAY. . . . . . . C ADDR 00F7H A DELAY1 . . . . . . C ADDR 00FFH A DF . . . . . . . . C ADDR 007BH A GH . . . . . . . . C ADDR 00C7H A HERE . . . . . . . C ADDR 00FBH A HERE2. . . . . . . C ADDR 00F9H A JKL. . . . . . . . C ADDR 0103H A LOOP . . . . . . . C ADDR 0029H A P0 . . . . . . . . D ADDR 0080H A P2 . . . . . . . . D ADDR 00A0H A PL . . . . . . . . C ADDR 0049H A RV . . . . . . . . C ADDR 00ADH A TY . . . . . . . . C ADDR 0097H A UL . . . . . . . . C ADDR 005BH A

REGISTER BANK(S) USED: 0

ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

39

Page 41: Metro Train Pro

A51 MACRO ASSEMBLER METRO2 07/03/2009 15:42:10 PAGE 4

0130 7AFA 179 def:mov r2,#2500132 DAFE 180 jkl:djnz r2,jkl0134 D9FA 181 djnz r1,def0136 22 182 ret 183 end

40

Page 42: Metro Train Pro

A51 MACRO ASSEMBLER METRO2 07/03/2009 15:42:10 PAGE 5

SYMBOL TABLE LISTING------ ----- -------

N A M E T Y P E V A L U E ATTRIBUTES

A1 . . . . . . . . C ADDR 001DH A A2 . . . . . . . . C ADDR 003EH A A3 . . . . . . . . C ADDR 0054H A A4 . . . . . . . . C ADDR 0072H A A5 . . . . . . . . C ADDR 0090H A A6 . . . . . . . . C ADDR 00A6H A AGAIN. . . . . . . C ADDR 00B3H A C1 . . . . . . . . C ADDR 0300H A C2 . . . . . . . . C ADDR 030FH A C3 . . . . . . . . C ADDR 0318H A C4 . . . . . . . . C ADDR 0327H A C5 . . . . . . . . C ADDR 0339H A C6 . . . . . . . . C ADDR 032DH A CMNWRT . . . . . . C ADDR 00B5H A D1 . . . . . . . . C ADDR 00D1H A D11. . . . . . . . C ADDR 00FDH A D2 . . . . . . . . C ADDR 00DDH A D3 . . . . . . . . C ADDR 00EBH A DATAWRT. . . . . . C ADDR 00C2H A DD2. . . . . . . . C ADDR 0109H A DD3. . . . . . . . C ADDR 0117H A DEF. . . . . . . . C ADDR 0130H A DELAY. . . . . . . C ADDR 0126H A DELAY1 . . . . . . C ADDR 012EH A DF . . . . . . . . C ADDR 0081H A HERE . . . . . . . C ADDR 012AH A HERE2. . . . . . . C ADDR 0128H A JKL. . . . . . . . C ADDR 0132H A LOOP . . . . . . . C ADDR 002BH A P0 . . . . . . . . D ADDR 0080H A P1 . . . . . . . . D ADDR 0090H A P2 . . . . . . . . D ADDR 00A0H A P3 . . . . . . . . D ADDR 00B0H A PL . . . . . . . . C ADDR 004DH A RIBHU. . . . . . . C ADDR 00CFH A RIBHU1 . . . . . . C ADDR 00FBH A TY . . . . . . . . C ADDR 009FH A UL . . . . . . . . C ADDR 005FH A

REGISTER BANK(S) USED: 0

ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)

41

Page 43: Metro Train Pro

SYMBOL TABLE LISTING------ ----- -------

N A M E T Y P E V A L U E ATTRIBUTES

A1 . . . . . . . . C ADDR 002EH A AGAIN. . . . . . . C ADDR 01F8H A AGAIN1 . . . . . . C ADDR 0210H A AGAIN10. . . . . . C ADDR 02D5H A AGAIN11. . . . . . C ADDR 02E3H A AGAIN12. . . . . . C ADDR 02FBH A AGAIN13. . . . . . C ADDR 0315H A AGAIN14. . . . . . C ADDR 0323H A AGAIN15. . . . . . C ADDR 033BH A AGAIN16. . . . . . C ADDR 0355H A AGAIN17. . . . . . C ADDR 0363H A AGAIN2 . . . . . . C ADDR 021EH A AGAIN3 . . . . . . C ADDR 0236H A AGAIN4 . . . . . . C ADDR 0250H A AGAIN5 . . . . . . C ADDR 025EH A AGAIN6 . . . . . . C ADDR 0276H A AGAIN7 . . . . . . C ADDR 0290H A AGAIN8 . . . . . . C ADDR 029EH A AGAIN9 . . . . . . C ADDR 02BDH A AGAINA . . . . . . C ADDR 0030H A

ALLAHABAD. . . . . C ADDR 0045H A BACK1. . . . . . . C ADDR 0196H A BACK3. . . . . . . C ADDR 01B5H A BACKA. . . . . . . C ADDR 01BAH A BACKB. . . . . . . C ADDR 019BH A BACKC. . . . . . . C ADDR 01D4H A BACKD. . . . . . . C ADDR 01CCH A BACKE. . . . . . . C ADDR 018EH A BACKF. . . . . . . C ADDR 01ADH A BHADOHI. . . . . . C ADDR 0035H A

CS . . . . . . . . C ADDR 00B5H A D. . . . . . . . . C ADDR 02A5H A

DELAY. . . . . . . C ADDR 01C7H A DELAY1 . . . . . . C ADDR 0189H A DELAY3 . . . . . . C ADDR 01A8H A DELAYA . . . . . . C ADDR 002CH A

DOWNJOURNEY. . . . C ADDR 0081H A LCD_CMD. . . . . . C ADDR 0002H A LCD_WRITE. . . . . C ADDR 000FH A

LED1 . . . . . . . C ADDR 012DH A LED3 . . . . . . . C ADDR 015BH A MAIN . . . . . . . C ADDR 036AH A OUT. . . . . . . . C ADDR 01BEH A OUT1 . . . . . . . C ADDR 019FH A P0 . . . . . . . . D ADDR 0080H A

42

Page 44: Metro Train Pro

P1 . . . . . . . . D ADDR 0090H A P2 . . . . . . . . D ADDR 00A0H A P3 . . . . . . . . D ADDR 00B0H A PN . . . . . . . . C ADDR 00F5H A TF0. . . . . . . . B ADDR 0088H.5 A TH0. . . . . . . . D ADDR 008CH A TL0. . . . . . . . D ADDR 008AH A

TMOD . . . . . . . D ADDR 0089H A TR0. . . . . . . . B ADDR 0088H.4 A U. . . . . . . . . C ADDR 01E0H A

UPJOURNEY. . . . . C ADDR 0055H A VARANASI . . . . . C ADDR 001CH A

REGISTER BANK(S) USED: 0 A51 MACRO ASSEMBLER METRO1 05/14/2009 11:25:12 PAGE 10

ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S

BIBLIOGYRAPHYBooks:

Title: The 8051 Microcontroller and Embedded System. Author: Muhammad Ali Mazidi & Janice Gillispie Mazidi. Publication: Pearson Education.

Title: Embedded Systems: Architecture, Programming & Design.Author: Raj KamalPublication: Tata McGraw Hill

43

Page 45: Metro Train Pro

Title: Programming & Customizing the 8051 MicrocontrollerAuthor: Myke PredkoPublication: Tata McGraw Hill

Title: The 8051 MicrocontrollerAuthor: J. H. Ayala

Publication: Eastern Economy Edition

Magazines: ELECTRONICS FOR YOU, APRIL 2005.

Websites:

SOFTWARE: www.keil.com Down loader: www.easacademy.com Reference: www.efymag.com Datasheets: www.datasheetarchive.com

44