Download training report - 123SeminarsOnly.com

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Transcript
TRAINING REPORT
Submitted in partial fulfillment of the requirement for the
award of the degree of B.Tech at
…state of the art engineering solutions
Autorised centre for :
U
UN
ND
DEERR TTH
HEE G
GU
UIID
DA
AN
NC
CEE O
OFF::-M
MRR.. SSA
ATTIISSH
HG
GU
UPPTTA
A
TTRRA
AIIN
NEERR EEM
MBBEED
DD
DEED
D SSY
YSSTTEEM
MSS
G
GTTII SSC
CH
HO
OO
OLL O
OFF C
CO
OM
MPPU
UTTIIN
NG
G
KKA
ARRN
NA
ALL
SSU
UBBM
MIITTTTEED
D BBY
Y::-A
AN
NIILL SSA
AN
ND
DH
HA
AN
N
22110077006622
EEC
CEE--44
ABSTRACT OF THE TRAINING
My experiences:
With the completion of this training, I am now aware of the Microcontroller 8051. I have
worked for six complete weeks in the Embedded systems. I have worked almost as an
engineer to the extent of my technical capabilities. Doing all these, I have acquired a lot
of knowledge about the working of Microcontroller with Embedded C Programming and
its Softwares (Keil and Flash Magic).
I was the part of one of the most happening and demanding field of electronics i.e. 8051
Microcontroller started by
and spending six weeks into it really proved very
useful to me and I have gained a lot out of it :
1
I got the knowledge of uC 8051 (Harward Architecture & Cisc type).
2
I worked practically on the softwares Keil u vision, Flash Magic,Proteus.
3
I worked practically which helped me in being more familiar to the interfacing of
different display devices which I am supposed to do in the long run.
4
I learned basic concepts of electronics which helped me to understand more.
5
Training helped me increasing my working skills and the knowledge in this field
and also showed me the atmosphere that we have to join after completion of the
degree program.
Finally, the main advantage of this training was that it has now enabled me to explore
myself in the giant Robotic industry.
(Shikha Batra)
ACKNOWLEDGEMENT
A formal statement of acknowledgment is hardly sufficient to express my gratitude
towards the personalities who have helped me to undertake and complete this project.
Training in an organization like
which is fuelled by the individuals with so
much zest and energy, “teaming” up to form a formidable force, was in itself a true
learning experience which is going to help me immensely in my career.
I hereby convey my thanks to all those who have rendered their valuable help, support
and guidance.
Firstly I would thank Mr. Arun Gautam(Director) for granting me the permission to
work as a Trainee in this esteemed company and for providing me all the facilities. .
I am highly thankful to Mr. Satish Gupta (Trainer and Guider) for helping me to
undertake a project in Embedded Systems at an esteem corporate like
and
providing highly valuable technical acumen, constructive criticism and moral support.
I am also thankful to Mr. Devinder Dua for the valuable help he gave to gather the
insight knowledge which otherwise would not have been there.
Lastly, I bow before the almighty with folded hands.
(Shikha batra)
PREFACE
With the on going embedded revolution where innovations are taking place at the blink of
an eye, it is impossible to keep the pace with the emerging trends. In organization where
Making Things Right in the first instance is the driving motto, perfection and accuracy
are inevitable.
Excellence is an attitude that the whole of the human race is born with. It is the
environment that makes sure that whether the result of this attitude is visible or
otherwise. A well planned, properly executed and evaluated industrial training helps a lot
in inculcating a professional attitude. It provides a linkage between the student and
industry to develop an awareness of industrial approach to problem solving, based on a
broad understanding of process and mode of operation of organization.
During this period, the students get the real, first hand experience for working in the
actual environment. Most of the theoretical knowledge that has been gained during the
course of their studies is put to test here. Apart from this, the students get an opportunity
to learn the latest technology, which immensely helps them in building their career.
I had the opportunity to have a real experience on many ventures, which enhanced my
sphere of knowledge to a great extent and all the credit goes to organization
which in true self made the embedded revolution happen.
(Shikha Batra)
INDEX
S.No.
Practicals
1.
Gti Profile
2.
Overview of Embedded Systems
3.
Introduction to microcontroller
4.
Components description
5.
Lcd Interfacing
6.
7 segment Interfacing
7.
Keypad Interfacing
8.
Embedded c programming
9.
Whole description of Project
10.
Project Methodology
11.
C Coding
…state of the art engineering solutions
GTI is a not-for-profit Research and Development (R&D) organization. For more than 65
years, we have been the leader in the development and deployment of technology
solutions
that contribute to a secure, abundant, and affordable energy future. As such, we provide
eco
-nomic value to the energy industry & its customers, while supporting govt. in achieving
policy objectives. To date, GTI programs have resulted in nearly 500 products, 750
licenses, and more than 1,200 associated patents.
We’re a research organization with “the energy to lead.” We solve important energy
challenges, turning raw technology into practical solutions that create exceptional value
for our customers in the global marketplace. We are driven by three primary objectives,
which span the energy industry value chain. They provide both the focus and enduring
opportunity for our business endeavors. These objectives are:
 Expanding the supply of affordable energy
 Ensuring a safe and reliable energy delivery infrastructure
 Promoting the efficient use of energy resources.

