You are on page 1of 36

METRO TRAIN PROTOTYPE USING 8051

SUBMITTED BY: Gagan Gangwar Harjeet Singh Om Prakash Singh Shoeb Danish

Semiconductor Technologies
EDUCATION AND TRAINING

VEDANT

CERTIFICATE
To whom it May concern This is to certified that 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 Ms.Nirmal Chauhan , Ms. Anupam Maurya & Mr.Amit Chandra.

Certificate is awaited
ST VEDANT LUCKNOW 2

CERTIFIED BY:
Mr. Amit Chandra Mr.Sachin Kr. Kanodia

(Project Guide)

(Center Head)

A CKNOWLEDGEMENT
No academic endeavor can be single handedly

accomplished. This work is no exception. 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 Ms.Nirmal Chauhan, Ms. Anupam Maurya and Mr. Amit Chandra 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. Charu Agarwal for their kind cooperation and assistance during our training period.

ST VEDANT LUCKNOW

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

ST VEDANT LUCKNOW

INDEX
S.No. 1. 2. 3. 4. 5. 6. 7. 8. Title Introduction To Semiconductor Technologies - Vedant. Introduction to Embedded Systems Introduction to the Microcontroller Block Diagram of the System Introduction to the Keil Software Introduction To The Project Circuit Diagram Program Code Page 5 7 12 15 18 19 25 26

ST VEDANT LUCKNOW

9.

Bibliography

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

S EMICONDUCTOR T ECHNOLOGIES VEDANT

M/s Semiconductor Technologies-VEDANT is Indias premier VLSI Design & Embedded System Design organization since 2002.While VEDANT is Indias 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 chipsmaking a career in

