Professional Documents
Culture Documents
Training Report Draft 1
Training Report Draft 1
SUBMITTED BY:-
ANIL SANDHAN
2107062
ECE-4
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
(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)
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
11. C Coding
INDEX
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.
Were 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:-
Hardware
Input & Output
Software
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.
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 on-
chip 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
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.
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.
Supply and Ground pins: Pin 40 is for +5V and pin 20 is for GND.
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.
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
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.
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).
Blac
0 0 100
k
Bro
1 1 101 1% (F) 100 ppm
wn
Oran
3 3 103 15 ppm
ge
Yello
4 4 104 25 ppm
w
Gree
5 5 105 0.5% (D)
n
Viole
7 7 107 0.1% (B)
t
Whit
9 9 109
e
Silve
10-2 10% (K)
r
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".
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 baseemitter junction and the basecollector junction,
separated by a thin region of semiconductor known as the base region.
Diode
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:
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
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
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:
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...
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
1. HARDWARE SECTION
Component mounting
Hard ware testing
2. SOFTWARE SECTION
1 Software testing
2 Main software implementation
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:
In without power supply as the name suggests you dont 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.
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.
Project methodology:
List of Components:
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;
P3=0x00;
relay=1;
while(1)
{
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==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
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