GTI R&D Market Units address key issues impacting natural gas and energy markets in
the areas of energy supply, delivery, and end use. GTI provides programs and
services to industry, government, and consortia that include contract R&D, collaborative
R&D, technical services, and education programs.
The majority of the GTI staff of approximately 250 professionals is based at our 18-acre
campus in Des Plaines, Illinois. The campus includes a 280,000-foot headquarters
building that houses modern laboratory and research facilities, offices, training facilities,
and an extensive library. In addition, 28 specialized laboratory facilities are used for the
development and testing of advanced energy technologies.
1. Embedded Systems
1.1 Introduction:Embedded Systems are inseparable part of our life. Whether we are at
home or office or on the move, we are always surrounded by embedded systems. Starting
from home appliances like TV, washing machine and systems like printer and elevator in
workplace to the automobiles and automatic traffic control system are all examples of
embedded systems. All kinds of magazines and journals regularly dish out details about
latest technologies, new devices; fast applications which make us believe that our basic
survival is controlled by these embedded products.
Embedded system is a combination of Hardware and Software Design to meet a
specific need with performance in given time frame.
Component in an embedded system are as:
Hardware
Input
&
Software
Output
1.2 Characteristics of embedded products:1.
2.
3.
4.
They perform a single set of functions.
Works in a time constrained environment.
Provide high performance and reliability.
Mostly Embedded systems have low cost because they are mass produced in
millions.
1.3 Embedded products in Today’s industry:1. Telecom
Mobile phone systems, modems, routers.
2. Automotive applications
Braking systems, traction systems, airbag release systems, engine-management
units, steer-by-wire systems, cruise control applications
3. Domestic appliances
Dishwashers, televisions, washing machines microwave ovens, Video
recorders, security systems, garage door controllers, calculators, digital watches,
VCRs, Digital cameras, Remote controls, Treadmills.
4. Robotic
Fire fighting robots, Automatic floor cleaner, robotic arm etc.
5. Aerospace applications
Flight control systems, engine controllers, autopilots, passenger in-flight
entertainment systems.
6. Medical equipment
An aesthesia monitoring systems, ECG monitors, Pacemakers, Drug delivery
systems,
MRI scanners
7. Defense systems
Radar systems, fighter aircraft flight control systems, radio systems, missile
guidance systems
8. Office automation
Laser printers, fax machines, pagers, cash registers, gas pumps, credit/debit card
readers, thermostats, grain analyzers
2. MICROCONTROLLERS
2.1 Introduction
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.
The first microcontroller 8051 was developed by Intel Corporation in the year
1981. it was called as a “System on a chip”. Intel refers to it as MCS-51 now.
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:
1. High Integration of Functionality
2. Microcontrollers sometimes are called single-chip computers because they have onchip memory and I/O circuitry and other circuitries that enable them to function as
small standalone computers without other supporting circuitry.
3. Field Programmability, Flexibility
4. 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.
5. 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.
Most microcontrollers will also combine other devices such as:
1. A Timer module to allow the microcontroller to perform tasks for certain time
periods.
2. A serial I/O port to allow data to flow between the microcontroller and other
devices such as a PC or another microcontroller.
3. An ADC to allow the microcontroller to accept analogue input data for
processing.
Figure 2.1: Showing a typical microcontroller device and its different
subunits
2.3 Difference Between μP and μC
Structure of μP
Structure of μC
Figure 2.2: structure of microprocessor and microcontroller
2.4 8051 Architecture
Figure 2.3: 8051 architecture
The 8051 is a high performance single chip computer intended for use in sophisticated
real time applications such as instrumentation, industrial control and computer
peripherals. It provides extra features like interrupts, bit address ability and an enhanced
set of instructions, which makes the chip very powerful and cost effective.
Standard features of the 8051
8 bit data path and ALU
On chip flash memory
4K X 8 ROM – Program Memory
128 X 8 RAM – Data Memory
Multiple 16 – bit Timer/Counter.
Full duplex UART (serial port).
On chip clock oscillator.
32 I/O pins
2.5 Pin Configuration
Figure 2.4: Pin configuration of microcontroller
The pins of the micro controller are explained below.
I/O Ports: Four 8-bit I/O ports.
Most have alternate functions.
Port 0 (pin 32-39)
Dual purpose I/O port.
In min. component design, it is used as a general purpose I/O port.In
larger designs with external memory, it becomes a multiplexed data bus:
Low byte of address bus, strobed by ALE.
8-bit instruction bus, strobed by PSEN.
8-bit data bus, strobed by WR and RD.
Port 1 (pin 1-8)
As an I/O port: Standard bi-directional port for interfacing to external
devices as required for I/O.
Alternate functions: Only on some derivatives
Port 2 (pin 21-28)
Dual purpose I/O port.
As an I/O port: Standard bi-directional general purpose I/O port.
Alternate functions: High byte of address bus for external program and
data memory accesses
Port 3 (pin 10-17)
is an 8-bit bi-directional I/O port with internal pull-ups. It also serves the
functions of various special features of the 80C51
Table of alternate uses of Port- 3 pins:
PINS
P3.0 RXD
P3.1 TXD
P3.2 INT0
P3.3 INT1
P3.4 T0
P3.5 T1
P3.6 WR
P3.7 RD
Reset:
ALTERNATE USE
Serial data input
Serial data output
External Interrupt 0
External Interrupt 1
External Timer 0 I/P
External Timer 1 I/P
External Memory write pulse
External Memory read pulse
SFR
SBUF
SBUF
TCON.1
TCON.3
TMOD
TMOD
-
It resets total 8051 micro controller.
XTAL1 & XTAL2: To connect the crystal oscillator. for 8051 crystal oscillator of
11.0592
MHZ is connected between these pins.
ALE:
Address latch enable which is used to access the address locations
from external memory.
PSEN:
Program store enable which is used for storing programming
code into the external memory.
EA:
External Access: 64 KB of ROM is the limit for external memory.
Supply and Ground pins: Pin 40 is for +5V and pin 20 is for GND.
2.6 RESET CIRCUIT and CLOCK CIRCUIT.
Figure 2.5: Reset circuit of microcontroller
2.7 Family Members of 8051
Features
ROM
RAM(bytes)
Timers
I/O Pins
Serial Port
Interrupt Sources
8051
4K
128
2
32
1
6
8031
8052
0K
8K
128
256
2
3
32
32
1
1
6
7
Table 2.1: Family members of 8051
8032
0K
256
3
32
1
7
2.8 RAM Architecture
figure 2.6: 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
registers are 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
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.
Special Function Register (SFR) Memory
Special Function Registers (SFRs) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051’s
32 input/output lines. Another SFR allows a program to read or write to the 8051’s serial
port .SFR is a part of Internal Memory. This is not the case. When using this method of
memory access (it’s called direct address), any instruction that has an address of 00h
through 7Fh refers to an Internal RAM memory address; any instruction with an address
of 80h through FFh refers to an SFR control register.
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
The "R" registers
The "R" registers are a set of eight registers that are named R0, R1, etc. up to and
including R7. These registers are used as auxiliary registers in many operations.
The "B" Register
The "B" register is very similar to the Accumulator in the sense that it may hold
an 8-bit (1-byte) value. The "B" register is only used by two 8051 instructions: MUL AB
and DIV AB.
The Data Pointer (DPTR)
The Data Pointer (DPTR) is the 8051’s only user-accessible 16-bit (2-byte)
register. The Accumulator, "R" registers, and "B" register are all 1-byte values. DPTR, as
the name suggests, is used to point to data. It is used by a number of commands which
allow the 8051 to access external memory.
The Program Counter (PC)
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.
.
The Stack Pointer (SP)
The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit (1byte) value. The Stack Pointer is used to indicate where the next value to be removed
from the stack should be
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.
2.9 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.
Figure 2.7: Simplified central processing unit with three registers
3. Components Description:
Resistor:
A resistor is a two-terminal electronic component that produces a voltage across its
terminals that is proportional to the electric current through it in accordance with Ohm's
law:
V=IR
Units
The ohm (symbol: Ω) . Commonly used multiples and submultiples in electrical and
electronic usage are the milliohm (1x10-3), kilohm (1x103), and megohm (1x106).
Each color corresponds to a certain digit, progressing from darker to lighter colors, as
shown in the chart below.
Colo
r
1st
band
2nd
band
3rd band
(multiplier)
4th band
(tolerance)
Blac
k
0
0
×100
Bro
wn
1
1
×101
±1% (F)
100 ppm
Red
2
2
×102
±2% (G)
50 ppm
Oran
ge
3
3
×103
Temp.
Coefficient
15 ppm
Yell
ow
4
4
×104
Gree
n
5
5
×105
±0.5% (D)
Blue
6
6
×106
±0.25% (C)
Viol
et
7
7
×107
±0.1% (B)
Gray
8
8
×108
±0.05% (A)
Whit
e
9
9
×109
25 ppm
Gold
×10-1
±5% (J)
Silve
r
×10-2
±10% (K)
None
±20% (M)
CAPACITOR:
Capacitor passive electronic component consisting of a pair of conductors separated by a
dielectric. When a voltage potential difference exists between the conductors, an electric
field is present in the dielectric. This field stores energy and produces a mechanical force
between the plates.
An ideal capacitor is characterized by a single constant value, capacitance, which is
measured in farads.
C=Q/V
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".
Liquid Crystal Display:
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, and other devices ranging from aircraft cockpit
displays, to every-day consumer devices such as video players, gaming devices, clocks,
watches, calculators, and telephones. 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.
Transistor
In electronics, a transistor is a semiconductor device commonly used to amplify or
switch electronic signals. A transistor is made of a solid piece of a semiconductor
material, with at least three terminals for connection to an external circuit. The bipolar
junction transistor (BJT) was the first type of transistor to be mass-produced. Bipolar
transistors are so named because they conduct by using both majority and minority
carriers. The three terminals of the BJT are named emitter, base, and collector. The BJT
consists of two p-n junctions: the base–emitter junction and the base–collector junction,
separated by a thin region of semiconductor known as the base region.
Diode
In electronics, a diode is a two-terminal device. Diodes have two active electrodes
between which the signal of interest may flow, and most are used for their unidirectional
electric current proper.
The most common function of a diode is to allow an electric current to pass in one
direction (called the forward biased condition) and to block the current in the opposite
direction (the reverse biased condition).
LIGHT EMITTING DIODE:
A light-emitting diode (LED) is a semiconductor diode that emits light when an
electrical current is applied in the forward direction of the device. LEDs are widely used
as indicator lights on electronic devices and increasingly in higher power applications
such as flashlights and area lighting.
POWER SUPPLY CIRCUIT:
BRIDGE RECTIFIERS:
Bridge rectifier circuit consists of four diodes arranged in the form of a bridge as shown
in figure.
OPERATION :
During the positive half cycle of the input supply, the upper end A of the transformer
secondary becomes positive with respect to its lower point B. This makes Point1 of
bridge positive with respect to point2. The diode D1 & D2 become forward biased & D3
& D4 become reverse biased. As a result a current starts flowing from point1, through D1
the load & D2 to the negative end.
During negative half cycle, the point2 becomes positive with respect to point1. DiodeD1
& D2 now become reverse biased.Thus a current flow from point 2 to point 1.
Relay
A relay is an electrically operated switch. Current flowing through the coil of the relay
creates a magnetic field which attracts a lever and changes the switch contacts. The coil
current can be on or off so relays have two switch positions and they are double throw
(changeover) switches.
TRANSFORMER
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled electrical conductors. A changing current in the first circuit
(the primary) creates a changing magnetic field; in turn, this magnetic field induces a
changing voltage in the second circuit (the secondary). By adding a load to the secondary
circuit, one can make current flow in the transformer, thus transferring energy from one
circuit to the other. It is the phenomenon of mutual induction.
The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP
by a factor equal to the ratio of the number of turns of wire in their respective windings:
Transformers are of two types:
1. Step up transformer
2. Step down transformer
In power supply we use step down transformer. We apply 220V AC on the primary of
step down transformer. This transformer steps down this voltage to 9V AC. We give this
9 V AC to rectifier circuit, which convert it to 5V DC.
4. LCD INTERFACING
4.1 Pin Configuration
LCD stands for Liquid Crystal Display. The most commonly used LCDs found in the
market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support
at most of 80 characters
8 data pins D7:D0
Bi-directional data/command pins. Alphanumeric characters are sent in ASCII format.
RS: Register Select
RS = 0 -> Command Register is selected
LCD
RS = 1 -> Data Register is selected
Figure 4.1: pin configuration for 16 X 2
R/W: Read or Write
0 -> Write, 1 -> Read
E: Enable (Latch data)
Used to latch the data present on the data pins.
A high-to-low edge is needed to latch the data.
VEE : contrast control.
4.2 DDRAM - Display Data RAM
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its
extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM
(DDRAM) that is not used for display can be used as general data RAM. So whatever
you send on the DDRAM is actually displayed on the LCD.
4.3 BF - Busy Flag
Busy Flag is a status indicator flag for LCD. When we send a command or data to the
LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed
successfully this 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.
4.4 Instruction Register (IR) and Data Register (DR)
There are two 8-bit registers controller Instruction and Data register. Instruction register
corresponds to the register where you send commands to LCD e.g. LCD shift command,
LCD clear, LCD address etc. and Data register is used for storing data which is to be
displayed on LCD. When send the enable signal of the LCD is asserted, the data on the
pins is latched in to the data register and data is then moved automatically to the
DDRAM and hence is displayed on the LCD.
4.6 INTERFACING LCD TO 8051
The LCD requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The
user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus.
If a 4-bit data bus is used, the LCD will require a total of 7 data lines. If an 8-bit data bus
is used, the LCD will require a total of 11 data lines.The three control lines are EN, RS,
and RW. Note that the EN line must be raised/lowered before/after each instruction sent
to the LCD regardless of whether that instruction is read or write, text or instruction EN
is the LCD's way of knowing that you are talking to it. If you don't raise/lower EN, the
LCD doesn't know you're talking to it on the other lines.
4.5 LCD Commands
Commands and Instruction set
Only the instruction register (IR) and the data register (DR) of the LCD can be controlled
by the MCU. Before starting the internal operation of the LCD, control information is
temporarily stored into these registers to allow interfacing with various MCUs, which
operate at different speeds, or various peripheral control devices. The internal operation
of the LCD is determined by signals sent from the MCU.
Sending Commands to LCD
To send commands we simply need to select the command register. Everything is same
as we have done in the initialization routine. But we will summarize the common steps
and put them in a single subroutine.
Following are the steps:
1. Move data to LCD port
2. Select command register
3. Select write operation
4. Send enable signal
5. Wait for LCD to process the command
Figure 4.2: LCD interfacing with 8051
5. 7-Segment display
5.1 Introduction
The 7 segment display can also be used for displaying numbers. Each of the segments of
the display is connected to a pin on the 8051. In order to light up a segment on the pin
must be set to 0V. To turn a segment off the corresponding pin must be set to 5V. This is
simply done by setting the pins on the 8051 to '1' or '0'. LED displays are Power-hungry
(10mA per LED) and Pin-hungry (8 pins per 7-seg display). But they are cheaper than
LCD display.
Figure 5.1: 7 segment display
7-SEG Display are available in two types -1. Common anode & 2. common cathode ,
but command anode display are most suitable for interfacing with 8051 since 8051 port
pins can sink current better than sourcing it.
5.2 Creating Digit Pattern
In Common Anode display, the common Anode pin is tied to 5v .The cathode pins are
connected to port 1 through 330 Ohm resistance (current limiting). For displaying Digit
say 7 we need to light segments -a ,b, c. in Common anode display , to do so we have to
provide Logic -0 (0 v) at cathode of these segments. so need to clear pins- P1.0
,P1.1,P1.2. that is 1 1 1 1 1 0 0 0 -->F8h.
Figure 5.2: one 7-segment interfacing
Digit
Seg. h
Seg. g
Seg. f
Seg. e
Seg. d
Seg. c
Seg. b
Seg. a
HEX
0
1
1
0
0
0
0
0
0
C0
1
1
1
1
1
1
0
0
1
F9
2
1
0
1
0
0
1
0
0
A4
3
1
0
1
1
0
0
0
0
B0
4
1
0
0
1
1
0
0
1
99
Table 5.1: hex code for displaying various digits
1.3 Multi 7 Segment interfacing
1.4 Since we can Enable only one 7-seg display at a time ,we need to scan these
display at fast rate .the data lines are common for all the 4 segments The scanning
frequency should be high enough to be flicker-free. At least 30HZ .Therefore –
time one digit is ON is 1/30 seconds
Figure 5.3: interfacing multi 7-segment display
6. Keypad Interfacing
6.1 Introduction
Keypads are a part of HMI or Human Machine Interface and play really important role in
a small embedded system where human interaction or human input is needed. Martix
keypads are well known for their simple architecture and ease of interfacing with any
microcontroller.
6.2 Constructing a Matrix keypad
Constuction of a keypad is really simple. As per the outline shown in the figure below we
have four rows and four columns. In between each overlapping row and column line
there is a key.
So keeping this outline we can constuct a keypad using simple SPST Switches as shown
below:
6.3 Scanning a Matrix Keypad
There are many methods depending on how you connect your keypad with your
controller, but the basic logic is same. We make the coloums as i/p and we drive the rows
making them o/p, this whole procedure of reading the keyboard is called scanning.
In order to detect which key is pressed from the matrix, we make row lines low one by
one and read the coloums. Lets say we first make Row1 low, then read the columns. If
any of the key in row1 is pressed will make the corrosponding column as low i.e if
second key is pressed in Row1, then column2 will give low. So we come to know that
key 2 of Row1 is pressed. This is how scanning is done.
So to scan the keypad completely, we need to make rows low one by one and read the
columns. If any of the button is pressed in a row, it will take the corrosponding column to
a low state which tells us that a key is pressed in that row. If button 1 of a row is pressed
then Column 1 will become low, if button 2 then column2 and so on...
6.4 Interfacing Matrix keypad
Figure 6.1: Matrix keypad interfacing with microcontroller
SOFTWARE
EMBEDDED C PROGRAMMING
Now comes the programming .The entire hardware is nothing if it is not interfaced with
the software .The hardware cannot function in the absence of the software.
In this case we provide the software in the form of EMBEDDED C PROGRAMMING.
This entire program is fed in the memory of the microcontroller.
The code for which the access is allowed is also fed through this c language program
.This is the way by which the hardware functions.
TROUBLE SHOOTING
Not to say but yes we faced lots of troubleshooting.
So we are providing the ways to remove those troubleshooting.
The whole concept is divided into various sections as follows:
1. HARDWARE SECTION
 Component mounting
 Hard ware testing
