Report On Project Based On 8051 Micro Controller
Report On Project Based On 8051 Micro Controller
By
2009-2010
A
[1]
PROJECT REPORT
ON
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS & COMMUNICATION ENGINEERING
U.P. Technical University, Lucknow
SUBMITTED BY:
Brijendra Mohan Gupta
GUIDED BY:
Mr. V.K.Aggarwal (Sr. Lec)
IMS ENGINEERING COLLEGE, GHAZIABAD
[2]
CERTIFICATE
Bachelor of Technology
(Electronics & Communication)
of
U.P. Technical University, Lucknow
Session 2008-2009
The matter in this Project report is a record of the students own work carried
out under my supervision and guidance. The matter embodied in this report
has not been submitted by anyone for award of any degree/ diploma.
We wish them all the success in future endeavors.
[3]
ACKNOWLEDGEMENT
This work has been possible through the direct and indirect co-operation of various
people of IMSEC towards whom we wish to express my gratitude.
We are also thankful to Dr. Sanjay Gairola (H.O.D., Electronics & Communication
Department, IMSEC, Ghaziabad) and Prof. V.K. Gupta (Electronics & Communication
Department, IMSEC, Ghaziabad) for their valuable suggestions.
ANKIT MITTAL
CHETANYA SHARMA
BRIJENDRA MOHAN GUPTA
B. Tech. (EC Final Year)
IMS Engineering College, Ghaziabad
List of Contents
[4]
1.Introduction 8-9
1.1Objectives 8
1.2Features 8
1.3Overview 8
1.4Schematic Representation of Project 9
2. Microcontroller(AT89C51) 10-25
2.1 Introduction 10
2.2 Definition of a Microcontroller 11
2.3 Microcontrollers vs Microprocessors 12
2.4 Memory Unit 13
2.5 Central Processing Unit 14
2.6 Bus 14
2.7 Input Output Unit 15
2.8 Serial Communication 15
2.9 Timer Unit 16
2.10 Watch Dog 17
2.11 Analog to Digital Converter 17
2.12 Pin Configuration 20
2.13 RAM Architecture 23
[5]
6.2 Circuit Diagram of the Project 47
6.3 Project Methodology 48
6.3(a) Components 48
6.3(b) Software Used 48
6.3(c) Equipments Used 48
6.4 Procedure of building the Prototype of Metro Train 48
6.5 General Working 49
7. Future Scope 50
Appendix-I 52-55
Appendix-II 56-62
[6]
LIST OF FIGURES
Fig 2.1 Showing a typical microcontroller device and its different subunits 11
Fig 2.4 Showing connection between memory and central unit using buses 14
Fig 2.6 Serial unit sending data through three lines only 16
Fig 2.11 Microcontroller outline with basic elements and internal connections 19
[7]
Fig 5.4 Regulator IC 78XX 38
1.INTRODUCTION
1.1 Objective
1. To construct a model of a metro train controlled by 8051
[8]
2. To write a program in assembly language that will help microcontroller to control buzzer,
LCD, stepper motor.
1.1 Features
➢ Microcontroller AT89C51 to control the whole circuitry of the prototype.
➢ Stepper motor , to control the motion of the train
➢ Intelligent LCD , for displaying messages in the train
➢ Buzzer, as indicator, to inform stoppage of train
1.1 OVERVIEW
In the project, we have tried to give the above mentioned prototype for this train. We are using
microcontroller 89C51 to control the whole circuitry. The motion of the train is controlled by the
stepper motor. For displaying message in the train, we are using intelligent LCD display having
two lines. The train is designed for the five stations named Kishan Ganj, Pratap Nagar,
Shahadara, Indraprashta and Rohini West. The stoppage time of the train is programmed as 3
sec and the time taken by the train between two consecutive station is programmed as 6 sec.
There is a LCD display for showing various messages in the train for passenger’s
convenience.like current station is Indraprastha and next station is Rohini West. Before stopping
at station, the buzzer sounds for 3 seconds.
[9]
Fig1.1 Schematic representation of the project
This is a schematic representation, which shows all the important parts of the project. To
understand the project, one must go through all the parts in detail. The project also consists of an
assembly language program, which controls the operation of the microcontroller. We have used
Microcontroller AT89C51 as CPU to control the overall functionality of the project, Stepper
motor to control the motion of the train, Intelligent LCD for displaying messages in the train and
a buzzer to inform stoppage of the train.
The project consists of following important parts:
1. Microcontroller (AT89C51)
2. LCD display(16 characters x 2)
3. DC motors
4. Buzzer(5 volt)
5. Other components like resistors(1k,10k),capacitors(33 pF) etc.
2. MICROCONTROLLER(AT89C51)
2.1 Introduction
[10]
Circumstances that we find ourselves in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This development has made
it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for
production of microprocessors, and the first computers were made by adding external peripherals
such as memory, input-output lines, timers and other. Further increasing of the volume of the
package resulted in creation of integrated circuits. These integrated circuits contained both
processor and peripherals. That is how the first chip containing a microcomputer, or what would
later be known as a microcontroller came about.
2.2 Definition of a Microcontroller
Microcontroller, as the name suggests, are small controllers. They are like single chip computers
that are often embedded into other systems to function as processing/controlling unit. For
example, the remote control you are using probably has microcontrollers inside that do decoding
and other controlling functions. They are also used in automobiles, washing machines,
microwave ovens, toys ... etc, where automation is needed.
The key features of microcontrollers include:
➢ High Integration of Functionality
➢ Microcontrollers sometimes are called single-chip computers because they have on-chip
memory and I/O circuitry and other circuitries that enable them to function as small
standalone computers without other supporting circuitry.
➢ Field Programmability, Flexibility
➢ Microcontrollers often use EEPROM or EPROM as their storage device to allow field
programmability so they are flexible to use. Once the program is tested to be correct then
large quantities of microcontrollers can be programmed to be used in embedded systems.
➢ Easy to Use
Assembly language is often used in microcontrollers and since they usually follow RISC
architecture, the instruction set is small. The development package of microcontrollers
often includes an assembler, a simulator, a programmer to "burn" the chip and a
demonstration board. Some packages include a high level language compiler such as a C
compiler and more sophisticated libraries.
[11]
Figure 2.1: Showing a typical microcontroller device and its different subunits
The heart of the microcontroller is the CPU core. In the past this has traditionally been based on
an 8-bit microprocessor unit.
2.3 Microcontrollers versus Microprocessors
Microcontroller differs from a microprocessor in many ways. First and the most important is its
functionality. In order for a microprocessor to be used, other components such as memory, or
components for receiving and sending data must be added to it. In short that means that
microprocessor is the very heart of the computer. On the other hand, microcontroller is designed
to be all of that in one. No other external components are needed for its application because all
necessary peripherals are already built into it. Thus, we save the time and space needed to
construct devices
2.4 Memory unit
Memory is part of the microcontroller whose function is to store data.
The easiest way to explain it is to describe it as one big closet with lots of drawers. If we suppose
that we marked the drawers in such a way that they can not be confused, any of their contents
will then be easily accessible. It is enough to know the designation of the drawer and so its
contents will be known to us for sure.
[12]
Figure2.2: Simplified model of a memory unit
Memory components are exactly like that. For a certain input we get the contents of a certain
addressed memory location and that's all. Two new concepts are brought to us: addressing and
memory location. Memory consists of all memory locations, and addressing is nothing but
selecting one of them. This means that we need to select the desired memory location on one
hand, and on the other hand we need to wait for the contents of that location. Besides reading
from a memory location, memory must also provide for writing onto it. This is done by
supplying an additional line called control line. We will designate this line as R/W (read/write).
Control line is used in the following way: if r/w=1, reading is done, and if opposite is true then
writing is done on the memory location. Memory is the first element, and we need a
few operation of our microcontroller.
The amount of memory contained within a microcontroller varies between different
microcontrollers. Some may not even have any integrated memory (e.g. Hitachi 6503, now
discontinued). However, most modern microcontrollers will have integrated memory. The
memory will be divided up into ROM and RAM, with typically more ROM than RAM.
Typically, the amount of ROM type memory will vary between around 512 bytes and 4096
bytes, although some 16 bit microcontrollers such as the Hitachi H8/3048 can have as much as
128 Kbytes of ROM type memory.
ROM type memory, as has already been mentioned, is used to store the program code. ROM
memory can be ROM (as in One Time Programmable memory), EPROM, or EEPROM.
The amount of RAM memory is usually somewhat smaller, typically ranging between 25 bytes
to 4 Kbytes.
RAM is used for data storage and stack management tasks. It is also used for register stacks (as
in the microchip PIC range of microcontrollers).
[13]
2.5 Central Processing Unit
Let add 3 more memory locations to a specific block that will have a built in capability to
multiply, divide, subtract, and move its contents from one memory location onto another. The
part we just added in is called "central processing unit" (CPU). Its memory locations are called
registers.
Registers are therefore memory locations whose role is to help with performing various
mathematical operations or any other operations with data wherever data can be found. Look at
the current situation. We have two independent entities (memory and CPU) which are
interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for
example, we wish to add the contents of two memory locations and return the result again back
to memory, we would need a connection between memory and CPU. Simply stated, we must
have some "way" through data goes from one block to another.
2.6 Bus
That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires.
There are two types of buses: address and data bus. The first one consists of as many lines as the
amount of memory we wish to address and the other one is as wide as data, in our case 8 bits or
the connection line. First one serves to transmit address from CPU memory, and the second to
connect all blocks inside the microcontroller.
[14]
Figure2.4: Showing connection between memory and central unit using buses
As far as functionality, the situation has improved, but a new problem has also appeared: we
have a unit that's capable of working by itself, but which does not have any contact with the
outside world, or with us! In order to remove this deficiency, let's add a block which contains
several memory locations whose one end is connected to the data bus, and the other has
connection with the output lines on the microcontroller which can be seen as pins on the
electronic component.
[15]
When working with it the port acts like a memory location. Something is simply being written
into or read from it, and it could be noticed on the pins of the microcontroller.
As we have separate lines for receiving and sending, it is possible to receive and send data (info.)
at the same time. So called full-duplex mode block which enables this way of communication is
called a serial communication block. Unlike the parallel transmission, data moves here bit by bit,
or in a series of bits what defines the term serial communication comes from. After the reception
of data we need to read it from the receiving location and store it in memory as opposed to
sending where the process is reversed. Data goes from memory through the bus to the sending
location, and then to the receiving unit according to the protocol.
[16]
2.9 Timer unit
Since we have the serial communication explained, we can receive, send and process data.
2.10 Watchdog
One more thing is requiring our attention is a flawless functioning of the microcontroller
during its run-time. Suppose that as a result of some interference (which often does occur in
industry) our microcontroller stops executing the program, or worse, it starts working
incorrectly.
Figure2.8: Watchdog
Of course, when this happens with a computer, we simply reset it and it will keep working.
However, there is no reset button we can push on the microcontroller and thus solve our
problem. To overcome this obstacle, we need to introduce one more block called watchdog. This
block is in fact another free-run counter where our program needs to write a zero in every time it
executes correctly. In case that program gets "stuck", zero will not be written in, and counter
alone will reset the microcontroller upon achieving its maximum value. This will result in
executing the program again, and correctly this time around. That is an important element of
every program to be reliable without man's supervision.
[18]
Figure2.11: Microcontroller outline with basic elements and internal connections
For a real application, a microcontroller alone is not enough. Beside a microcontroller, we need a
program that would be executed, and a few more elements which make up interface logic
towards the elements of regulation (which will be discussed in later chapters).
[19]
Figure2.12 Pin configuration of Microcontroller
XTAL1 (Pin 19) and XTAL2 (Pin 18) Crystal Oscillator connected to pins 18, 19.
External Access: EA 31
• Connected to Ground for external ROM containing the code Input Pin
[20]
I/O Port Pins and their Functions:
Four ports P0,P1,P2,P3 with 8 pins each, making a total of 32 input/output pins.
PORT 0
• Pins 32-39
• Dual role: 8051 multiplexes address and data through port 0 to save pins .AD0-AD7
PORT 1
• Pins 1 through 8
• No dual function
PORT 2
• Pins 21 through 28
• Dual Function: Along with Port 0 used to provide the 16-Bit address for external
memory. It provides higher address A8-A16
PORT 3
• Pins 10 through 17
• No external pull up resistors required
We have 4 ports in 8051 micro controller. They are port0, port1, port2, port3 which can
be accessed as i/o ports. The pins of the micro controller are explained below.
[21]
Reset: It resets total 8051 micro controller.
T0: Timer0.
T1: Timer1.
ALE: Address latch enable which is used to access the address locations
from external memory.
[22]
Fig 2.13 RAM Architecture
The 8051 has a bank of 128 bytes of Internal RAM. This Internal RAM is found on-chip on the
8051 so it is the fastest RAM available, and it is also the most flexible in terms of reading,
writing, and modifying its contents. Internal RAM is volatile, so when the 8051 is reset this
memory is cleared. The 128 bytes of internal ram is subdivided as shown on the memory map.
The first 8 bytes (00h - 07h) are "register bank 0". These alternative register banks are located in
internal RAM in addresses 08h through 1Fh.Bit memory actually resides in internal RAM, from
addresses 20h through 2Fh. The 80 bytes remaining of Internal RAM, from addresses 30h
through 7Fh, may be used by user variables that need to be accessed frequently or at high-speed.
This area is also utilized by the microcontroller as a storage area for the operating stack.
Register Banks
The 8051 uses 8 "R" registers which are used in many of its instructions. These "R" registers are
numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6, and R7).These registersare generally
used to assist in manipulating values and moving data from one memory location to another. The
concept of register banks adds a great level of flexibility to the 8051.
Bit Memory
[23]
The 8051, being a communication oriented microcontroller, gives the user the ability to access a
number of bit variables. These variables may be either 1 or 0. There are 128 bit variables
available to the user, numbered 00h through 7Fh. The user may make use of these variables with
commands such as SETB and CLR. It is important to note that Bit Memory is really a part of
Internal RAM. In fact, the 128 bit variables occupy the 16 bytes of Internal RAM from 20h
through 2Fh.
Registers
The Accumulator
The Accumulator, as its name suggests, is used as a general register to accumulate the results of
a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile
register
[24]
The Program Counter (PC) is a 2-byte address which tells the 8051 where the next instruction to
execute is found in memory. When the 8051 is initialized PC always starts at 0000h and is
incremented each time an instruction is executed.
.
Addressing Modes
An "addressing mode" refers to how you are addressing a given memory location. The
addressing modes are as follows,
With an example of each:
Immediate Addressing MOV A, #20h
Direct Addressing MOV A, #30h
Indirect Addressing MOV A, @R0
External Direct MOVX A, @DPTR
Code Indirect MOVC A, @A+DPTR
Each of these addressing modes provides important flexibility.
Interrupts
An interrupt is a special feature which allows the 8051 to provide the illusion of "multitasking,"
although in reality the 8051 is only doing one thing at a time.
.
Timers
Timers are one of the categories of hardware time delays. Time delays are used to keep a system
into halting System or sleepy mode. We have two timers-timer0, timer1.Hardware time delays
are used to generate exact time delays.
[25]
3. LCD INTERFACING
Basic diagram of LCD is as shown in figure, and description of its layers as follows:
1. Polarizing filter film with a vertical axis to polarize light as it enters.
2. Glass substrate with ITO electrodes. The shapes of these electrodes will determine the
shapes that will appear when the LCD is turned ON. Vertical ridges etched on the surface
are smooth.
3. Twisted liquid crystal.
4. Glass substrate with common electrode film (ITO) with horizontal ridges to line up with
the horizontal filter.
5. Polarizing filter film with a horizontal axis to block/pass light.
6. Reflective surface to send light back to viewer. (In a backlit LCD, this layer is replaced
with a light source.)
[26]
Fig 3.2 Different layers of LCD
A Liquid Crystal Display (LCD) is a thin, flat panel used for electronically displaying
information such as text, images, and moving pictures. Its uses include monitors for computers,
televisions, instrument panels. Among its major features are its lightweight construction, its
portability, and its ability to be produced in much larger screen sizes than are practical for the
construction of cathode ray tube (CRT) display technology. Its low electrical power consumption
enables it to be used in battery-powered electronic equipment. It is an electronically-modulated
optical device made up of any number of pixels filled with liquid crystals and arrayed in front of
a light source(backlight or reflector) to produce images in color or monochrome.
[27]
Fig 3.3 Pin diagram of LCD
[28]
flag is cleared (BF = 0). This is helpful in producing and exact amount of delay. For the LCD
processing. To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of
the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept
next command or data and BF = 0 means LCD is ready for the next command or data to process.
[29]
Fig 3.4 Interfacing of LCD
EN – Enable
Used to latch the data present on the data pins.
The EN line must be raised/lowered before/after each instruction sent to the
LCD regardless of whether that instruction is read or writes text or instruction.
If you don't raise/lower EN, the LCD doesn't know you're talking to it on the other lines.
RS – Register Select
RS = 0 → Command Register
RS = 1 → Data Register
4.1 INTRODUCTION
A direct current (DC) motor is a fairly simple electric motor that uses electricity and a magnetic
field to produce torque, which turns the motor. At its most simple, a DC motor requires two
magnets of opposite polarity and an electric coil, which acts as an electromagnet. The repellent
[30]
and attractive electromagnetic forces of the magnets provide the torque that causes the DC motor
to turn.
A DC motor requires at least one electromagnet. This electromagnet switches the current flow as
the motor turns, changing its polarity to keep the motor running. The other magnet or magnets
can either be permanent magnets or other electromagnets. Often, the electromagnet is located in
the center of the motor and turns within the permanent magnets, but this arrangement is not
necessary.
To imagine a simple DC motor, think of a wheel divided into two halves between two magnets.
The wheel of the DC motor in this example is the electromagnet. The two outer magnets are
permanent, one positive and one negative. For this example, let us assume that the left magnet is
negatively charged and the right magnet is positively charged.
Electrical current is supplied to the coils of wire on the wheel within the DC motor. This
electrical current causes a magnetic force. To make the DC motor turn, the wheel must have be
negatively charged on the side with the negative permanent magnet and positively charged on the
side with the permanent positive magnet. Because like charges repel and opposite charges attract,
the wheel will turn so that its negative side rolls around to the right, where the positive
permanent magnet is, and the wheel's positive side will roll to the left, where the negative
permanent magnet is. The magnetic force causes the wheel to turn, and this motion can be used
to do work.
When the sides of the wheel reach the place of strongest attraction, the electric current is
switched, making the wheel change polarity. The side that was positive becomes negative, and
the side that was negative becomes positive. The magnetic forces are out of alignment again, and
the wheel keeps rotating. As the DC motor spins, it continually changes the flow of electricity to
the inner wheel, so the magnetic forces continue to cause the wheel to rotate.
DC motors are used for a variety of purposes, including electric razors, electric car windows, and
remote control cars. The simple design and reliability of a DC motor makes it a good choice for
many different uses, as well as a fascinating way to study the effects of magnetic fields.
In this project the d.c motor interfacing consists of two motors .One motor is used to
open & close the car door and the other is used to move the car forward. This interfacing is
shown in fig. This uses L293D IC interfacing.
Description
Output currents to 1A or 600mA per channel respectively. Each channel is controlled by a TTL-
compatible logic input and each pair of drivers (a The L293 and L293D are quad pushpull
drivers capable of delivering full bridge) is equipped with an inhibit input which turns off all four
[31]
transistors. A separate supply input is provided for the logic so that it may be run off a lower
voltage to reduce dissipation. Additionally the L293D includes the output clamping diodes
within the IC for complete interfacing with inductive loads. Both devices is available in 16-pin
Batwing DIP packages. They are also available in Power S0IC and Hermetic DIL packages.
Block Diagram
FEATURES:
[32]
5.OTHER COMPONENTS
[33]
Fig 5.1 Crystal oscillator A crystal oscillator is an electronic circuit that uses the
mechanical resonance of a vibrating crystal of piezoelectric
material to create an electrical signal with a very precise
frequency. This frequency is commonly used to keep track of
time (as in quartz wristwatches), to provide a stable clock
signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and
receivers. The most common type of piezoelectric resonator used is the quartz crystal, so
oscillator circuits designed around them were called "crystal oscillators".
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of
megahertz. More than two billion (2×109) crystals are manufactured annually. Most are small
devices for consumer devices such as wristwatches, clocks, radios, computers, and cellphones.
Quartz crystals are also found inside test and measurement equipment, such as counters, signal
generators, and oscilloscopes.
OPERATION:
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly
ordered, repeating pattern extending in all three spatial dimensions.
Almost any object made of an elastic material could be used like a crystal, with appropriate
transducers, since all objects have natural resonant frequencies of vibration. For example, steel is
very elastic and has a high speed of sound. It was often used in mechanical filters before quartz.
The resonant frequency depends on size, shape, elasticity, and the speed of sound in the material.
High-frequency crystals are typically cut in the shape of a simple, rectangular plate. Low-
frequency crystals, such as those used in digital watches, are typically cut in the shape of a
tuning fork. For applications not needing very precise timing, a low-cost ceramic resonator is
often used in place of a quartz crystal.
When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric field
by applying a voltage to an electrode near or on the crystal. This property is known as
piezoelectricity. When the field is removed, the quartz will generate an electric field as it returns
to its previous shape, and this can generate a voltage. The result is that a quartz crystal behaves
like a circuit composed of an inductor, capacitor and resistor, with a precise resonant frequency.
(See RLC circuit.)
Quartz has the further advantage that its elastic constants and its size change in such a way that
the frequency dependence on temperature can be very low. The specific characteristics will
depend on the mode of vibration and the angle at which the quartz is cut (relative to its
crystallographic axes).[7] Therefore, the resonant frequency of the plate, which depends on its
size, will not change much, either. This means that a quartz clock, filter or oscillator will remain
accurate. For critical applications the quartz oscillator is mounted in a temperature-controlled
container, called a crystal oven, and can also be mounted on shock absorbers to prevent
perturbation by external mechanical vibrations.
[34]
PCB is a platform where many of the embedded systems to be made. PCB (Printed
Circuit Board) is used for the assembly of various components on a single plate. The connections
on the PCB should be identical to the circuit diagram, but while the circuit diagram is arranged to
be readable, the PCB layout is arranged to be functional, so there is rarely any visible correlation
between the circuit diagram and the layout.
PCB layout can be performed manually (using CAD) or in combination with an
Autorouter. The best results are usually still achieved using atleast some manual routing
Sometimes abbreviated PCB, a thin plate on which chips and other electronic
components are placed. Computers consist of one or more boards, often called cards or adapters
5.3 BUZZER
Buzzer is a device used for beep signal. This will help us to make understand information or
message. A buzzer is usually electronic device used in automobiles, household applications etc.
It mostly consists of switches or sensors connected to a control unit that determines if and which
button was pushed or a preset time has lapsed, and usually illuminates a light on appropriate
button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing
or beeping sound. Initially this device was based on an electromechanical system which was
identical to an electrical bell without the metal gong. Often these units were anchored to a wall or
ceiling and used the ceiling or wall as a sounding board. Another implementation with some AC-
connected devices was to implement a circuit to make the AC current into a noise loud enough to
derive a loudspeaker and hook this circuit to a cheap 8-ohm speaker. These buzzers do not make
a sound or turn on a light, they stop a nearby digital clock, briefly fire two smoke cannons on
each side of the stage exit and open the exit. However, at the end of the Heartbreaker in Viking,
the buzzer is replaced with a sword that, when removed, causes two contacts to touch, closing
the circuit and causing the latter two actions above to occur.
Mechanical
A joy buzzer is an example of a purely mechanical buzzer.
[35]
Electromechanical
Early devices were based on an electromechanical system identical to an electric bell without the
metal gong. Similarly, a relay may be connected to interrupt its own actuating current, causing
the contacts to buzz. Often these units were anchored to a wall or ceiling to use it as a sounding
board. The word "buzzer" comes from the rasping noise that electromechanical buzzers made.
Electronic
A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal
source. Sounds commonly used to indicate that a button has been pressed are a click, a ring or a
beep.
[36]
provide (for example, the 7805 has a 5 volt output, while the 7809 produces 9 volts). The 78xx
line are positive voltage regulators, meaning that they are designed to produce a voltage that is
positive relative to a common ground. There is a related line of 79xx devices which are
complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to
provide both positive and negative supply voltages in the same circuit, if necessary.
Fig
5.4 Regulator IC 78XX
FEATURES
• Previous commercial temperature range has been extended to a junction temperature range of -40
degree C to +125 degree C.
[37]
5.4 RESISTORS
A resistor is a two-terminal electronic component
that produces a voltage across its terminals that is
proportional to the electric current passing through it in
accordance with Ohm's law:
V = IR
Resistors are elements of electrical networks and
electronic circuits and are ubiquitous in most electronic
equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire
made of a high-resistivity alloy, such as nickel/chrome).
FUNCTION
Resistor restrict the flow of electric current, for example a resistor is placed in series with a light-
emitting diode(LED) to limit the current passing through the LED.
TYPES OF RESISTORS
FIXED VALUE RESISTORS
[38]
It includes two types of resistors as carbon film and metal film .These two types are explained under
1. CARBON FILM RESISTORS: During manufacture, at in film of carbon is deposited
onto a small ceramic rod. The resistive coating is spiraled away in an automatic machine
until the resistance between there two ends of the rods is as close as possible to the
correct value. Metal leads and end caps are added, the resistors is covered with an
insulating coating and finally painted with colored bands to indicate the resistor value
2. METAL FILM RESISTORS: Metal film and metal oxides resistors are made in a similar
way, but can be made more accurately to within ±2% or ±1% of their nominal vale there are
some difference in performance between these resistor types, but none which affects their use
in simple circuit.
1. WIRE WOUND RESISTOR: A wire wound resistor is made of metal resistance wire, and
because of this, they can be manufactured to precise values. Also, high wattage resistors can
be made by using a thick wire material. Wire wound resistors cannot be used for high
frequency circuits. Coils are used in high frequency circuit. Wire wound resistors in a
ceramic case, strengthened with special cement. They have very high power rating, from 1 or
2 watts to dozens of watts. These resistors can become extremely hot when used for high
power application, and this must be taken into account when designing the circuit.
5.5 CAPACITORS:
[39]
BASIC
Like a battery, a capacitor has two terminals. Inside the capacitor, the terminals connect to two metal
plates separated by a dielectric. The dielectric can be air, paper, plastic or anything else that does not
conduct electricity and keeps the plates from touching each other. You can easily make a capacitor
from two pieces of aluminum foil and a piece of paper. It won't be a particularly good capacitor in
terms of its storage capacity, but it will work. In an electronic circuit, a capacitor is shown like this:
• The plate on the capacitor that attaches to the negative terminal of the battery accepts electrons that
the battery is producing.
• The plate on the capacitor that attaches to the positive terminal of the battery loses electrons to the
battery.
[40]
Fig 5.10 Capacitor & Battery Connection
TYPES OF CAPACITORS:
ELECTROLYTIC CAPACITOR
An electrolytic capacitor is a type of capacitor that uses an ionic conducting liquid as one of its
plates with a larger capacitance per unit volume than other types. They are often referred to in
electronics usage simply as "electrolytics". They are valuable in relatively high-current and low-
frequency electrical circuits. This is especially the case in power-supply filters, where they store
charge needed to moderate output voltage and current fluctuations in rectifier output. They are
also widely used as coupling capacitors in circuits where AC should be conducted but DC should
not.Electrolytic capacitors can have a very high capacitance, allowing filters made with them to
have very low corner frequencies.
MICA CAPACITOR
Mica capacitors are high precision high stability high reliability capacitors. They are available in
small values, and are mostly used at high frequencies.
PAPER CAPACITOR
Common in antique radio equipment, paper dielectric and aluminum foil layers rolled into a
cylinder and sealed with wax. Low values up to a few μF, working voltage up to several hundred
volts, oil-impregnated bathtub types to 5 kV used for motor starting and high-voltage power
supplies, and up to 25 kV for large oil-impregnated energy discharge types.
CERAMIC CAPACITOR
[41]
The main differences between ceramic dielectric types are the temperature coefficient of
capacitance, and the dielectric loss. C0G and NP0 (negative-positive-zero, i.e. ±0) dielectrics
have the lowest losses, and are used in filters, as timing elements, and for balancing crystal
oscillators. Ceramic capacitors tend to have low inductance because of their small size. NP0
refers to the shape of the capacitor's temperature coefficient graph (how much the capacitance
changes with temperature). NP0 means that the graph is flat and the device is not affected by
temperature changes.
TRIMMER CAPACITOR
These capacitors have a rotating plate (which can be rotated to change the capacitance) separated
from a fixed plate by a dielectric medium. Typically values range from 5 pF to 60 pF.
[42]
Fig 5.12 Battery Connector
6.Description of Project
6.1 Introduction
The Need
Delhi, the National Capital with a population of about 12 million is, perhaps, the only city of its
size in the world, which depends almost entirely on buses on it sole mode of mass transport.bus
services are inadequate and heavily over-crowded.. The result of extreme congestion on the road,
ever slowing speeds, increasing accident rate, fuel wastage and environmental pollution. Delhi
[43]
has now become the fourth most city in the world, with automobiles contributing more than two
thirds of the total atmospheric pollution. Pollution related health problems are reaching
disconcerting levels. Immediate steps are, therefore, needed to improve both the quality and
availability of mass transport service. This is possible only if a rail-based mass transit system,
which is non-polluting, is introduced in the city without further delay.
With a view to reducing the problems of Delhi’s commuter, the launching of an Integrated Multi
Mode Mass Rapid Transport System for Delhi had long been under consideration. The first
concrete step in this direction was, however, taken when a feasibility study for developing such a
multi-modal MRTS system was commissioned by GNCTD (with support from GOI) in 1989 and
completed by RITES in 1991.
[44]
I have made the prototype of Metro train using Microcontroller 89C51.The basic function of this
project is given later. I have used a toy car to implementing it which has two DC motors. One is
used for opening and closing the door and other is used for moving the car forward. The
complete description of project is given below.
[45]
Fig 6.1 Circuit Diagram of Project
[46]
9 volt battery
1K Resistor 1
2. Microcontroller Section
Microcontroller IC (AT89C51) with base 1
Crystal Oscillator (11.0592 MHz) 1
Capacitor (30pF) 2
Capacitor (10μF) 1
Resistor (8.2K) 1
LCD Connector 1
3. Buzzer 1
4. LCD (16x2) 1
5. Load Driver (L293D) with base 1
6. A Car (toy-driven by a DC motor) 1
7. General Purpose Card 4
8. Single Core Connecting Wires
9. Reset Switch (Push-on) 1
10. Old and Rough CD drive for making Door System 1
(We are to use only motor and Pulley system for door)
Step 1: Circuit diagram of the proposed system is designed and finalized.(Refer to Figure
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 shown in
the Figure.
Step 4: Code/program of the proposed system is developed using assembly language with the
help of software platform (Keil µ vision3).The coding could be seen in section.
Step 5: The hex code of the program being created by the software platform is burnt into the
flash code memory of our microcontroller IC 89C51.
Step 6: Testing is done at various levels to finalize the appropriate program for the most
proper working of the system
[47]
When the power is turned on a message (“welcome to metro”) is displayed on LCD. Then a
message “Current station is Kishan Ganj” is displayed and door is opened also. A buzzer is also
turned on when door opens. After some delay the door is closed and car is started to move
forward. A message “current station is Kishan Ganj” is displayed also on LCD. After some delay
a message “next station is Pratap nagar” is displayed. After some time the train stops and a
message “ current station is Pratap nagar” is displayed. This process is continued for five
stations. In the end a message “End of line” is displayed on LCD. This whole process is repeated
until we turned off the power supply.
1. FUTURE SCOPE
[48]
The new cars would feature the following:
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.
[49]
Ali Mazidi , Janice Gillispie Mazidi, Rolin D. Mckinlay.
• “The 8051 MICROCONTROLLER” by K. J. Ayala.
• "Advanced Microprocessors and Microcontrollers" by B.P. Singh & Renu Singh.
• "Let Us C" by Yashwant Kanitkar.
• "Data Structure through C" by Yashwant Kanitkar.
• Digital design by Morris Mano.
NET LINKS:
1. www.8051projects.net
2. www.atmel.com
3. www.electronicsforyou.com
4. www.encyclopedia.com
5. www.wikipedia.com
APPENDIX-I
C Language Code
#include<reg51.h>
[50]
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;
sbit door2 = P2^6;
sbit buzz = P2^7;
#define lcd_port P1
main()
{
char index1;
code char stations[][16] = {{"Kishan Ganj0"}, {"Pratap Nagar0"}, {"Shahadara0"},
{"Indraprashta0"}, {"Rohini West0"}};
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);
lcd_code(0x80);
lcd_data("Current Station:0");
lcd_code(0xC0);
lcd_data(stations[index1]);
delay1(200);
buzz = 0;
delay1(200);
buzz = 1;
//------------------------------Door Open
door1 = 0;
delay1(500);
[51]
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("Next Station:0");
lcd_code(0xC0);
lcd_data(stations[index1+1]);
delay1(2000);
mot1 = 0;
mot2 = 0;
lcd_code(0x01);
}
else
{
lcd_code(0x01);
lcd_data("End Of Line0");
delay1(1000);
}
}
[52]
void lcd_ok(bit mybit)
{
if(mybit)
{
rs = 1;
}
else
{
rs = 0;
}
rw = 0;
en = 1;
delay(1);
en = 0;
return;
}
void lcd_init()
{
lcd_code(0x38);
lcd_code(0x0C);
lcd_code(0x01);
lcd_code(0x06);
return;
}
[53]
{
check();
lcd_port = ch;
lcd_ok(0);
return;
}
void check()
{
rs = 0;
rw = 1;
while(busy == 1)
{
en = 0;
delay(1);
en = 1;
}
return;
}
APPENDIX-II
Code In Assembly
org 000h
buzz bit P2.7
rs bit P2.0
rw bit P2.1
en bit P2.2
mot1 bit P2.3
mot2 bit P2.4
[54]
door1 bit P2.5
door2 bit P2.6
busy bit P1.7
clr mot1
clr mot2
setb buzz
setb door1
setb door2
mov A,#38h
lcall cmwrt
mov A,#0ch
lcall cmwrt
mov A,#01h
lcall cmwrt
mov A,#06h
lcall cmwrt
mov A,#01h
lcall cmwrt
mov dptr,#disp1
clr A
movc A,@A+dptr
lcall dwrt
mov A,#01h
lcall cmwrt
mov A,#80h
clr A
mov dptr,#disp2
movc A,@A+dptr
lcall dwrt
mov A,#0c0h
lcall cmwrt
mov dptr,#disp4
clr A
movc A,@A+dptr
lcall delay1
clr buzz
lcall delay2
setb buzz
clr door1
lcall delay2
setb door1
lcall delay2
clr buzz
lcall delay2
[55]
setb buzz
clr door2
lcall delay2
setb door2……………………….door closed
lcall delay2
setb mot1
clr mot2
lcall delay1
mov A,#01h
lcall cmwrt
mov A,#80h
lcall cmwrt
clr A
mov dptr,#disp3
movc A,@A+dptr
mov A,#0c0h
clr A
mov dptr,#disp5
movc A,@A+dptr
lcall delay1
clr mot1
clr mot2
………………………………………………………………….
mov A,#01h
lcall cmwrt
mov A,#80h
clr A
mov dptr,#disp2
movc A,@A+dptr
lcall dwrt
mov A,#0c0h
lcall cmwrt
mov dptr,#disp5
clr A
movc A,@A+dptr
lcall delay1
clr buzz
lcall delay2
setb buzz
clr door1
lcall delay2
setb door1
lcall delay2
clr buzz
lcall delay2
setb buzz
[56]
clr door2
lcall delay2
setb door2……………………….door closed
lcall delay2
setb mot1
clr mot2
lcall delay1
mov A,#01h
lcall cmwrt
mov A,#80h
lcall cmwrt
clr A
mov dptr,#disp3
movc A,@A+dptr
mov A,#0c0h
clr A
mov dptr,#disp6
movc A,@A+dptr
lcall delay1
clr mot1
clr mot2
…………………………………………………………………………………………..
mov A,#01h
lcall cmwrt
mov A,#80h
clr A
mov dptr,#disp2
movc A,@A+dptr
lcall dwrt
mov A,#0c0h
lcall cmwrt
mov dptr,#disp6
clr A
movc A,@A+dptr
lcall delay1
clr buzz
lcall delay2
setb buzz
clr door1
lcall delay2
setb door1
lcall delay2
clr buzz
lcall delay2
setb buzz
[57]
clr door2
lcall delay2
setb door2……………………….door closed
lcall delay2
setb mot1
clr mot2
lcall delay1
mov A,#01h
lcall cmwrt
mov A,#80h
lcall cmwrt
clr A
mov dptr,#disp3
movc A,@A+dptr
mov A,#0c0h
clr A
mov dptr,#disp7
movc A,@A+dptr
lcall delay1
clr mot1
clr mot2
………………………………………………………………………………………
mov A,#01h
lcall cmwrt
mov A,#80h
clr A
mov dptr,#disp2
movc A,@A+dptr
lcall dwrt
mov A,#0c0h
lcall cmwrt
mov dptr,#disp7
clr A
movc A,@A+dptr
lcall delay1
clr buzz
lcall delay2
setb buzz
clr door1
lcall delay2
setb door1
lcall delay2
clr buzz
lcall delay2
setb buzz
[58]
clr door2
lcall delay2
setb door2……………………….door closed
lcall delay2
setb mot1
clr mot2
lcall delay1
mov A,#01h
lcall cmwrt
mov A,#80h
lcall cmwrt
clr A
mov dptr,#disp3
movc A,@A+dptr
mov A,#0c0h
clr A
mov dptr,#disp8
movc A,@A+dptr
lcall delay1
clr mot1
clr mot2
……………………………………………………………………………..
mov A,#01h
lcall cmwrt
mov A,#80h
clr A
mov dptr,#disp2
movc A,@A+dptr
lcall dwrt
mov A,#0c0h
lcall cmwrt
mov dptr,#disp8
clr A
movc A,@A+dptr
lcall delay1
clr buzz
lcall delay2
setb buzz
clr door1
lcall delay2
setb door1
lcall delay2
clr buzz
lcall delay2
setb buzz
[59]
clr door2
lcall delay2
setb door2……………………….door closed
mov A,#01h
lcall cmwrt
clrA
mov dptr,#FINISH
movc A,@A+dptr
lcall dwrt
sjmp $
…………………………………………………………………………………………………….
……………………………………………………………………………………………………..
[60]
org 800h
disp1: db “Welcome to Metro”,0
disp2: db ”Current Station”,0
disp3: db ”Next Station”,0
disp4: db ”Kishan Ganj”,0
disp5: db ”Pratap Nagar”,0
disp6: db ”Shahadra”,0
disp7: db “Indraprastha”,0
disp8: db ”Rohini West”,0
finish: db ”End of Line”,0
[61]