guru tegh bahadur institute by manpreet
TRANSCRIPT
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
1/67
[1]
GURU TEGH BAHADUR INSTITUTE
OF TECHNOLOGY
G8 AREA -RAJOURI GARDEN
NEW DELHI-110027
SUMMER TRAINING PROJECT REPORT
ON
EMBEDDED SYSTEMS AND ROBOTICS
NAME: MANPREET SINGH
BRANCH: ECE-2
E.NO: 07913202809
SEMESTER: 5TH
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
2/67
[2]
TABLE OF CONTENTS
Acknowledgements
Certificate
Objective
abstract
Introduction
Microcontrollers and Microprocessors
Embedded Systems
Types of Microcontrollers
8051 family
Harvard Architecture
8051 Architecture
Types of memory
Addressing modes
Timers
Interrupts Serial ports communication
Project description
appendix
References and bibliography
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
3/67
[3]
AKNOWLEDGEMENTS
We would also like to express our gratitude to Prof. Amrik Singh Head of the
Department, Elect ron ics & Communication Engineer ing, Guru Tegh Bahadur
Institute of Technology, for encouraging and inspiring us to carry out the project in
the Project lab.
We would also like to thankMr. Pawan Kumar and Mr. Gurmeet singh who have
given us unconditional support and help. Without their invaluable inputs and
distinguished guidance we could not have presented this dissertation up to the present
standard.
From materializing the idea to executing it and finally completing it, we were faced
with numerous challenges, all these people stood by us through thick and thin and
with their superior guidance and wisdom saw us through all of them.
We would also like to thank all the staff members of Guru Tegh Bahadur Institute of
Technology for providing us with the required facilities and support towards the
completion of the project.
Date:
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
4/67
[4]
CERTIFICATE
SUMMER TRAINING
ON
EMBEDDED SYSTEMS AND ROBOTICS
ORGANISED BY
THE DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
This is to certify that Mr. MANPREET SINGH Enrolment No 07913202809
Of B.Tech E.C.E branch, fourth semester has attended Embedded Systems and
Robotics course of 6 weeks summer training programme at Guru Tegh Bahadur
Institute of Technology
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
5/67
[5]
OBJECTIVE
ACADEMIC OBJECTIVE
Study basics of Microcontroller 8051 and its interfacing with different components
like LED, LDR, LCD, 7 Segments, Motors.
To have a command on programming the microcontroller using assembly language.
To learn basics of EMBEDDED SYSTEMS AND ROBOTICS.
PROJECT OBJECTIVE
Burglar detection - Burglars don't like alarm systems because they
provide too much risk of being caught, so most burglar will move on to a
home without a system.
Reducing loss - When you have a security system, it will work to deter
burglars from entering your home, which means that it is also minimizing
your chances of losing your possessions.
Prevent a confrontation - By having an alarm system, the alarm will sound
if an intruder breaks in, so if you come home and the alarm is sounding, you
know not to go into your home. This is the best way to avoid a confrontation
with a burglar, which can be traumatic for anyone.
Fire detection - Most of the alarms these days have a way that you can hook
up your smoke alarms to them. That way if a fire is detected, the alarm will
sound alerting you to the danger. It will also alert the security company to the
danger so they can call for help for you. This could save your family's lives.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
6/67
[6]
ABSTRACT
Engineering is not only a theoretical study but it is a implementation of all we study
for creating something new and making things more easy and useful through practical
study. It is an art which can be gained with systematic study, observation and practice.
In the college curriculum we usually get the theoretical knowledge of industries, and a
little bit of implementation knowledge that how it is works? But how can we prove
our practical knowledge to increase the productivity or efficiency of the industry?
Dont take the chance of becoming victim of burglary, which is often accompanied by
violence. Protect our family and valuables with this microcontroller based security
system that will let us rest our head knowing that should anyone trying to break into
our home, an alarm will go off and the police will be alerted immediately.
The transmitter section continuously transmits IR rays which are received by thereceiver section. The signal is received by photodiode, which further connected to a
microcontroller, in which we done a programming.
When the IR signal is interrupted, the microcontroller starts working as per the
program burnt into the EPROM and control the siren, telephone and cassette player
via the respective relays.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
7/67
[7]
INTRODUCTION
This training report is all about the embedded systems and its application in various
fields of real world. We are living in the Embedded World. We are surrounded with
many embedded products and our daily life largely depends on the proper functioning
of these gadgets. Television, Radio, CD player, Washing Machine or Microwave
Oven in our kitchen, Card readers, Access Controllers, Palm devices of our work
space enable us to do many of our tasks very effectively. Apart from all these, many
controllers embedded in our car take care of car operations between the bumpers. 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. Now we can agree to the fact that these
embedded products have successfully invaded into our world. What is this Embedded
System?
Theoretically, an embedded controller is a combination of piece of
microprocessor based hardware and the suitable software to undertake a
specific task.
I have made a Project based on Microcontroller that is a Prototype Home security
system. This training report covers all about the microcontroller and project
description.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
8/67
[8]
BODY OF THE REPORT
IDENTIFICATION OF DIFFERENT ELECTRONICS
COMPONENTS
SOLDERING IRON: - A soldering iron is a hand tool most commonly used in
soldering. It supplies heat to melt the solder so that it can flow into the joint between
two work pieces.
A soldering iron is composed of a heated metal tip and an insulated handle. Heating is
often achieved electrically, by passing an electric current (supplied through an
electrical cord or battery cables) through the resistive material of a heating element.
Another heating method includes combustion of a suitable gas, which can either be
delivered through a tank mounted on the iron (flameless), or through an external
flame.
LED: A light-emitting diode (LED) is a semiconductor light source. LEDs are used
as indicator lamps in many devices and are increasingly used for other lighting.
Introduced as a practical electronic component in 1962, early LEDs emitted low-
intensity red light, but modern versions are available across the visible, ultraviolet and
infrared wavelengths, with very high brightness.
When a light-emitting diode is forward biased (switched on), electrons are able to
recombine with electron holes within the device, releasing energy in the form of
photons. This effect is called electroluminescence and the color of the light
(corresponding to the energy of the photon) is determined by the energy gap of the
semiconductor. An LED is often small in area (less than 1 mm2), and integrated
optical components may be used to shape its radiation pattern. LEDs present many
advantages over incandescent light sources including lower energy consumption,
longer lifetime, improved robustness, smaller size, faster switching, and greater
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
9/67
[9]
durability and reliability. LEDs powerful enough for room lighting are relatively
expensive and require more precise current and heat management than compact
fluorescent lamp sources of comparable output.
Light-emitting diodes are used in applications as diverse as replacements for aviation
lighting, automotive lighting (particularly brake lamps, turn signals and indicators) as
well as in traffic signals. The compact size, the possibility of narrow bandwidth,
switching speed, and extreme reliability of LEDs has allowed new text and video
displays and sensors to be developed, while their high switching rates are also useful
in advanced communications technology. Infrared LEDs are also used in the remote
control units of many commercial products including televisions, DVD players, and
other domestic appliances.
LED voltage usually 2V, but 4V for blue and white LEDs
LED current 10mA = 0.01A, or 20mA = 0.02A
RESISTANCE: - A linear resistor is a two-terminal, linear, passive electronic
component that implements electrical resistance as a circuit element. The
current flowing through a resistor is in a direct proportion to the voltage across
the resistor's terminals. Thus, the ratio of the voltage applied across resistor's
terminals to the intensity of current flowing through the resistor is called
resistance. This relation is represented with a well-known Ohm's law:
Resistors are common 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). Resistors are also implemented within integrated
circuits, particularly analog devices, and can also be integrated into hybrid and
printed circuits.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
10/67
[10]
CAPACITOR: - A capacitor (formerly known as condenser) is a passive electrical
component used to store energy in an electric field. The forms of practical capacitors
vary widely, but all contain at least two conductors separated by a non-conductor.
Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
A capacitor is a passive electronic component consisting of a pair of conductors
separated by a dielectric (insulator). When there is a potential difference (voltage)
across the conductors, a static electric field develops across the dielectric, causing
positive charge to collect on one plate and negative charge on the other plate. Energy
is stored in the electrostatic field. An ideal capacitor is characterized by a single
constant value, capacitance, measured in farads. This is the ratio of the electric charge
on each conductor to the potential difference between them.
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of
power supplies, in the resonant circuits that tune radios to particular frequencies and
for many other purposes.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
11/67
[11]
INTRODUCTION OF MICROCONTROLLER:
A digital computer typically consists of three major components: the Central
Processing Unit, program and data memory and input/output systems. The CPU
controls the flow of information among the components of the computers. it also
processes the data by performing digital operations .most of the processing is done
arithmetic logical unit(ALU) within the CPU. When the CPU of a computer is built
on single printed circuit board then the computer is called minicomputer. A
microprocessor is a CPU which is compacted into a single-chip semiconductor device.Microprocessors are general purpose device suitable for many applications. A
computer built around a micro processor is called microcomputer. The choice of
input/output and memory device of a microcomputer depends upon the specific
applications.
A microcontroller is an entire computer built on a single chip. Microcontrollers are
usually dedicated devices embedded within an application. For example
microcontrollers are used in engine controllers in automobiles and exposure and focus
controller in cameras.
In order to serve this application, they have high concentration of on-chip facilities
such as serial ports, parallel I/O ports, timers, counters; interrupt control, analog to
digital converter, RAM, ROM etc.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
12/67
[12]
Microcontroller v/s Microprocessor
Microcontrollers differ from microprocessors in several ways. The main characteristic
of microcontrollers is their wide variety of on-chip peripheral functions and memory
that enable them to provide a single chip solution to many dedicated embedded
designs.
Microprocessors such as the Pentium inside a personal computer have only the
Central Processing Unit and Math Co-processing unit. These microprocessors do not
have built in memory, input or output functions such as parallel ports or serial ports
etc. They are optimized to provide only the raw arithmetic and logic functions
required by the operating system at the highest speed. All other components requiredto make the computer such as memory, input/output ports, serial, parallel, and mass
storage are provided by external chips and devices. The Pentium is designed to meet a
broad range of general computing needs that are provided with a personal computer.
A microprocessor such as the Pentium inside a personal computer normally has a very
large instruction set. In the case of the Pentium it is several hundred instructions. The
instructions cover a very broad range of tasks and functions. Some of these
instructions can be complex and take many internal steps to execute within the
processor. In computer jargon we categorize this type of instruction set as CISC or
Complex Instruction Set Computer. CISC has its advantages in the area that it is used
in such as high level languages and operating systems.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
13/67
[13]
One more characteristic of the microprocessor inside the personal computer is the way
it is attached to and uses memory. The read/write memory inside a pc is one very
large block of contiguous memory bytes. A typical PC may have between 256
Megabytes and 2 Gigabytes of RAM memory. This memory is used to store both
programs and data. The program that is running must keep track of what areas are
used for data and what areas are used for program instructions. A computer that usesthe same memory space for both data and program instructions is classified as
the Von Neumann architecture.
When we look at a typical microcontroller one of the first things we notice is that themicrocontroller contains its own memory, parallel ports, clock and very often a good
number of peripheral functions not found on a microprocessor. In the case of PIC
microcontrollers we will find both flash program memory where instructions are
stored and a separate ram memory space where only data is stored. Computers that
have separate memory spaces for data and program instructions are classified as
the Harvard Architecture. One particular advantage of the Harvard Architecture is
that data access operations can be taking place simultaneously with program
instruction execution. Each memory area has its own data bus to the CPU so
operations can go on during the same time frame. Many different manufacturers use
the Harvard Architecture for designs of microcontrollers because this design is veryefficient for designing specific purpose controllers that go into other systems.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
14/67
[14]
Microcontrollers usually get embedded into other products such as microwave ovens,
automobile engine controllers, power tools, appliances, industrial instruments, hand
held devices, cell phones and many other areas. The design and programming for
these types of products and applications has become so specialized that it has taken on
its own identity as embedded design.
The PIC microcontroller also has a very different type of instruction set. Theparticular PIC microcontroller located on the trainer board we will be using is the
PIC16F877A. This is in the midrange family but its capabilities are at the top end of
the midrange family. This unit only uses 35 instructions! This is the same for all
microcontrollers in the midrange family. The strategy that is used in the design of this
type of microcontroller is to make a few very simple instructions that execute very
fast. Using this strategy a complex task can be accomplished with the combination of
many very fast simple instructions in a relatively short time. Computers that use just a
small number of very simple instructions that execute very fast are classified
as RISC or Reduced Instruction Set Computers. Since PIC microcontrollers use only
35 very simple instructions they fit neatly into this category.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
15/67
[15]
EMBEDDED SYSTEMS
Any appliance that has a digital clock, for instance, has a small embedded
microcontroller that performs no other task than to display the clock. Modern cars
have embedded computers onboard that control such things as ignition timing andanti-lock brakes using input from a number of different sensors.
Embedded computers rarely have a generic interface, however. Even if embedded
systems have a keypad and an LCD display, they are rarely capable of using many
different types of input or output. An example of an embedded system with I/O
capability is a security alarm with an LCD status display, and a keypad for entering a
password.
In general, an Embedded System:
Is a system built to perform its duty, completely or partially independent of human
intervention.
Is specially designed to perform a few tasks in the most efficient way.
Interacts with physical elements in our environment, viz. controlling and driving a
motor, sensing temperature, etc.
An embedded system can be defined as a control system or computer system designed
to perform a specific task. Common examples of embedded systems include MP3
players, navigation systems on aircraft and intruder alarm systems. An embedded
system can also be defined as a single purpose computer.
Most embedded systems are time critical applications meaning that the embedded
system is working in an environment where timing is very important: the results of an
operation are only relevant if they take place in a specific time frame. An autopilot in
an aircraft is a time critical embedded system. If the autopilot detects that the plane
for some reason is going into a stall then it should take steps to correct this within
milliseconds or there would be catastrophic results.
USES OF EMBEDDED SYSTEMS
The uses of embedded systems are virtually limitless, because every day new products
are introduced to the market that utilizes embedded computers in novel ways. In
recent years, hardware such as microprocessors, microcontrollers, and FPGA chipshave become much cheaper. So when implementing a new form of control, it's wiser
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
16/67
[16]
to just buy the generic chip and write your own custom software for it. Producing a
custom-made chip to handle a particular task or set of tasks costs far more time and
money. Many embedded computers even come with extensive libraries, so that
"writing your own software" becomes a very trivial task indeed.
From an implementation viewpoint, there is a major difference between a computer
and an embedded system. Embedded systems are often required to provide Real-Time
response. AReal-Time system is defined as a system whose correctness depends on
the timeliness of its response. Examples of such systems are flight control systems of
an aircraft, sensor systems in nuclear reactors and power plants. For these systems,
delay in response is a fatal error. A more relaxed version ofReal-Time Systems is the
one where timely response with small delays is acceptable. Example of such a system
would be the Scheduling Display System on the railway platforms. In technical
terminology,Real-Time Systems can be classified as:
Hard Real-Time Systems - systems with severe constraints on the timeliness of
the response.
Soft Real-Time Systems - systems which tolerate small variations in response
times.
Hybrid Real-Time Systems - systems which exhibit both hard and soft
constraints on its performance.
Characteristics:
1. Embedded systems are always not stand alone devices. Many embedded
systems consist of small computerized part within a larger device that serves
more general purpose task. For example ABS in automobiles.
2. The program instructions written for embedded systems are referred to as
firmware and are stored in ROM.
Microcontroller
A microcontroller is a small computer on a single circuit containing a
processor core, memory, and programmable input/output peripherals. Program
memory in the form ofnor flash or OTP ROM is also often included on chip,
as well as a typically small amount ofRAM. Microcontrollers are designed for
embedded applications, in contrast to the microprocessors used in personal
computers or other general purpose applications.
http://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Flash_memory#NOR_flashhttp://en.wikipedia.org/wiki/Programmable_read-only_memoryhttp://en.wikipedia.org/wiki/Random-access_memoryhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Random-access_memoryhttp://en.wikipedia.org/wiki/Programmable_read-only_memoryhttp://en.wikipedia.org/wiki/Flash_memory#NOR_flashhttp://en.wikipedia.org/wiki/Input/output -
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
17/67
[17]
Microcontrollers are used in automatically controlled products and devices,
such as automobile engine control systems, implantable medical devices,
remote controls, office machines, appliances, power tools, toys and otherembedded systems. By reducing the size and cost compared to a design that
uses a separate microprocessor, memory, and input/output devices,
microcontrollers make it economical to digitally control even more devices
and processes. Mixed signal microcontrollers are common, integrating analog
components needed to control non-digital electronic systems.
Types:
Some microcontrollers may use four-bit words and operate at clock
rate frequencies as low as 4 kHz, for low power consumption (mill watts or
microwatts). They will generally have the ability to retain functionality while
waiting for an event such as a button press or other interrupt; powerconsumption while sleeping (CPU clock and most peripherals off) may be just
nanowatts, making many of them well suited for long lasting battery
applications. Other microcontrollers may serve performance-critical roles,
where they may need to act more like a digital signal processor (DSP), with
higher clock speeds and power consumption.
http://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Mixed-signal_integrated_circuithttp://en.wikipedia.org/wiki/Word_(computer_architecture)http://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Digital_signal_processorhttp://en.wikipedia.org/wiki/Digital_signal_processorhttp://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Word_(computer_architecture)http://en.wikipedia.org/wiki/Mixed-signal_integrated_circuithttp://en.wikipedia.org/wiki/Embedded_system -
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
18/67
[18]
8051 Microcontroller
Clones which are collectively referred to as the MCS-51 family of microcontrollers,
which includes chips from vendors such as Atmel, Philips, Infineon, and Texas
Instruments.
About the 8051:
The Intel 8051 is an 8-bit microcontroller which means that most available operations
are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and
Extended. The Short and Standard chips are often available in DIP (dual in-line
package) form, but the Extended 8051 models often have a different form factor, and
are not "drop-in compatible". All these things are called 8051 because they can all be
programmed using 8051 assembly language, and they all share certain features
(although the different models all have their own special features).
Some of the features that have made the 8051 popular are:
64 KB on chip program memory.
128 bytes on chip data memory (RAM).
8-bit data bus
16-bit address bus
32 general purpose registers each of 8 bits
16 bit timers (usually 2, but may have more, or less).
3 internal and 2 external interrupts.
Bit as well as byte addressable RAM area of 16 bytes.
Four 8-bit ports, (short models have two 8-bit ports).
16-bit program counter and data pointer.
1 Microsecond instruction cycle with 12 MHz Crystal.
8051 models may also have a number of special, model-specific features, such as
UARTs, ADC, Op Amps, etc...
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
19/67
[19]
Typical applications:
8051 chips are used in a wide variety of control systems, telecom applications, and
robotics as well as in the automotive industry. By some estimation, 8051 family chips
make up over 50% of the embedded chip market.
Pin configuration:
PIN 9: PIN 9 is the reset pin which is used reset the microcontrollers internal
registers and ports upon starting up. (Pin should be held high for 2 machine cycles.)
PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only
connect a crystal at these pins to provide clock pulses to the circuit.
PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip
needs +5V 500mA to function properly, although there are lower powered versions
like the Atmel 2051 which is a scaled down version of the 8051 which runs on +3V.
PINS 29, 30 & 31:As described in the features of the 8051, this chip contains a built-
in flash memory. In order to program this we need to supply a voltage of +12V at pin
31. If external memory is connected then PIN 31, also called EA/VPP, should be
connected to ground to indicate the presence of external memory. PIN 30 is called
ALE (address latch enable), which is used when multiple memory chips are connected
to the controller and only one of them needs to be selected. We will deal with this indepth in the later chapters. PIN 29 is called PSEN. This is "program store enable". In
order to use the external memory it is required to provide the low voltage (0) on both
PSEN and EA pins.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
20/67
[20]
PORTS:
There are 4 8-bit ports: P0, P1, P2 and P3.
PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can
be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual
roles or additional functions associated with them based upon the context of their
usage.
PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has
additional functions such as, serial transmit and receive pins, 2 external interrupt pins,
2 external counter inputs, read and write pins for memory access.
PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port
when no external memory is present, but if external memory access is required then
PORT P2 will act as an address bus in conjunction with PORT P0 to access external
memory. PORT P2 acts as A8-A15, as can be seen from fig 1.1
PORT P0 (pins 32 to 39): PORT P0 can be used as a general purpose 8 bit port whenno external memory is present, but if external memory access is required then PORT
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
21/67
[21]
P0 acts as a multiplexed address and data bus that can be used to access external
memory in conjunction with PORT P2. P0 acts as AD0-AD7, as can be seen from fig
1.1
Oscillator circuit:
The 8051 requires the existence of an external oscillator circuit. The oscillator circuit
usually runs around 12MHz, although the 8051 (depending on which specific model)
is capable of running at a maximum of 40MHz. Each machine cycle in the 8051 is 12
clock cycles, giving an effective cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz
(for the maximum 40MHz clock). The oscillator circuit that generates the clock pulses
so that all internal operations are synchronized.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
22/67
[22]
BLOCK DIAGRAM:
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
23/67
[23]
Program Start Address:
The 8051 starts executing program instructions from address 0000 in the program
memory.
Direct memory:
The 8051 has 256 bytes of internal addressable RAM, although only the first 128
bytes are available for general use by the programmer. The first 128 bytes of RAM
(from 0x00 to 0x7F) are called the Direct Memory, and can be used to store data.
Special function registers:
The Special Function Register (SFR) is the upper area of addressable memory, from
address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR. This area of memory cannot
be used for data or program storage, but is instead a series of memory-mapped ports
and registers. All port input and output can therefore be performed by
memory mov operations on specified addresses in the SFR. Also, different status
registers are mapped into the SFR, for use in checking the status of the 8051, and
changing some operational parameters of the 8051.
General Purpose Registers:
The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This
means that there are essentially 32 available general purpose registers, although only
8 (one bank) can be directly accessed at a time. To access the other banks, we need to
change the current bank number in the flag status register.
A and B Registers:
The A register is located in the SFR memory location 0xE0. The A register works in a
similar fashion to the AX register of x86 processors. The A register is called
the accumulator, and by default it receives the result of all arithmetic operations. The
B register is used in a similar
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
24/67
[24]
manner, except that it can receive the extended answers from the multiply and divide
operations. When not being used for multiplication and Division, the B register is
available as an extra general-purpose register.
Comparison of 8051 family members:
Feature 8051 8050 8031
ROM 4K 8K 0K
RAM 128K 256K 128K
TIMERS 2 3 2
I/O PORTS 32 32 32
SERIAL PORTS 1 1 1
INTRRUPT SOURCES 6 8 6
Registers:
The vast majority of 8051 registers are of 8-bits.the most widely used registers are:
Accumulator A
B R0
Rr1
R2
R3
R4
R5
R6
R7
Data pointer dptr
Program counter pc
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
25/67
[25]
Accumulator: used for arithmetic and logical instructions .it can hold an 8-bit
value and is most versatile register.
R registers: The R register is a set of 8 registers named from R0 to
R7.these registers are used as auxiliary registers
B Register: The b register is similar to the A registering nsame sense that it can
hold an 8-bit value.
Boolean Instructions
80C51 devices contain a complete Boolean (single-bit) processor. The internal
RAM contains 128 addressable bits, and the SFR space can support up to 128
addressable bits as well. All of the port lines are bit-addressable, and each one
can be treated as a separate single-bit port. The instructions that access these
bits are not just conditional branches, but a complete menu of move, set, clear,
complement, OR, and AND instructions. These kinds of bit operations are noteasily obtained in other architectures with any amount of byte-oriented
software.
Bit addresses 00H through 7FH are in the Lower 128, and bit addresses 80H
through FFH are in SFR space.
Note how easily an internal flag can be moved to a port pin:
MOV C,FLAG
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
26/67
[26]
MOV P1.0,C
In this example, FLAG is the name of any addressable bit in the Lower 128 or
SFR space. An I/O line (the LSB of Port 1, in this case) is set or cleared
depending on whether the flag bit is 1 or 0.
The Carry bit in the PSW is used as the single-bit Accumulator of the Boolean
processor. Bit instructions that refer to the Carry bit as C assemble as Carry-
specific instructions (CLR C, etc.). The Carry bit also has a direct address,
since it resides in the PSW register, which is bit-addressable.
Note that the Boolean instruction set includes ANL and ORL operations, but
not the XRL (Exclusive OR) operation. An XRL operation is simple to
implement in software. Suppose, for example, it is required to form the
Exclusive OR of two bits: C = bit1 .XRL. bit2
The software to do that could be as follows:
MOV C,bit1
JNB bit2,OVER
CPL C
OVER: (continue)
First, bit1 is moved to the Carry. If bit2 = 0, then C now contains the correct
result. That is, bit1 .XRL. bit2 = bit1 if bit2 = 0. On the other hand, if bit2 = 1,
C now contains the complement of the correct
result. It need only be inverted (CPL C) to complete the operation.
This code uses the JNB instruction, one of a series of bit-test instructions
which execute a jump if the addressed bit is set (JC, JB, JBC) or if the
addressed bit is not set (JNC, JNB). In the above case, bit2 is being tested, and
if bit2 = 0, the CPL C instruction is jumped over.
JBC executes the jump if the addressed bit is set, and also clears the bit. Thus
a flag can be tested and cleared in one operation. All the PSW bits are directlyaddressable, so the Parity bit, or the
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
27/67
[27]
general purpose flags, for example, are also available to the bit-test
instructions.
Relative Offset
The destination address for these jumps is specified to the assembler by a label
or by an actual address in Program memory.
However, the destination address assembles to a relative offset byte. This is a
signed (twos complement) offset byte which is added to the PC in twos
complement arithmetic if the jump is executed.
The range of the jump is therefore 128 to +127 Program Memory bytes
relative to the first byte following the instruction.
Jump Instructions.
The three SJMP, LJMP, and AJMP, are differ in the format of the destination
address. JMP is a generic mnemonic which can be used if the programmer
does not care which way the jump is encoded.
The SJMP instruction encodes the destination address as a relative offset, as
described above. The instruction is 2 bytes long, consisting of the opcode and
the relative offset byte. The jump
distance is limited to a range of128 to +127 bytes relative to the instruction
following the SJMP.
The LJMP instruction encodes the destination address as a 16-bit constant.
The instruction is 3 bytes long, consisting of the opcode and two address
bytes. The destination address can be anywhere in the 64k Program Memory
space.
The AJMP instruction encodes the destination address as an 11-bitconstant.
The instruction is 2 bytes long, consisting of the opcode, which itself contains
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
28/67
[28]
3 of the 11 address bits, followed by another byte containing the low 8 bits of
the destination address. When the instruction is executed, these 11 bits are
simply substituted for the low 11 bits in the PC. The high 5 bits stay the same.
Hence the destination has to be within the same 2k block as the instruction
following the AJMP. assembler in the same way: as a label or as a 16-bit
constant. The assembler will put the destination address into the correct format
for the given instruction. If the format required by the instruction will not
support the distance to the specified destination address, a Destination out of
range message is written into the List file.
The JMP @A+DPTR instruction supports case jumps. The destination address
is computed at execution time as the sum of the 16-bit DPTR register and the
Accumulator. Typically, DPTR is set up with the address of a jump table. In a
5-way branch, for example, an integer 0 through 4 is loaded into the
Accumulator. The code to be executed might be as follows:
MOV DPTR,#JUMP TABLE
MOV A,INDEX_NUMBER
RL A
JMP @A+DPTR
The RL A instruction converts the index number (0 through 4) to an even
number on the range 0 through 8, because each entry in the jump table is 2
bytes long:
JUMP TABLE:
AJMP CASE 0
AJMP CASE 1
AJMP CASE 2
AJMP CASE 3
AJMP CASE 4
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
29/67
[29]
There are two call statements LCALL and ACALL, which differ in the format
in which thesubroutine address is given to the CPU. CALL is a generic
mnemonic which can be used if the programmer does not care which way the
address is encoded.
The LCALL instruction uses the 16-bit address format, and the subroutine can
be anywhere in the 64k Program Memory space. The ACALL instruction uses
the 11-bit format, and the subroutine must be in the same 2k block as the
instruction following the ACALL.
In any case, the programmer specifies the subroutine address to the assembler
in the same way: as a label or as a 16-bit constant. The assembler will put the
address into the correct format for the given instructions.
Subroutines should end with a RET instruction, which returns execution to the
instruction following the CALL.
RETI is used to return from an interrupt service routine. The only difference
between RET and RETI is that RETI tells the interrupt control system that the
interrupt in progress is done. If there is no interrupt in progress at the time
RETI is executed, then the RETI is functionally identical to RET.
All of these jumps specify the destination address by therelative offset
method, and so are limited to a jump distance of128to +127 bytes from the
instruction following the conditional jump instruction. Important to note,
however, the user specifies to the assembler the actual destination address the
same way as the other jumps: as a label or a 16-bit constant.
There is no Zero bit in the PSW. The JZ and JNZ instructions test the
Accumulator data for that condition.
The DJNZ instruction (Decrement and Jump if Not Zero) is for loop control.
To execute a loop N times, load a counter byte with N and terminate the loop
with a DJNZ to the beginning of the loop, as shown below for N = 10.
MOV LOOP: (begin loop) COUNTER,#10
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
30/67
[30]
(end loop)
DJNZ(continue) COUNTER,LOOP
The CJNE instruction (Compare and Jump if Not Equal) can also be used for
loop control as in Figure 12. Two bytes are specified in the operand field of
the instruction. The jump is executed only if the two
bytes are not equal. The two bytes were data in R1 and the constant 2AH. The
initial data in R1 was 2EH. Every time the loop was executed, R1 was
decremented, and the looping was to continue until the R1 data reached 2AH.
Another application of this instruction is in greater than, less than
comparisons. The two bytes in the operand field are taken as unsigned
integers. If the first is less than the second, then the Carry bit is set (1). If the
first is greater than or equal to the second, then the Carry bit is cleared.
CPU Timing
All 80C51 microcontrollers have an on-chip oscillator which can be used if
desired as the clock source for the CPU. To use the on-chip oscillator, connect
a crystal or ceramic resonator between the XTAL1 and XTAL2 pins of the
microcontroller, and capacitors to ground.
Machine Cycles
A machine cycle consists of a sequence of 6 states, numbered S1 through S6.
Each state time lasts for two oscillator periods. Thus a machine cycle takes 12
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
31/67
[31]
oscillator periods or 1s if the oscillator frequency is 12MHz.
Each state is divided into a Phase 1 half and a Phase 2 half . Normally two
program fetches are generated during each machine cycle, even if the
instruction being executed doesnt require it. If the instruction being executed
doesnt need more code bytes, the CPU simply ignores the extra fetch, and the
Program Counter is not incremented.
Execution of a one-cycle instruction (Figures 15a and 15b) begins during State
1 of the machine cycle, when the opcode is latched into the Instruction
Register. A second fetch occurs during S4 of the same machine cycle.
Execution is complete at the end of State 6 of this machine cycle.
The MOVX instructions take two machine cycles to execute. No program
fetch is generated during the second cycle of a MOVX instruction. This is the
only time program fetches are skipped.
The fetch/execute sequences are the same whether the Program Memory is
internal or external to the chip. Execution times do not depend on whether the
Program Memory is internal or external.
If Program Memory is external, then the Program Memory read strobe PSEN
is normally activated twice per machine cycle. If an access to external Data
Memory occurs, two PSENs are skipped, because the address and data bus are
being used for the Data Memory access.
Note that a Data Memory bus cycle takes twice as much time as a Program
Memory bus cycle. Figure 16 shows the relative timing of the addresses being
emitted at Ports 0 and 2, and of ALE and PSEN. ALE is used to latch the low
address byte from P0 into the address latch.
When the CPU is executing from internal Program Memory, PSEN is not activated,
and program addresses are not emitted. However, ALE continues to be activated
twice per machine cycle and so it is available as a clock output signal. Note, however,
that one ALE is skipped during the execution of the MOVX instruction.
Serial communication
Beside stated above we've added to the already existing unit the possibility of
communication with an outside world. However, this way of communicating has its
drawbacks. One of the basic drawbacks is the number of lines which need to be used
in order to transfer data. What if it is being transferred to a distance of several
kilometers? The number of lines times number of kilometers doesn't promise the
economy of the project. It leaves us having to reduce the number of lines in such a
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
32/67
[32]
way that we don't lessen its functionality. Suppose we are working with three lines
only, and that one line is used for sending data, other for receiving, and the third one
is used as a reference line for both the input and the output side. In order for this to
work, we need to set the rules of exchange of data. These rules are called protocol.
Protocol is therefore defined in advance so there wouldn't be any misunderstanding
between the sides that are communicating with each other. For example, if one man is
speaking in French, and the other in English, it is highly unlikely that they will
quickly and effectively understand each other. Let's suppose we have the following
protocol. The logical unit "1" is set up on the transmitting line until transfer begins.
Once the transfer starts , we lower the transmission line to logical "0" for a period of
time (which we will designate as T), so the receiving side will know that it is
receiving data, and so it will activate its mechanism for reception. Let's go back now
to the transmission side and start putting logic zeros and ones onto the transmitter line
in the order from a bit of the lowest value to a bit of the highest value. Let each bit
stay on line for a time period which is equal to T, and in the end, or after the 8th bit,
let us bring the logical unit "1" back on the line which will mark the end of the
transmission of one data. The protocol we've just described is called in professional
literature NRZ (Non-Return to Zero).
LCD INTERFACING
These LCD screens are limited to text only and are often used in copiers, fax
machines, laser printers, industrial test equipment, networking equipment such as
routers and storage devices.
Character LCDs can come with or without backlights, which may be LED,
fluorescent, or electroluminescent.
Character LCDs use a standard 14-pin interface and those with backlights have 16
pins. The pinouts are as follows:
1. Ground
2. VCC (+3.3 to +5V)
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
33/67
[33]
3. Contrast adjustment (VO)
4. Register Select (RS). RS=0: Command, RS=1: Data
5. Read/Write (R/W). R/W=0: Write, R/W=1: Read
6. Clock (Enable). Falling edge triggered
7. Bit 0 (Not used in 4-bit operation)
8. Bit 1 (Not used in 4-bit operation)
9. Bit 2 (Not used in 4-bit operation)
10.Bit 3 (Not used in 4-bit operation)
11.Bit 4
12.Bit 5
13.Bit 6
14.Bit 7
15.Backlight Anode (+)
16.Backlight Cathode (-)
There may also be a single backlight pin, with the other connection via Ground or
VCC pin. The two backlight pins may precede the pin 1.
The nominal backlight voltage is around 4.2V at 25C using a VDD 5V capable
model.
Character LCDs can operate in 4-bit or 8-bit mode. In 4 bit mode, pins 7 through 10
are unused and the entire byte is sent to the screen using pins 11 through 14 by
sending 4-bits (nibble) at a time.
3- >VARISTOR
4-> RS
5-> RW
6-> EN
7-14-> DATA LINE INPUTS
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
34/67
[34]
LCD Command Codes:
CODE COMMAND TO LCD
1 Clear display screen
2 Return home
4 Shift cursor to left
6 Shift cursor to right
5 Shift display right
7 Shift display left
8 Display off, cursor off
A Display off, cursor on
C Display on, cursor off
E Display on, cursor blinking
F Display on, cursor blinking
10 Shift cursor position to left
14 Shift cursor position to right
18 Shift entire display to left
1C Shift entire display to right
80 Force cursor to beginning of 1st
line
C0 Force cursor to beginning of 2nd line
38 2 lines and 5x7 matrix
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
35/67
[35]
INTERFACING OF SEVEN SEGMENT WITH
MICROCONTROLLER
Seven segment display is been connected to port0 of the micro controller with a series
resistance of 330 ohms.
To enable a particular digit, the corresponding bit of the microcontroller is
made low.
Pin 40,31,9 are connected with the supply voltage.
Pin 20 is been grounded.
At Pin 18 and 19 crystal oscillator is provided for the clock pulse.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
36/67
[36]
Keypad
A keypad is a set of buttons arranged in a block or "pad" which usually bear
digits, symbols and usually a complete set of alphabetical letters. If it mostly
contains numbers then it can also be called a numeric keypad. Keypads are
found on many alphanumeric keyboards and on other devices such as
calculators, push-button telephones, combination locks, and digital door locks,
which require mainly numeric input. The key are arranged in form of mesh
where each key is connected to 1 row and 1 columns and the rows and
columns are connected to the port of microcontroller
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
37/67
[37]
EXPERT TALK:
Mr. Pramod from Ericson
o He discussed about different types of sensors used in the industry.
Starting with temperature sensor and extending his views with
hydraulic sensors, closed and automation sensors.
o The basic theme behind the session was project management.
Mr. Bhupesh from L and T
o He discussed about different parts of an operating system. He gave
away his views on topics like kernel, microkernel etc. another topics of
interest was cloud computing, memory management, cache memory
etc.
Mrs. Manpreet kapur from G.T.B.I.T.
o She discussed about various corporate etiquettes, difference between a
good and bad interview, different types of handshakes, organisational
behaviour, proper way of dressing for an interview, various interview
questions are also been discussed.
Mr. Tapan from L AND T
o He gave away his views on ARM processor, how ARM processor
forms a fundamental part of approximately every electronic gadget. He
also discussed about ARM nomenclature, pipeline organisation,
difference between CISC and RISC, operating modes of ARM
processor etc.
Mrs. Jasdeep Kaur from G.T.B.I.T.
o She discussed about Very Large Scale Integrated Circuits. The aim of
the session is to encourage designers to design the circuits which are
capable of operating at a LOW voltage (less than 3V).
o Various hardware designing techniques like difference between
cascade and cascade, advantages of CMOS transistors over BJTtransistors were also discussed.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
38/67
[38]
INDUSTRIAL VISITS:
LOK SABHA T.V.
o Industrial visit to lok sabha T.V. has been organised.
o Various transmission devices are shown like:
High definition camera.
Standard definition camera.
Master switcher.
o Production control room and master control room were also shown.
o Discussion about delay we receive in case of LIVE telecast due to
uplink and downlinking of the signal through satellites,towers etc.
o Different recording studios were also shown.
INDERPRASTHA GAS LIMITED
o Industrial visit to Inderprastha Gas Limited(IGL).
o Discussion on various unit of power and energy like MW,KW,KWH
etc.
o Procedure to generate electricity from gas and using the by product of
gas to again
generate electricity is also discussed.
o Plant visit includes introduction to:-
1) Boilers
2) Filters
3) Controllers
4) Relays
5) Turbine
6) Compressor
7) Tempertature sensor
8) Transformers
9) Transformer lines
10)Starter
o Master control room is also been shown which includes back up
system,emergency switch.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
39/67
[39]
Practicals done in training
Practical no 1st:
Aim: soldering and desoldering
The most fundamental skill needed to assemble any electronic project is that of
soldering. It takes some practice to make the perfect joint, but, like riding a bicycle,
once learned is never forgotten! The idea is simple: to join electrical parts together to
form an electrical connection, using a molten mixture of lead and tin (solder*) with a
soldering iron. A large range of soldering irons is available - which one is suitable for
you depends on your budget and how serious your interest in electronics is.
Voltage: most irons run from the mains at 240V. However, low voltage types (e.g.
12V or 24V) generally form part of a "soldering station" and are designed to be used
with a special controller made by the same manufacturer.
Wattage: Typically, they may have a power rating of between 15-25 watts or so,
which is fine for most work. A higher wattage does not mean that the iron runs hotter
- it simply means that there is more power in reserve for coping with larger joints.
This also depends partly on the design of the "bit" (the tip of the iron). Consider a
higher wattage iron simply as being more "unstoppable" when it comes to heavier-
duty work, because it won't cool down so quickly.
Temperature Control: the simplest and cheapest types don't have any form of
temperature regulation. Simply plug them in and switch them on! Thermal regulation
is "designed in" (by physics, not electronics!): they may be described as "thermally
balanced" so that they have some degree of temperature "matching" but their output
will otherwise not be controlled. Unregulated irons form an ideal general purpose iron
for most users, and they generally cope well with printed circuit board soldering andgeneral interwiring.
Bits: it's useful to have a small selection of manufacturer's bits (soldering iron tips)
available with different diameters or shapes, which can be changed depending on the
type of work in hand. You'll probably find that you become accustomed to, and work
best with, a particular shape of tip. Often, tips are iron-coatedto preserve their life, or
they may be bright-plated instead. Copper tips are seldom seen these days.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
40/67
[40]
Spare parts: it's nice to know that spare parts may be available, so if the element
blows, you don't need to replace the entire iron. This is especially so with expensive
irons.
You will occasionally see gas-poweredsoldering irons which use butane rather than
the mains electrical supply to operate. They have a catalytic element which, once
warmed up, continues to glow hot when gas passes over them. Service engineers use
them for working on repairs where there may be no power available, or where a joint
is tricky to reach with a normal iron, so they are really for occasional "on the spot"
use for quick repairs, rather than for mainstream construction or assembly work
How to make the perfect solder joint
All parts must be clean and free from dirt and grease.
Try to secure the work firmly.
"Tin" the iron tip with a small amount of solder. Do this immediately, with
new tips being used for the first time.
Clean the tip of the hot soldering iron on a damp sponge.
Many people then add a tiny amount of fresh solder to the cleansed tip.
Heat all parts of the joint with the iron for under a second or so.
Continue heating, then apply sufficient solder only, to form an adequate joint.
Remove and return the iron safely to its stand.
It only takes two or three seconds at most, to solder the average p.c.b. joint.
Do not move parts until the solder has cooled.
Desoldering methods
A soldered joint which is improperly made will be electrically "noisy", unreliable and
is likely to get worse in time. It may even not have made any electrical connection at
all, or could work initially and then cause the equipment to fail at a later date! It can
be hard to judge the quality of a solder joint purely by appearances, because you
cannot say how the joint actually formed on the inside, but by following the
guidelines there is no reason why you should not obtain perfect results.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
41/67
[41]
A joint which is poorly formed is often called a "dry joint". Usually it results from dirt
or grease preventing the solder from melting onto the parts properly, and is often
noticeable because of the tendency of the solder not to "spread" but to form beads or
globules instead, perhaps partially. Alternatively, if it seems to take an inordinately
long time for the solder to spread, this is another sign of possible dirt and that the joint
may potentially be a dry one.
There will undoubtedly come a time when you need to remove the solder from a joint:
possibly to replace a faulty component or fix a dry joint. The usual way is to use a
desoldering pumpor vacuum pump which works like a small spring-loaded bicycle
pump, only in reverse! (More demanding users using CMOS devices might need a
pump which is ESD safe.) A spring-loaded plunger is released at the push of a button
and the molten solder is then drawn up into the pump. It may take one or two attempts
to clean up a joint this way, but a small desoldering pump is an invaluable tool
especially for p.c.b. work.
Sometimes, it's effective to actually add more solder and then desolder the whole lotwith a pump, if the solder is particularly awkward to remove. Care is needed, though,
to ensure that the boards and parts are not damaged by excessive heat; the pumps
themselves have a P.T.F.E. nozzle which is heat proof but may need replacing
occasionally.
An excellent alternative to a pump is to use desoldering braid, including the famous
American "Soder-Wick" (sic) or Adcola "TISA-Wick" which are packaged in small
dispenser reels. This product is a specially treated fine copper braid which draws
molten solder up into the braid where it solidifies. The best way is to use the tip of the
hot iron to press a short length of braid down onto the joint to be de-soldered. The
iron will subsequently melt the solder, which will be drawn up into the braid. Take
extreme care to ensure that you don't allow the solder to cool with the braid adhering
to the work, or you run the risk of damaging p.c.b. copper tracks when you attempt to
pull the braid off the joint. See my photo gallery for more details.
I recommend buying a small reel of de-soldering braid, especially for larger or
difficult joints which would take several attempts with a pump. It is surprisingly
effective, especially on difficult joints where a desoldering pump may prove a
struggle.
First Aid
If you are unlucky enough to receive burns which require treatment, here's what to do
:-
1. Immediately cool the affected area with cold running water for several
minutes.
2. Remove any rings etc. before swelling starts.
3. Apply a sterile dressing to protect against infection.
4. Do not apply lotions, ointments etc., nor prick any blisters which form later.
5. Seek professional medical advice where necessary.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
42/67
[42]
Practical no 2nd
:
Aim: write your name with the help of ribbon wires on pcb
in this experiment we use ribbon wire , soldering wire, soldering iron and a general
purpose pcb, in which we solder ribbion wire on pcb for making our name on it, itwill enhance our soldering practice and make it perfect.
Practical no 3rd
:
Aim: Solder an IC base on pcb
In this experiment we use a 16 pin ic base, soldering wire, soldering iron and a pcb.
First we mount a ic base on a pcb and solder its legs without any short between the
legs.
Practical no 4th
:
Aim: Joining the legs of one ic base with other ic base
In this experiment we use two 16 pin ic bases, soldering wire, soldering iron and a
general purpose pcb. In this experiment we join even of one base to odd of another ic
base by using connecting wires, and make sure no to pins can be short.
Practical no 5th
:
Aim: drive an dc motor with the help of IC L293D
In this experiment we use dc motor, soldering wire, soldering iron, IC L293D,
regulated power supply. For this experiment first we have make a power supply of
regulated 5 V, after that we solder a 16 pin IC base on a pcb and make sure no two
pins of base where short.
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a higher-
current signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of
operation, two DC motors can be driven simultaneously, both in forward and reverse
direction. The motor operations of two motors can be controlled by input logic at pins
2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01
and 10 will rotate it in clockwise and anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to
start operating. When an enable input is high, the associated driver gets enabled. As a
result, the outputs become active and work in phase with their inputs. Similarly, when
http://www.engineersgarage.com/electronic-circuits/h-bridge-motor-controlhttp://www.engineersgarage.com/electronic-circuits/h-bridge-motor-control -
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
43/67
[43]
the enable input is low, that driver is disabled, and their outputs are off and in the
high-impedance state.
Pin Description:
Pin
NoFunction Name
1 Enable pin for Motor 1; active high Enable 1,2
2 Input 1 for Motor 1 Input 1
3 Output 1 for Motor 1 Output 1
4 Ground (0V) Ground
5 Ground (0V) Ground
6 Output 2 for Motor 1 Output 2
7 Input 2 for Motor 1 Input 2
8 Supply voltage for Motors; 9-12V (up to 36V) Vcc 29 Enable pin for Motor 2; active high Enable 3,4
10 Input 1 for Motor 1 Input 3
11 Output 1 for Motor 1 Output 3
12 Ground (0V) Ground
13 Ground (0V) Ground
14 Output 2 for Motor 1 Output 4
15 Input2 for Motor 1 Input 4
16 Supply voltage; 5V (up to 36V) Vcc 1
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
44/67
[44]
Practical no 6th
:
Aim: glowing an LED using LDR
In this experiment we use an LED, LDR, IC LMB24, IC 40106, resistances, regulated
power supply. Soldering iron, soldering wire. In this experiment we introduce theconcept of pull up and pull down resistance, in this experiment we use pull down
resistance with the LDR.
Practical no 7th
:
Aim: working of a relay with transistor and IC ULN2003
In this experiment we use relay, transistor BC 557, IC ULN2003, regulated power
supply, key, resistances, LED, etc.
Circuit diagram for a relay with a transistor is:
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
45/67
[45]
Circuit diagram for a relay and an IC ULN2003
Description of the project:
Introduction:
Protect our family and valuables with this microcontroller based security system
knowing that should anyone trying to break into our home, an alarm will go ON and
the police will be alerted immediately.
The microcontroller based security system consists of transmitter, receiver, phase
locked loop and processing section. The transmitter section continuously transmits IR
rays which are received by the receiver section. The received signal is further
amplified and given to the PLL section, where its frequency is locked to the
transmitted frequency. The transmitter and receiver are arranged such that the
transmitted IR rays fall directly onto the photodiode the receiver.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
46/67
[46]
Diagram shown above is a block diagram of microcontroller based security system, in
this for transmitting section we use ir sensor and for receiving we use photo diodes,
when there is interrupt between ir rays, it give its response to the microcontroller and
according to microcontroller programming it work further and the alarms starts.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
47/67
[47]
Circuit diagram:
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
48/67
[48]
COMPONENTS DISCRIPTION
Microcontroller P89V51:
80C51 Central Processing Unit
5 V Operating voltage from 0 MHz to 40 MHz
16/32/64 kB of on-chip Flash user code memory with ISP (In-System
Programming) and IAP (In-Application Programming)
Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each)
Photo diode:
Features
PIN photodiode
Package type: T-1 3/4 (5mm lens diameter)
Wide reception angle, 40
Daylight filter
Package material and color: black epoxy
High sensitivity
Peak sensitivity= 880nm
Radiant sensitive area: 1.245mm x 1.245mm
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
49/67
[49]
Absolute Maximum Ratings
(TA= 25C unless otherwise specified)
Stresses exceeding the absolute maximum ratings may damage the device. The device
may not function or beoperable above the recommended operating conditions and stressing the parts to these
levels is not recommended.
In addition, extended exposure to stresses above the recommended operating
conditions may affect device reliability.
The absolute maximum ratings are stress ratings only
Ir LEDs:
Infrared (IR) light is electromagnetic radiation with a wavelength longer than that of
visible light, measured from the nominal edge of visible red light at 0.74 micrometers,
and extending conventionally to 300 micrometers. These wavelengths correspond to a
frequency range of approximately 1 to 400 THz,[1]
and include most of the thermal
radiation emitted by objects near room temperature. Microscopically, IR light is
typically emitted or absorbed by molecules when they change their rotational-
vibration movements.
Its appropriate operating voltage is around 1.4v.
The current is generally smaller than 20mA.
It emits IR rays which receive by photodiode in our project.
http://en.wikipedia.org/wiki/Electromagnetic_radiationhttp://en.wikipedia.org/wiki/Wavelengthhttp://en.wikipedia.org/wiki/Visible_lighthttp://en.wikipedia.org/wiki/Redhttp://en.wikipedia.org/wiki/Micrometerhttp://en.wikipedia.org/wiki/Micrometrehttp://en.wikipedia.org/wiki/THzhttp://en.wikipedia.org/wiki/Infrared#cite_note-0http://en.wikipedia.org/wiki/Infrared#cite_note-0http://en.wikipedia.org/wiki/Infrared#cite_note-0http://en.wikipedia.org/wiki/Thermal_radiationhttp://en.wikipedia.org/wiki/Thermal_radiationhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Infrared_spectroscopyhttp://en.wikipedia.org/wiki/Thermal_radiationhttp://en.wikipedia.org/wiki/Thermal_radiationhttp://en.wikipedia.org/wiki/Infrared#cite_note-0http://en.wikipedia.org/wiki/THzhttp://en.wikipedia.org/wiki/Micrometrehttp://en.wikipedia.org/wiki/Micrometerhttp://en.wikipedia.org/wiki/Redhttp://en.wikipedia.org/wiki/Visible_lighthttp://en.wikipedia.org/wiki/Wavelengthhttp://en.wikipedia.org/wiki/Electromagnetic_radiation -
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
50/67
[50]
Power Supply:
There are many types of power supply. Most are designed to convert high voltage AC
mains electricity to a suitable low voltage supply for electronic circuits and otherdevices. A power supply can by broken down into a series of blocks, each of which
performs a particular function.
For example a 5V regulated supply:
Each of the blocks is described in more detail below:
Transformer - steps down high voltage AC mains to low voltage AC.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
51/67
[51]
Rectifier - converts AC to DC, but the DC output is varying.
Smoothing - smooths the DC from varying greatly to a small ripple.
Regulator - eliminates ripple by setting DC output to a fixed voltage.
Power supplies made from these blocks are described below with a circuit diagram
and a graph of their output:
Transformer only
Transformer + Rectifier
Transformer + Rectifier + Smoothing
Transformer + Rectifier + Smoothing + Regulator
Transformer only
The low voltage AC output is suitable for lamps, heaters and special AC motors. It is
not suitable for electronic circuits unless they include a rectifier and a smoothing
capacitor
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
52/67
[52]
Transformer + Rectifier
The varying DC output is suitable for lamps, heaters and standard motors. It is not
suitable for electronic circuits unless they include a smoothing capacitor.
Transformers convert AC electricity from one voltage to another with little loss of
power. Transformers work only with AC and this is one of the reasons why mains
electricity is AC.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most
power supplies use a step-down transformer to reduce the dangerously high mains
voltage (230V in UK) to a safer low voltage.
The input coil is called the primary and the output coil is called the secondary. There
is no electrical connection between the two coils, instead they are linked by an
alternating magnetic field created in the soft-iron core of the transformer. The two
lines in the middle of the circuit symbol represent the core.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
53/67
[53]
Transformer
Transformers waste very little power so the power out is (almost) equal to the power
in. Note that as voltage is stepped down current is stepped up.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most
power supplies use a step-down transformer to reduce the dangerously high mains
voltage (230V in UK) to a safer low voltage.
The input coil is called the primary and the output coil is called the secondary. There
is no electrical connection between the two coils, instead they are linked by an
alternating magnetic field created in the soft-iron core of the transformer. The two
lines in the middle of the circuit symbol represent the core.
Transformers waste very little power so the power out is (almost) equal to the power
in. Note that as voltage is stepped down current is stepped up.
The ratio of the number of turns on each coil, called the turns ratio, determines theratio of the voltages. A step-down transformer has a large number of turns on its
primary (input) coil which is connected to the high voltage mains supply, and a small
number of turns on its secondary (output) coil to give a low output voltage.
turns ratio =Vp
=Np
andpower out = power in
Vs Ns Vs Is = Vp Ip
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current
Vs = secondary (output) voltage
Ns = number of turns on secondary coil
Is = secondary (output) current
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
54/67
[54]
Rectifier
There are several ways of connecting diodes to make a rectifier to convert AC to DC.
The bridge rectifier is the most important and it produces full-wave varying DC. A
full-wave rectifier can also be made from just two diodes if a centre-tap transformer is
used, but this method is rarely used now that diodes are cheaper. A single diode can
be used as a rectifier but it only uses the positive (+) parts of the AC wave to produce
half-wave varying DC.
Bridge rectifier
A bridge rectifier can be made using four individual diodes, but it is also available in
special packages containing the four diodes required. It is called a full-wave rectifier
because it uses all the AC wave (both positive and negative sections). 1.4V is used up
in the bridge rectifier because each diode uses 0.7V when conducting and there are
always two diodes conducting, as shown in the diagram below. Bridge rectifiers are
rated by the maximum current they can pass and the maximum reverse voltage they
can withstand (this must be at least three times the supply RMS voltage so the
rectifier can withstand the peak voltages). Please see the Diodes page for more
details, including pictures of bridge rectifiers.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
55/67
[55]
Smoothing
Smoothing is performed by a large value electrolytic capacitor connected across theDC supply to act as a reservoir, supplying current to the output when the varying DC
voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC
(dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the
peak of the varying DC, and then discharges as it supplies current to the output.
Note that smoothing significantly increases the average DC voltage to almost the
peak value (1.4 RMS value). For example 6V RMS AC is rectified to full wave DC
of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases
to almost the peak value giving 1.4 4.6 = 6.4V smooth DC.
Smoothing is not perfect due to the capacitor voltage falling a little as it discharges,
giving a small ripple voltage. For many circuits a ripple which is 10% of the supply
voltage is satisfactory and the equation below gives the required value for the
smoothing capacitor. A larger capacitor will give less ripple. The capacitor valuemust be doubled when smoothing half-wave DC.
Smoothing capacitor for 10% ripple, C =5 Io
Vs f
C =smoothing capacitance in farads (F)
Io = output current from the supply in amps (A)
Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DC
f = frequency of the AC supply in hertz (Hz), 50Hz in the UK
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
56/67
[56]
Regulator
Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable
output voltages. They are also rated by the maximum current they can pass. Negative
voltage regulators are available, mainly for use in dual supplies. Most regulators
include some automatic protection from excessive current ('overload protection') and
overheating ('thermal protection').
Many of the fixed voltage regulator ICs have 3 leads and look like power transistors,
such as the 7805 +5V 1A regulator shown on the right. They include a hole for
attaching a heatsink if necessary.
Zener diode regulator
For low current power supplies a simple voltage regulator can be made with a resistor
and a zener diode connected in reverse as shown in the diagram. Zener diodes are
rated by their breakdown voltage Vz and maximum power Pz (typically 400mW or
1.3W).
The resistor limits the current (like an LED resistor). The current through the resistoris constant, so when there is no output current all the current flows through the zener
diode and its power rating Pz must be large enough to withstand this.
Choosing a zener diode and resistor:
The zener voltage Vz is the output voltage required
The input voltage Vs must be a few volts greater than Vz
(this is to allow for small fluctuations in Vs due to ripple)
The maximum current Imax is the output current required plus 10%
The zener power Pz is determined by the maximum current: Pz > Vz Imax
The resistor resistance: R = (Vs - Vz) / Imax
The resistor power rating: P > (Vs - Vz) Imax
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
57/67
[57]
IC LM324:
IC LM324 consists of 4 comparator circuits.
A comparator is a circuit which is used to compare voltage applied at 1
terminal with the reference voltage at another terminal.
When Vin < Vref ; Output will be LOW.(0V)
When Vin > Vref ; Output will be HIGH.(3.83V)
Vin = 2.67V (without vehicle).
Vin = 3.83V (with vehicle).
Vref = 3.2V
Whenever Vin > Vref, the output of the comparator goes HIGH (3.9V) else it
will remain LOW (0V).
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
58/67
[58]
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
59/67
[59]
IC 40106:
The HEF40106B provides six inverting buffers. Each input has a Schmitt trigger
circuit. The inverting buffer switches at different points for positive-going and
negative-going signals. The difference between the positive voltage (VT+) and the
negative voltage (VT) is defined as hysteresis voltage (VH). The HEF40106B may
be used for enhanced noise immunity or to square up slowly changing waveforms.
It operates over a recommended VDD power supply range of 3 V to 15 V referenced
to VSS (usually ground). Unused inputs must be connected to VDD, VSS, or another
input. It is also suitable for use over both the industrial (40 C to +85 C) and
automotive (40 C to +125 C) temperature ranges.
Features and benefits
1. Schmitt trigger input discrimination
2. Fully static operation
3. 5 V, 10 V, and 15 V parametric ratings
4. Standardized symmetrical output characteristics
5. Operates across the automotive temperature range from 40 C to +125 C
6. Complies with JEDEC standard JESD 13-B
Applications:
1. Wave and pulse shapers
2. Astable multivibrators
3. Monostable multivibrators
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
60/67
[60]
IC L293D:
Description:
The L293 and L293D are quadruple high-current half-H drivers. The L293 is
designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to
36 V. The L293D is designed to
provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V.
Both devices are designed to drive inductive loads such as relays, solenoids, dc and
bipolar stepping motors, as well as other high-current/high-voltage loads in positive-
supply applications. All inputs are TTL compatible. Each output is a complete totem-
pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source.
Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and
4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled
and their outputs are active and in phase with their inputs. When the enable input is
low, those drivers are disabled and
their outputs are off and in the high-impedance state. With the proper data inputs,
each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid ormotor applications. On the L293, external high-speed output clamp diodes should be
used for inductive transient suppression. A VCC1 terminal, separate from VCC2, is
provided for the logic inputs to minimize device power dissipation. The L293and
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
61/67
[61]
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
62/67
[62]
WORKING
Whenever an interrupt came in between the IR led and photo diode, voltage
across IR led increases to 1.5V.
This 1.5 volt becomes input to the IC LM324 which is comparator with
reference voltage 1V.
As input increases to more than 1V then its output becomes 3.8V.
This is fed into Schmitt trigger 40106(CMOS) as input and gave output
exactly 0V.
This Schmitt trigger output is connected to pin 14 of microcontroller P89V51.
According to our programming when we get 0 on pin 14 of microcontroller,
its start working.
On pin no 1 and 2 of microcontroller we connect IC L293D, which will help
in driving the motor and the door locked.
And also buzzer start buzzing and leds glow which is connected on port P2
of microcontroller.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
63/67
[63]
FUTURE SCOPE
Our project can be interfaced with the LCD to display the message.
It can be interfaced with the computer and sends the message to user if any
unauthorized person wants to enter home.
We can add a more sensors like wire loop sensor, magnetic sensor, fire sensor.
It can sense when there is a fire in the home.
We can use laser in place of photo diode an ir sensor to make it more efficient.
It can be use for military purpose.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
64/67
[64]
CONCLUSION
An automated home can be a very simple grouping of controls, or it can be heavily
automated where any appliance that is plugged into electrical power is remotely
controlled. Costs mainly include equipment, components, furniture, and custom
installation.
Ongoing costs include electricity to run the control systems, maintenance costs for the
control and networking systems, including troubleshooting, and eventual cost of
upgrading as standards change. Increased complexity may also increase maintenancecosts for networked devices. Learning to use a complex system effectively may take
significant time and training.
Control system security may be difficult and costly to maintain, especially if the
control system extends beyond the home, for instance by wireless or by connection to
the internet or other networks.
The Microcontroller will continuously monitors all the Sensors and if it found any
security problem then the Microcontroller will switch on the Alarm until the Reset
button was Pressed.
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
65/67
[65]
APPENDIX
FIG. NO. DESCRIPTION PAGE NO.
1 VARIABLE RESISTOR 10
2 ELECTROLYTIC CAPACITOR 11
3 CERAMIC CAPACITOR 12
4 SMOOTHING OF WAVEFORM 14
5 HALF WAVE RECTIFIER 15
6 FULL WAVE RECTIFIER 16
7 BRIDGE RECTIFIER 16
8 VOLTAGE REGULATOR 17
9 L.D.R. 18
10 SEVEN SEGMENT DISPLAY 19
11 COMMON ANODE, COMMON CATHODE 19
12 TRANSISTOR AS A SWITCH 20
13 ADDRESS BUS OF 8051 21
14 MICROPROCESSOR 22
15 MICROCONTROLLER 23
16 8-BIT REGISTER 25
17 PIN DIAGRAM OF 8051 27
18 CRYSTAL OSCILLATOR 28
19 POWER ON RESET CIRCUIT 28
20 OPEN DRAIN 30
21 MEMORY MAPPING 30
22 REGISTER BANK 31
23 STACK 31
24 INTERFACING OF LED WITH MIC 35
25 INTERFACING OF SEVEN SEGMENT WITH MIC 36
26 INTERFACING OF LCD WITH MIC 37
27 POWER SUPPLY 52
28 TRANSFORMER 53
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
66/67
[66]
29 DIODES 53
30 CAPACITOR 53
31 RESISTANCE AND LED 54
32 IR LED 55
33 PHOTODIODE 56
34 PHOTODIODE 57
35 OPTOCOUPLER 58
36 IC LM324 59
37 IC 40106 61
38 PIN DIAGRAM OF 8051 6439 CRYSTAL OSCILLATOR 65
40 POWER ON RESET CIRCUIT 65
-
7/31/2019 Guru Tegh Bahadur Institute by Manpreet
67/67
REFRENCES
[1] The 8051 Microcontroller and Embedded System, Muhammad Ali Mazidi and
Jancie Gillespie Mazidi,
[2] Myke Predko, Programming and Customising the 8051 Microcontroller,TMH
[3] The 8051 Microcontroller by Kenneth J. Ayala,
[4] http://www.keil.com/appnotes
[5] http://www.datasheetdirect.com
[6] (http://www.design-
reuse.com/articles/21745/8051_memeory_architecturer.html)
[7] (http://roboticsdream.blogspot.com/search/label/8051_microcontroller)
[8] https://reader009.{domain}/reader009/html5/0428/5ae38c9aa3055/5ae38cc5b4f24.jpg)
[9] ( http://www.free-circuits.com/circuits//-segment-rolling-display)
http://www.keil.com/appnoteshttp://www.keil.com/appnoteshttp://www.datasheetdirect.com/http://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://roboticsdream.blogspot.com/search/label/8051_microcontrollerhttp://roboticsdream.blogspot.com/search/label/8051_microcontrollerhttp://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://www.design-reuse.com/articles/21745/8051_memeory_architecturer.htmlhttp://www.datasheetdirect.com/http://www.keil.com/a