2. SOFTWARE SECTION
1 Software testing
2 Main software implementation
Lets first start with the hardware section:
HARDWARE SECTION:Component mounting:
During mounting make sure that the soldering iron you are using is of correct rating, such
that it is at suitable temperature so that your PCB can bear without harming the tracks.
Make sure that components are properly mounted in the whole and completely covered
by solder joint.
Hardware testing:
Hardware testing is further subdivided into two parts:
1
2
Without power supply
With power supply
In without power supply as the name suggests you don’t have to provide the external
power input.
It is just meant testing the desired/undesired tracks or connections.
It is most basic step in the project. Must be done very carefully.
In power supply mode, provide connection of external power input.
And check for desired output in terms of voltage or any other criteria.
SOFTWARE SECTION:
Software testing:
There are various modules in the circuit, e.g. IR-MODULE, H-BRDGE, LEDS etc.
Check proper functioning of each and every component through small tiny programs.
Once this step is done, then final program is implemented and corrected for proper
functioning.
Description of the project:
WATER LEVEL CONTROLLER
Introduction:
Water level controller is an automatic on / off system. In this motor will be automatically
on according to the level of water in the tank. It takes the task of indicating and
controlling the water level in the overhead water tanks. It is mostly used everywhere in
homes, offices etc. due to this there is no need to go on the roof to the water level
Water level controller is a reliable circuit, it takes over the task of indicating and
controlling the water level in the overhead water tanks. The water level is sensed by the
sensor circuit connected to the walls of the tank.
It automatically monitor the overhead water level and display the motor status. It
automatically switch OFF the motor when the water tank is full and it will automatically
switch ON the motor when the water level is low.
The microprocessor will control the motor according to the level of the water. When the
level of water comes below a lower level, the motor will start pumping water. Hence the
water level increases and when it reaches an upper level then the circuit will switch off
the motor and prevents the overflow. The motor will remain in the off state until the
water level again reduces to the lower point.
7.2 Block Diagram
The main components used are:
SENSOR: If there is water then the conduction occurs between the two conductors,
which closes a circuit to the microcontroller and microcontroller detects the intensity of
water in thefield. If there is no conduction microcontroller detects that water is in the
field. If there is no conduction microcontroller detects absence of water.
MICROCONTROLLER 8051:The microcontroller detects the indication from the
sensor. The microcontroller produces controls signal to the drive the motor according to
the indication and enables the display. The motor is controlled by a relay mechanism.
MOTOR Motor is controlled by the microcontroller switching the power supply to motor
by relay mechanism. The motor employed is DC motor which has high starting torque
and constant speed.
DISPLAY16*2 LCD display is used. The present state of the motor is displayed on the
display.
Circuit Diagram:
Flow Chart:
FEATURES:1
2
Fully automatic operation.
Motor is switched ON/OFF automatically as per level in the overhead and
underground.
3 Motor protection.
4 Latest invention: in spite of vast technology this design hasn’t got reality till
now. It is proved to a great innovation.
5 Operates in real time:(Faster response):- hasty comeback from microprocessor
reduces chances of delay..
6 Self monitoring and controlling: presence of microprocessor / microcontroller
can create an intellectual device
7 Not so much expensive
8 Applicable at small as well as large level: even in a single storey building or in a
multi storey building, in a small office or in an industry this is applicable.
9 Ease of installation
10 Reliable: It is shock less and requires less power .it emphasize on less
consumption.
11 Undoubtedly use of microprocessor in daily used contrivance like microwaves,
washing machine, bikes, cars is the result of immediate, accurate, intelligent and
consistent response of the microprocessor which act as CPU in these devices.
Why I chose:I chose this project because of the following reason:1 It reduces the wastage of water.
2 It saves electricity.
3 It prevents motor failures.
4 Maximum utilization of incoming water supply.
Project methodology:
List of Components:
Component Name
Power Supply Section:
1. Step down transformer(230v/12v a.c)
2. IN4007 diodes
3. Capacitor(220uF)
4. LM7805
5. Led & resistance(300 ohm)
6. A Connector
7. plug with wire
Reset Section:
1. Capacitor(10 uF)
2. Resistor(8.2k)
3. Reset Switch (Push-on)
Clock Section :
Quantity
1
4
1
1
1
1
1
1
1
1
1. Crystal Oscillator (11.0592 MHz)
2. Ceramic Capacitor(33pF)
Microcontroller Section :
1. Ic based (40 pin)
2. Philips uC (P89V51RD2BN)
Other components:
1. Resistors
2. LCD(16x2)
3. LCD Connector
4. Transistor(Bc547npn)
5 10K Potentiometer
6 10 K SIP
7.3(b) Softwares used:
1. Keil µVision3.
2. 8051 Burner
7.3(c) Equipments used:
1.
Soldering iron
2.
Solder wire and flux
Coding
C language code
#include<reg51.h>
sbit sensorlow=P1^7;
sbit sensormid=P1^4;
sbit sensorhi=P1^1;
sbit buz=P3^5;
sbit relay=P2^0;
sbit ledlow=P2^2;
sbit ledmid=P2^3;
sbit ledhi=P2^4;
void main()
{
int i,j,flag=0,k;
P1=0xFF;
P2=0x00;
1
2
1
1
4
1
1
1 or 26. Resistance(300 Ω)
1
1
P3=0x00;
relay=1;
while(1)
{
if(sensorhi==0) // water level full
high led will glow.....
{
relay=1;
ledlow=0;
ledmid=0;
ledhi=1;
if(flag==0)
{
for(k=0;k<3;k++)
{
buz=1;
for(i=0;i<30;i++)
for(j=0;j<1275;j++);
buz=0;
for(i=0;i<30;i++)
for(j=0;j<1275;j++);
}
}
flag=1;
}
else if((sensorhi==1)&(sensormid==0)&(sensorlow==0)) // water between high
and mid pt. mid led will glow
{
relay=1;
ledlow=0;
ledmid=1;
ledhi=0;
flag=0;
}
else if((sensormid==1)&(sensorlow==0)&(sensorhi==1)) // water between low
and mid pt. low led will glow
{
relay=1;
ledlow=1;
ledmid=0;
ledhi=0;
flag=0;
}
else if((sensormid==1)&(sensorlow==1)&(sensorhi==1)) // water filling
condition all led will glow
{
relay=0;
ledlow=1;
ledmid=1;
ledhi=1;
for(i=0;i<30;i++)
for(j=0;j<1275;j++);
ledlow=0;
ledmid=0;
ledhi=0;
for(i=0;i<30;i++)
for(j=0;j<1275;j++);
flag=0;
}
}
}
BIBLIOGRAPHY
This report has been compiled with valuable contribution from:
BOOKS:
1
Mazidi and mazidi
2
Ayala
3
Sanjeev Gupta
WEB RESOURCES:
www.8051projects.com
www.rickeysworld.com
www.electronics4u.com
www.efy.com
www.projectsguide.com
Similar
Week 3
Week 3
sample LM 35
sample LM 35