ST VEDANT LUCKNOW

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 TechnologiesVEDANT (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.

ST-Vedant
VEDANT (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. 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.0a Xilinx tools FPGA Kit 8051 Development Kit Keil Software Flash Magic (Rom burning)

ST VEDANT LUCKNOW

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 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 RealTime System Real-Time System A 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.
ST VEDANT LUCKNOW 8

Hard Real-Time System Output response must be computed by specified deadline or system fails.

Programmin g

Logical/Dig ital Design Embedded Systems

Computer Systems Organization

Embed ded & Real Time System s

DSP Advance d Digital Design (Synthesi s) VLSI/ASI C & SoC Design Control System s

ST VEDANT LUCKNOW

Programming Languages Used in New Embedded Designs

90.0% 80.0% 70.0% 60.0% 50.0% 40.0% 30.0% 20.0% 10.0% 0.0% Assembly C C++ Java Other

1998-1999 1999-2000

ST VEDANT LUCKNOW

10

Micro Controllers Trend in the Embedded Systems

100.0% 80.0% 60.0% 40.0% 20.0% 0.0% 4-bit 8-bit 16-bit 32-bit 64-bit Special

Application of embedded systems in sphere of life


ST VEDANT LUCKNOW 11

Consumer electronics Telecommunication Automobile Medical instrumentation Industrial control equipment Defense Communication satellite Data communication Internet appliances

ST VEDANT LUCKNOW

12

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 automobilesjust 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 A microcontroller is similar to the microprocessor inside a personal computer. Examples of microprocessors include Intels 8086, Motorolas 68000, and Zilogs 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 Intels 8052 (including the 8052-BASIC, which is the focus of this book), Motorolas 68HC11, and Zilogs Z8.

ST VEDANT LUCKNOW

13

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 Altairs 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. Whats more, theres no longer any need to build a 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 Apples Macintosh or IBMs PC is a general-purpose machine, since you can use it for many applicationsword processing, spreadsheets, computeraided design, and morejust 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-phoneline interface. In addition to their use in mass-produced products like these, its also become feasible to design computer power into one-of-aST VEDANT LUCKNOW 14

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 its shipped to a customer. At the core of many of these specialized computers is a microcontroller. The computers program 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 singleboard computers, or SBCs. The term can be misleading, however, since the computer doesnt 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.

ST VEDANT LUCKNOW

15

Block diagram of the 80C51 Microcontroller

ST VEDANT LUCKNOW

16

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

ST VEDANT LUCKNOW

17

8051 architecture contains the following: 8 bit CPU with registers A and B 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 circuits
ST VEDANT LUCKNOW 18

INTRODUCTION TO THE KEIL SOFTWARE


The Keil Software 8051 development tools are listed below. These are the programs that will perform the following: 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.
ST VEDANT LUCKNOW 19

INTRODUCTION TO THE PROJECT


This project is designed to demonstrate 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 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.
ST VEDANT LUCKNOW 20

Implementation: This project is implemented using the following kit 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

ST VEDANT LUCKNOW

21

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.

ST VEDANT LUCKNOW

22

PIN DESCRIPTION OF LCD PIN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Symbol V V V RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 I/O ---I I I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Ground +5V Power supply Power supply for contrast control 0 :Command Reg. 1 : Data Reg. 0: Write1: Read Enable 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus 8-bit Data Bus

VCC , VSS , VEE VCC- provides +5 volt VSS provides gnd VEE is used to control LCD contrast

RS ( Register Select )
ST VEDANT LUCKNOW 23

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 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:


ST VEDANT LUCKNOW 24

Code ( HEX) 1 2 4 6 5 7 8 A C E F 10 14 18 1C 80 C0 38

Command to LCD instuction Register Clear display screen Return Home Decrement Cursor ( shift cursor to Left) Increment cursor (shift cursor to right ) Shift display right Shift display left Display off , Cursor off Display off , Cursor on Display on , Cursor off Display on , Cursor blinking Display on , Cursor Blinking Shift cursor position to left Shift cursor position to right Shift the entire display to the left Shift the entire display to the right Force cursor to beginning of 1st line Force cursor to beginning of 2nd line 2 Lines and 5x7 matrix

ST VEDANT LUCKNOW

25

CIRCUIT DIAGRAM

Port 0 pins connected to LCD data lines

LEDs

ST VEDANT LUCKNOW

LCD DISPLAY (For displaying the message)

8 0 5 1

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

26

PROGRAM CODING
MOV DPTR,#400H MOV R1,#6 DO1:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY INC DPTR DJNZ R1,DO1 MOV DPTR,#450H MOV P1,#00H SETB P1.0 DO2:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A5 INC DPTR SJMP DO2 A5: MOV DPTR,#490H MOV R1,#5 DO4:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY

ST VEDANT LUCKNOW

27

INC DPTR DJNZ R1,DO4 MOV DPTR,#500H CLR P1.0 SETB P1.1 DO3:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A6 INC DPTR SJMP DO3 A6:MOV DPTR,#550H DO5:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY JZ A7 INC DPTR SJMP DO5 A7:MOV DPTR,#600H DO6:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A20 INC DPTR SJMP DO6

ST VEDANT LUCKNOW

28

A20:MOV DPTR,#490H MOV R1,#5 DO7:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY INC DPTR DJNZ R1,DO7 MOV DPTR,#650H DO8:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A8 INC DPTR SJMP DO8 A8:MOV DPTR,#550H DO9:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY JZ A9 INC DPTR SJMP DO9 A9:MOV DPTR,#700H DO10:CLR A MOVC A,@A+DPTR

ST VEDANT LUCKNOW

29

ACALL DATA1 ACALL DELAY JZ A10 INC DPTR SJMP DO10 A10:NOP MOV DPTR,#490H MOV R1,#5 DO11:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY INC DPTR DJNZ R1,DO11 MOV DPTR,#750H CLR P1.1 SETB P1.2 DO12:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A12 INC DPTR SJMP DO12 A12:MOV DPTR,#790H DO13:CLR A MOVC A,@A+DPTR ACALL COMM

ST VEDANT LUCKNOW

30

ACALL DELAY JZ A13 INC DPTR SJMP DO13 A13:MOV DPTR,#800H DO14:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A14 INC DPTR SJMP DO14 A14:NOP MOV DPTR,#490H MOV R1,#5 DO15:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY INC DPTR DJNZ R1,DO15 MOV DPTR,#850H CLR P1.2 SETB P1.1 DO16:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY

ST VEDANT LUCKNOW

31

JZ A15 INC DPTR SJMP DO16 A15:MOV DPTR,#550H DO17:CLR A MOVC A,@A+DPTR ACALL COMM ACALL DELAY JZ A16 INC DPTR SJMP DO17 A16:MOV DPTR,#900H DO18:CLR A MOVC A,@A+DPTR ACALL DATA1 ACALL DELAY JZ A17 INC DPTR SJMP DO18 A17:NOP COMM:MOV P0,A CLR P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DATA1:MOV P0,A

ST VEDANT LUCKNOW

32

SETB P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DELAY:MOV TMOD,#01H MOV TL0,#0EDH MOV TH0,#0FFH SETB TR0 A2:JNB TF0,A2 CLR TF0 CLR TR0 RET ORG 400H DB 38H,0EH,01H,06H,80H,07H ORG 450H DB "WELCOME TO METRO STATION",0 ORG 490H DB 38H,0EH,01H,06H,80H ORG 500H DB "SRC STN : LKO",0 ORG 550H

DB 38H,0EH,06H,0C0H,0 ORG 600H DB "DTN STN : GZB",0 ORG 650H

ST VEDANT LUCKNOW

33

DB "CRT STN : LKO",0 ORG 700H DB "NXT STN : CNB",0 ORG 750H DB "TIME REMAINING",0 ORG 790H DB 38H,0EH,06H,0C0H,14H,07H,0 ORG 800H DB 9,8,7,6,5,4,3,2,1,0 ORG 850H DB "CRT STN : CNB",0 ORG 900H DB "NXT STN : ETW",0 END

ST VEDANT LUCKNOW

34

BIBILOGRAPHY
Books: 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 Kamal Publication: Tata McGraw Hill Title: Programming & Customizing the 8051 Microcontroller Author: Myke Predko Publication: Tata McGraw Hill Title: The 8051 Microcontroller Author: J. H. Ayala Publication: Eastern Economy Edition Magazines: ELECTRONICS FOR YOU, APRIL 2005. Websites:

SOFTWARE: www.keil.com Down loader: www.easacademy.com


ST VEDANT LUCKNOW 35

Reference: www.efymag.com Datasheets: www.datasheetarchive.com

ST VEDANT LUCKNOW

36

You might also like