Sunteți pe pagina 1din 41

PREFACE

In today’s competitive world, computer has assumed critical importance in every field. It has
become an essential qualification for almost all ventures. In our Bachelor’s Degree of
Computer Science, we have been prepared to be at par with the industrial requirements. But
theoretical knowledge is not just enough in present era. Theoretical knowledge accompanied
with the practical know how prepares us good for the industry.

The main purpose of training is to expose the students with practical experience of actual
industrial environment in which they will be required to work in near future. During this
training period, I learnt a lot from professionals. Along with technical skills I also learnt some
of the management skills, which are necessary for overall personality development.

This training report pertains to the industrial training that I under went at ‘EEAST, Sector35-
C, CHANDIGARH as part of curriculum of my four year Degree Course.

So, in short the industrial training and the project work undertaken during this training exhibit
the practical knowledge of the student.

In this report I have tried to sum up the details of embedded systems and microcontroller.
Justification can’t be done to whatever I have learnt here within few pages but I have tried
my best to cover as much as possible in this report.
CHAPTER -1
COMPANY PROFILE

Technology changes drastically within the counts of time and it have become vicissitude of
life. To survive in the air of cutthroat competition, one needs to be fully cognizant with the
changing trends of the technology, the needs of the clients and the employers, in brief, with
almost all the aspects o f the industry. There is great demand for system designing engineers
working on the embedded systems. This demand is going to rise further in the coming years.
Other factor favorable for this is the incursion of foreign especially American companies in
India.

EEAST is a complete R & D Organization dedicated to provide Electronics and


Advanced Software Products and Solutions to its Clients. Achieving the needs of our
customer and converting their ideas to real models is our motto. We are working in the field
of Embedded Systems, Automation and Advanced System design for the last four years with
the vision of becoming a center of Excellence to provide Solutions, Services and Training in
various fields of technologies.

EEAST has the distinction of being a pioneer among the embedded companies in India,
engaged in imparting high-end training in all aspects of Embedded Systems Design and
Project development in various fields of engineering and technology for graduates,
undergraduates and postgraduates of the appropriate discipline, the

2
training at EEAST is not merely passing knowledge but build intelligence among the
participants to achieve goals in their life by thoroughly exposing them to industrial
environment and projects. We work on overall development of our employees and trainees.

EEAST is an organization providing advanced projects, complete electronic solutions in


development systems like microprocessor, micro - controllers, wireless communications,
optical – fiber communications, real time operating systems, digital signal processing,
Embedded Systems and Micro - Sensors including software solution, solutions in C, C++,
Java, .Net, Visual, C++ Visual basic, embedded C and Embedded LINUX. We have been
providing projects and solutions professionally to various industries, academically to
innumerable number of students. In our endeavor for excellence and manpower developments
in this field, we are providing on these technologies specially customized for individual
needs.

3
CHAPTER- 2
INTRODUCTION
2.1 EMBEDDED SYSTEMS
Embedded systems are computers (microprocessors) enclosed (embedded) in customized
hardware. An embedded system is any electronic system that uses a central processing unit
(CPU) chip, but that is not a general purpose workstation, desktop computer or notebook.
Such systems generally use microprocessors or customized chips or both. In embedded
systems the software is permanently set into the ROM or Flash memory chip in contrast to a
general-purpose computer that loads its programs into RAM each time. An embedded
systems is an application-oriented special computer systems, which is scalable on both
software and hardware. It can satisfy the strict requirements of functionality, reliability, cost,
volume and power consumption of the particular application.

With the rapid development of IC design and manufacturing, CPUs have become cheap. A
lot of consumer electronics devices have embedded CPUs and thus have become embedded
systems eg PDAs , cellphones, VCRs, industrial robot control or even your toasters can be an
embedded system. A series of emerging equipment such as set-top box, home media center,
portable media player, mobile DVD etc are joining the embedded systems camp. With the
continuing convergence of communication and computing functions within devices,
embedded systems are becoming more complex and thus creating demands for more
powerful processors and peripherals. Some reports expect that the demand on embedded
CPUs is ten times as large as for general purpose PC CPUs.

4
2.2 A SIMPLE EMBEDDED SYSTEM
One possible organization for an embedded system is shown in the fig. In addition to the
CPU and memory hierarchy, there are variety of interfaces that enable the system to measure,
manipulate and otherwise interact with external environment. So differences with desktop
computing could be

• The human interface may as simple as flashing lights or as complicated as real time
robotic vision

• The diagnostic code may be used for diagnosing the system that is being controlled-
not just diagnosing the computer
• Special-purpose filed programmable (FPGA), Application specific (ASIC) or even
non digital hardware may be used to increase performance or safety.
• Software often has a fix function and is specific to the application

In addition to the emphasis on interaction with the internal world, embedded systems also
provide functionality specific to their applications. Instead of executing spreadsheets, word
processing and engineering analysis, Embedded systems typically execute control laws, finite
state machines and signals processing algorithms. They must often deduct and react to faults
in both the computing and surrounding electro-mechanism systems, and must manipulate
applications-specific user-interface devices. The usual reason for embedding a computer is to
interact with the environment, often the monitoring and controlling internal machinery. In
order to do this, analog inputs and outputs must be transformed to and from digital signals
levels. Additionally, significant current loads may be needed to be switched in order to
operate motor, light fixtures and other actuators. All these requirements can lead to large
computer circuit board dominated by non digital components. In other systems ‘ smart’
sensors and actuators (that contain their own analog interfaces, power switches and small
CPUs) may be used to off-load interface hardware from the central embedded computer.
Embedded systems typically have right constraints on both functioning and implementation.

5
In particular, they must guarantee real-time operation reactive to external events, conform to
size and weight limits, budget power and cooling consumption, satisfy safety and reliability
requirements and meet tight cost targets.

2.3 MICROCONTROLLER

Microcontroller are widely used in Embedded System products. An Embedded product uses
the microprocessor(or microcontroller) to do one task & one task only. A printer is an
example of Embedded system since the processor inside it perform one task only namely
getting the data and printing it. Contrast this with Pentium based PC. A PC can be used for
any no. of applications such as word processor, print server, bank teller terminal, video game
player, network server or internet terminal. Software for variety of applications can be loaded
and run. Of course the reason a PC can perform multiple task is that it has RAM memory and
an operating system that loads the application software into RAM & lets the CPU run it. In
and Embedded system there is only one application software that is typically burn into ROM.
An x86PC Contain or its connected to various Embedded Products such as keyboard, printer,
modem, Disc controller, Sound card, CD-ROM Driver, Mouse & so on. Each one of these
peripherals as a microcontroller inside it that performs only one task. Although
microcontroller are preferred choice for many Embedded systems, There are times that a
microcontroller is inadequate for the task. For this reason in recent years many manufactures
of general purpose microprocessors such as INTEL, Motorolla, AMD & Cyrix have targeted
their microprocessors for the high end of Embedded market. While INTEL, AMD, Cyrix
push their x86 processors for both the embedded and desktop pc market, Motorolla is
determined to keep the 68000 families alive by targeting it mainly for high end of embedded
system.

One of the most critical needs of the embedded system is to decrease power consumptions
and space. This can be achieved by integrating more functions into the CPU chips. All the
embedded processors based on the x86 and 680x0 have low power consumptions in additions
to some forms of I/O, Com port & ROM all on a single chip. In higher performance
Embedded system the trend is to integrate more & more function on the CPU chip & let the
designer decide which feature he/she wants to use.

2.4 EMBEDDED SYSTEM APPLICATIONS


6
i. Consumer electronics, e.g., cameras, cell phones etc.
ii. Consumer products, e.g. washers, microwave ovens etc.
iii. Automobiles (anti-lock braking, engine control etc.)
iv. Industrial process controller & defense applications.
v. Computer/Communication products, e.g. printers, FAX machines etc.
vi. Medical Equipments.
vii. ATMs
viii. Aircrafts

7
CHAPTER- 3
MICROCONTROLLERS (MCU)
Figure shows the block diagram of a typical microcontroller, which is a true
computer on a chip. The design incorporates all of the features found in
micro-processor CPU: ALU, PC, SP, and registers. It also added the other
features needed to make a complete computer: ROM, RAM, parallel I/O,
Serial I/O, counters, and clock circuit.

ALU TIMER/COUNTER I/0


PORT

ACCUMULATOR
I/O
REGISTERS PORT

INTERNAL INTERRUPT
INTERNAL CKTS
ROM
RAM

ALU CLOCK
CIRCUIT

PROGRAM COUNTER

BLOCK DIAGRAM OF MICROCONTROLLER


8
CHAPTER- 4
MICROCONTROLLER
ARCHITECTURE

4.1 VARIOUS MICROCONTROLLERS


 FIRST MICROCONTROLLER IS ‘8031’

• FEATURES
(i) It is Intel’s product. Neither a microprocessor nor a microcontroller.
(ii) It is a 8-bit controller.
(iii) Internally no ROM is provided i.e. code is outside the chip.

 SECOND MICROCONTROLLER IS ‘8051’


• FEATURES
(i) It is a first complete 8-bit microcontroller.
(ii) It is a name of a family. In which the instruction set, pin configuration,
architecture is same, only memory storage capacity is different.
(iii) Internally PROM (programmable read only memory) is provided so it
Called one time programmable (OTP).

 THIRD MICROCONTROLLER IS ‘AT89C51’

• FEATURES
(i) It is a similar to 8051 microcontroller i.e. having same instruction set,
pin configuration, architecture.
(ii) It is a also 8-bit microcontroller. It’s cost is only Rs10 more than 8051.
(iii) It uses EPROM (erasable programmable read only memory) or
FLASH memory.
(iv) it is Multiple time programmable (MTP)i.e. 1000 times. So it is better
than 8051.

9
4.2 ATMEL 89C51
It is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash
programmable and erasable read only memory (PEROM). The device is manufactured using
Atmel’s high-density non volatile memory technology and is compatible with the industry
standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory
to be reprogrammed in system or by a conventional non volatile memory programmer. By
combining a versatile 8- bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer, which provides a highly flexible and cost-effective solution to
many embedded control applications.

4.3 THE 8051 MICROCONTROLLER


The 8051 provides the following standard features: 4Kbytes of ROM, 128 bytes of RAM, 32
I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full
duplex serial port, on-chip oscillator and clock circuitry. In addition, the 8051 is designed
with static logic for operation down to zero frequency and supports two software selectable
power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters,
serial port and interrupt system to continue functioning. The Power down Mode saves the
RAM contents but freezes the oscillator disabling all other chip functions until the next
hardware reset.

4.4 THE 8051 MICROCONTROLLER’S ARCHITECRTURE


consists of these specific features

• Eight-bit CPU with registers A (the accumulator) & B.


• Sixteen-bit program counter (PC) and data pointer (DPTR).
• Eight-bit program status word (PSW).
• Eight-bit stack pointer (SP).
• Internal ROM or EPROM (8751) of 0(8031) to 4K (8051).
Internal RAM of 128 bytes.
1. Four register banks, each containing eight registers.
2. Sixteen bytes, which may be addressed at the bit level.
3. Eight bytes of general-purpose data memory.
10
• Thirty two I/O pins arranged as four-bit ports P0 – P3.
• Two 16-bit Timer/Counters T0 and T1.
• Full duplex serial data receiver/transmitter (SBUF).
• Control registers TCON, TMOD, SCON, PCON, IP and IE.
• Two external and three internal interrupt sources. Oscillator and clock circuits.

CHAPTER- 5
11
PIN DESCRIPTION OF 8051 MCU

• VCC -- Supply voltage.

• GND -- Ground.

• Port 0 -- Port 0 is an 8-bit open drain bi-directional I/O port. As an output port
each pin can sink eight TTL inputs. When 1’s are written to port 0 pins, the pins
can be used as high impedance inputs. Port0 may also be configured to be the
multiplexed low order Address / data bus during
accesses to external program and data memory. In this mode P0 has
internal pull ups. Port 0 also receives the code bytes during ROM
programming, and outputs the code bytes during program verification.
12
External pull-ups are required during program verification.
• Port 1 -- Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The
Port1 output buffers can sink/source four TTL inputs. When 1s are written to
Port1 pins they are pulled high by the internal pull-ups and can be used as inputs.
As inputs, Port 1 pins that are externally being pulled low will source current (IIL)
because of the internal pull-ups. Port 1 also receives the low-order address bytes
during ROM programming and verification.
• Port 2--Port 2 occupies a total of 8 pins (pins 21 to 28). It can be used as input or
output. Just like P1, port 2 does not need any pull-up resistors since it has pull-up
resistors internally. Upon reset port 2 is configured as output port. To make port 2
input, it must be programmed as such by writing 1s to it.
• Port 3 -- Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port3
output buffers can sink/source four TTL inputs. When 1s are written to Port3 pins
they are pulled high by the internal pull-ups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source current (IIL) because
of the pull-ups. Port 3 also receives some control signals for ROM programming
and verification.

Some of the alternate functions of P3 are listed below:


P3.0 RXD (Serial input)
P3.1 TXD (Serial output)
P3.2 INT0 (External interrupt 0)
P3.3 INT1 (External interrupt 1)
P3.4 T0 (Timer 0 external input)
P3.5 T1 (Timer 1 external input)
P3.6 WR (External memory write strobe)
P3.7 RD (External memory read strobe)
• RST -- Reset input. A high on this pin for two machine cycles while the
oscillator is running resets the device.
• ALE/PROG -- Address Latch Enable output pulse for latching the low
byte of the address during accesses to external memory. This pin is
also the program pulse input (PROG) during ROM programming. In
normal operation ALE is emitted at a constant rate of 1/6 the oscillator

13
frequency, and may be used for external timing or clocking purposes.
Note, however, that one ALE pulse is skipped during each access to
external Data Memory. If desired, ALE operation can be disabled by
setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE - disable bit has no effect if the
microcontroller is in external execution mode.
• PSEN -- Program Store Enable is the read strobe to external program
memory. When the 8051 is executing code from external program
memory, PSEN is activated twice each machine cycle, except that
two PSEN activation’s are skipped during each access to external
data memory.
• EA/VPP-- External Access Enable. EA must be strapped to GND in
order to enable the device to fetch code from ext program
memory starting at 0000H up to FFFFH.EA should be strapped to VCC for
internal program executions. This pin also receives the 12-volt programming e
enable voltage (VPP) during Flash programming, for parts that require12-volt.
• XTAL1—Input to the inverting oscillator amplifier and input to the
internal clock operating circuit.
• XTAL2-- Output from the inverting oscillator amplifier.
C2
XTAL2
C1
XTAL1

GND

CHAPTER- 6
MEMORY ORGANISATION
There are two types of memory in microprocessor devices.

14
• Program Memory
• Data Memory
Each memory type has different addressing mechanism, different control signals and different
function. The Program Memory (ROM or EPROM) is extremely large, read only and non-
volatile. This has a 16-bit address bus, whose elements are accessed by program counter or
instructions that generates 16-bit address. The Data Memory is a read/write memory space,
which is smaller and hence quicker than program memory. It goes into random state when the
electric power is applied. On chip data RAM is used for variables, which are determined or
may change while program is running.
1. Internal ROM
The 89C51 has a 4K bytes of on-chip ROM. This 4K bytes ROM memory has
memory addresses of 0000 to 0FFFh. Program addresses higher than 0FFFh,
which exceed the internal ROM capacity will cause the microcontroller to
automatically fetch code bytes from external memory. Code bytes can also be
fetched exclusively from an external memory, addresses 0000h to FFFFh, by
connecting the external access pin to ground. The program counter doesn’t care
where the code is: the circuit designer decides whether the code is found totally
in internal ROM, totally in external ROM or in a combination of internal and
external ROM.
2. Internal RAM
The 1289 bytes of RAM inside the 8051 are assigned addresses 00 to 7Fh.
These 128 bytes can be divided into three different groups as follows:
1. A total of 32 bytes from locations 00 to 1Fh are set aside for register banks and
the stack.
2. A total of 16 bytes from locations 20h to 2Fh are set aside for bit addressable
read/write memory and instructions.
3. A total of 80 bytes from locations 30h to 7Fh are used for read and write storage,
or what is normally called a scratch pad. These 80 locations of RAM are widely
used for the purpose of storing data and parameters by 8051 programmers.

15
CHAPTER- 7
KEIL SOFTWARE

Keil software is used for the software implementation of the developed system. PVision2
Integrated Development Environment is an IDE that encapsulates a project manager, make
facility, tool configuration, editor and a powerful debugger. PVision2 is used to write and
16
compile the programs using the tools. It can transfer the assembly language as well as, C code
into the hex file. Keil software consists of a Linker Control File, Map File, Project Target,
Source File Group, Toolset. Linker Control File.
i) Linker control file
It is a text file that PVision passes to the linker when linking. The control file includes all
directives and names of object files and library files to include in the output file.
ii) Map File
The Map File is a listing file generated by the linker.
iii) Project Target:
In a project, a target is an executable program that is generated. A project may generate a
target that runs on an 8051. Targets may be created for builds with no optimization and for
builds with full optimization.
iv) Source File Group:
In a project, a group is a number of source files that compose the project target. Although you
may individually specify the toolset options for a file, a group lets you apply the same options
to a group of source files. The options for a group may be different from the options for the
target.

v) Toolset:
A toolset include an assembler, compiler, linker, HEX converter, debugger, and the other
associated tools for a particular device family like the 8051. All of the tools or programs in a
toolset are dedicated to generating target code for a specific family of chips [27]. To evaluate
the software for correct operation the file was programmed into the microcontroller on the
relevant development board. Programming of the microcontroller was achieved using the
VPL-SPROG programmer. It is a handy serial programmer. This permits hexadecimal files to
be loaded into the microcontroller. Initially the microcontroller was programmed by
removing it from the socket on the board and inserting it into the multi-pin socket on the
programmer.
Section 4.2 describes the programming model and instruction set and section 4.3 describes
the algorithm.

17
CHAPTER- 8
POWER SUPPLY

TRANSFORMER BRIDGE SHUNT VOLTAGE


RECTIFIER CAPACITOR REGULATOR

TRANSFOR

The power supply circuit comprises of four basic parts:


18
The transformer steps down the 220 V a/c. into 12 V a/c. The transformer work on the
principle of magnetic induction, where two coils: primary and secondary are wound around
an iron core. The two coils are physically insulated from each other in such a way that
passing an a/c. current through the primary coil creates a changing voltage in the primary coil
and a changing magnetic field in the core. This in turn induces a varying a/c. voltage in the
secondary coil.

The a/c. voltage is then fed to the bridge rectifier. The rectifier circuit is used in most
electronic power supplies is the single-phase bridge rectifier with capacitor filtering, usually
followed by a linear voltage regulator. A rectifier circuit is necessary to convert a signal
having zero average value into a non-zero average value. A rectifier transforms alternating
current into direct current by limiting or regulating the direction of flow of current. The
output resulting from a rectifier is a pulsating D.C. voltage. This voltage is not appropriate for
the components that are going to work through it.

7812
1N4007
12-0-12 V
7805
1000uF 5

TRANSFORMER

The ripple of the D.C. voltage is smoothened using a filter capacitor of 1000 microF 25V.
The filter capacitor stores electrical charge. If it is large enough the capacitor will store
charge as the voltage rises and give up the charge as the voltage falls. This has the effect of
19
smoothing out the waveform and provides steadier voltage output. A filter capacitor is
connected at the rectifier output and the d.c voltage is obtained across the capacitor. When
this capacitor is used in this project, it should be twice the supply voltage. When the filter is
used, the RC charge time of the filter capacitor must be short and the RC discharge time must
be long to eliminate ripple action. In other words the capacitor must charge up fast,
preferably with no discharge.

When the rectifier output voltage is increasing, the capacitor charges to the peak voltage Vm.
Just past the positive peak, the rectifier output voltage starts to fall but at this point the
capacitor has +Vm voltage across it. Since the source voltage becomes slightly less than Vm,
the capacitor will try to send current back through the diode of rectifier. This reverse biases
the diode. The diode disconnects or separates
the source the source form load. The capacitor starts to discharge through load. This prevents
the load voltage from falling to zero. The capacitor continues to discharge until source
voltage becomes more than capacitor voltage. The diode again starts conducting and the
capacitor is again charged to peak value Vm. When capacitor is charging the rectifier
supplies the charging through capacitor branch as well as load current, the capacitor sends
currents through the load. The rate at which capacitor discharge depends upon time constant
RC. The longer the time constant, the steadier is the output voltage. An increase in load
current i.e. decrease in resistance makes time constant of discharge path smaller. The ripple
increase and d.c output voltage V dc decreases. Maximum capacity cannot exceed a certain
limit because the larger the capacitance the greater is the current required to charge the
capacitor.

The voltage regulator regulates the supply if the supply if the line voltage increases or
decreases. The series 78xx regulators provide fixed regulated voltages from 5 to 24 volts. An
unregulated input voltage is applied at the IC Input pin i.e. pin 1 which is filtered by
capacitor. The out terminal of the IC i.e. pin 3 provides a regular output. The third terminal is
connected to ground. While the input voltage may vary over some permissible voltage range,
and the output voltage remains constant within specified voltage variation limit. The 78xx
IC’s are positive voltage regulators whereas 79xx IC’s are negative voltage regulators.

These voltage regulators are integrated circuits designed as fixed voltage regulators for a
wide variety of applications. These regulators employ current limiting, thermal shutdown and
20
safe area compensation. With adequate heat sinking they can deliver output currents in excess
of 1 A. These regulators have internal thermal overload protection. It uses output transistor
safe area compensation and the output voltage offered is in 2% and 4% tolerance.
REGULATOR

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.

Working Of Power Supply

 Transformer

Transformer Output

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.

21
Transformer + Rectifier

Rectifier Stage Output

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.

Transformer + Rectifier + Smoothing

Filtered Output

The smooth DC output has a small ripple. It is suitable for most


electronic circuits.

22
CHAPTER- 9
INTERFACING OF MCU
9.1 LED
A light-emitting diode (LED) is a semiconductor diode that emits incoherent narrow
spectrum light when electrically biased in the forward direction of the p-n junction. This
effect is a form of electroluminescence. An LED is usually a small area source, often with
extra optics added to the chip that shapes its radiation pattern. The color of the emitted light
depends on the composition and condition of the semiconducting material used, and can be
infrared, visible, or near-ultraviolet. An LED can be used as a regular household light source.

23
V C C
D 1

L E D

D 2

L E D U ?
4 0
D 3 3 9 2 1
3 8 P 0 . 0 / A D P0 2 . 0 /2 A 2 8
3 7 P 0 . 1 / A D P1 2 . 1 /2 A 3 9
3 6 P 0 . 2 / A D P 2 2 . 2 / A2 41 0
L E D
3 5 P 0 . 3 / A D P 3 2 . 3 / A2 51 1
3 4 P 0 . 4 / A D P 4 2 . 4 / A2 61 2
3 3 P 0 . 5 / A D P 5 2 . 5 / A2 71 3
D 4
3 2 P 0 . 6 / A D P 6 2 . 6 / A2 81 4
P 0 . 7 / A D P 7 2 . 7 / A 1 5
L E D 1 1 0
2 P 1 . 0 / T 2 P 3 . 0 / R 1 1X D
3 P 1 . 1 / T 2 P- E 3 X . 1 / T1 X2 D
4 P 1 . 2 P 3 . 2 / I 1N 3 T O
D 5
5 P 1 . 3 P 3 . 3 / I 1N 4 T 1
6 P 1 . 4 P 3 . 4 / 1T 5O
7 P 1 . 5 P 3 . 5 /1 T 6 1
L E D
8 P 1 . 6 P 3 . 6 / W1 7 R
P 1 . 7 P 3 . 7 / R D
D 6 1 9 2 9
Y ? 1 8 X T A L 1 P S E N
9 X T A L 2 3 0
R S T A L E / P R O G
L E D
C R Y S T A L 3 1
E A / V P P
D 7 C ?
C A P N P A T 8 9 C 5 2
2 0
L E D
R 1
R
D 8

L E D

9.1.1 OPERATION
The operation of light-emitting diode (LED) is based on the phenomenon of electro-
luminance, which is the emission of light from a semiconductor under the influence of an
electrical field. The recombination of charge carriers take place in a forward P-N junction
as the electrons cross from the N-region and recombine with holes exiting in the P-region.
Typically, these electrons give up energy in the form of heat and light.

9.1.2 USE
A LED can be used as an indicator in ac circuit. The LEDs in a seven segment display may
be connected in common anode or in common-cathode configuration, as illustrated.

a
b C O M M O N A N O D E
c
d
e
f
g

24
Common Anode

a
b
c
d
e
f
C O M M O N g
C A T H O D E

Common Cathode

9.1.3 DRAWBACK
The drawback of LEDs is that over-voltage may damage them.

9.2 SEVEN SEGMENT DISPLAY


The diagram below illustrates an arrangement showing how a seven segment display can be
interfaced along with switch inputs.

25
Note the RA0 and RA1 port bits are connected to both the A1, A0 Switches, the transistor
drivers to select the display digits.

26
To drive the display, the RA0 and RA1 bits are configured as outputs.To input from the two
switches, the RA0 and RA1 bits are configured as inputs. The two 10K resistors prevent
damage to the port when configured as outputs and a switch
is closed.

9.3 LCD
LCD Display
Liquid crystal displays (LCD) are widely used in recent years as compares to LEDs. This is
due to the declining prices of LCD, the ability to display numbers, characters and graphics,
incorporation of a refreshing controller into the LCD, their by relieving the CPU of the task
of refreshing the LCD and also the ease of programming for characters and graphics. HD
44780 based LCDs are most commonly used.

LCD pin description

The LCD discuss in this section has the most common connector used for the Hitatchi 44780
based LCD is 14 pins in a row and modes of operation and how to program and interface with
microcontroller is describes in this section.

27
1 6
1 6 G n d
1 5
1 5 V c c
1 4
1 4 D 7
1 3
1 3 D 6
1 2
1 2 D 5
1 1
1 1 D 4
1 0
1 0 D 3
9
9 D 2
8
8 D 1
7
7 D 0
6 E
3
6
5
5 R / W
4
4 R S
3
3 C o n t r 2a s t
2
2 V c c
1
1 G n d
1

LCD PIN DESCRIPTION DIAGRAM

28
VCC, VSS, VEE

The voltage VCC and VSS provided by +5V and ground respectively while VEE is used for
controlling LCD contrast. Variable voltage between Ground and Vcc is used to specify the
contrast (or "darkness") of the characters on the LCD screen.

RS (register select)

There are two important registers inside the LCD. The RS pin is used for their selection as
follows. If RS=0, the instruction command code register is selected, then allowing to user to
send a command such as clear display, cursor at home etc.. If RS=1, the data register is
selected, allowing the user to send data to be displayed on the LCD.

R/W (read/write)

The R/W (read/write) input allowing the user to write information from it. R/W=1, when it
read and R/W=0, when it writing.

EN (enable)

The enable pin is used by the LCD to latch information presented to its data pins. When data
is supplied to data pins, a high power, a high-to-low pulse must be applied to this pin in order
to for the LCD to latch in the data presented at the data pins.

D0-D7 (data lines)

The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of
the LCD’s internal registers. To displays the letters and numbers, we send ASCII codes for
the letters A-Z, a-z, and numbers 0-9 to these pins while making RS =1. There are also
command codes that can be sent to clear the display or force the cursor to the home position
or blink the cursor .We also use RS =0 to check the busy flag bit to see if the LCD is ready to
receive the information. The busy flag is D7 and can be read when R/W =1 and RS =0, as
follows: if R/W =1 and RS =0, when D7 =1(busy flag =1), the LCD is busy taking care of
internal operations and will not accept any information. When D7 =0, the LCD is ready to
receive new information.

29
INTERFACING

In most applications, the "R/W" line is grounded. This simplifies the application
because when data is read back, the microcontroller I/O pins have to be alternated between
input and output modes. In this case, "R/W" to ground and just wait the maximum amount of
time for each instruction (4.1 msecs for clearing the display or moving the cursor/display to
the "home position", 160 usecs for all other commands) and also the application software is
simpler, it also frees up a microcontroller pin for other uses. Different LCD execute
instructions at different rates and to avoid problems later on (such as if the LCD is changed to
a slower unit). Before sending commands or data to the LCD module, the Module must be
initialized. Once the initialization is complete, the LCD can be written to with data or
instructions as required. Each character to display is written like the control bytes, except that
the "RS" line is set. During initialization, by setting the "S/C" bit during the "Move
Cursor/Shift Display" command, after each character is sent to the LCD, the cursor built into
the LCD will increment to the next position (either right or left). Normally,
the "S/C" bit is set (equal to "1")

30
9.4 ISOLATOR CARD
Whenever there is a need of connecting some high load device(i.e. working on high values of
voltages and current, like D.C motor) with the microcontroller, we can’t connect it directly,
because it may the harm the sensitive controller through back currents. So, for those
applications, we need to form some kind of isolation between the two devices and for that
purpose we have an isolator card. An isolator card consists of an Optocoupler, shown below.

Optocoupler

OPTOCOUPLER
It consists of a IR led and a photo transistor as shown. The I.R Led would emit infra red light
whenever it is forward biased. The photo transistor is a a npn type and it works only whe a
light of certain frequency falls on it. The property that, an IR Led can make a photo transistor
work but a photo transistor can’t make an IR Led work, is used to form isolation.

DESCRIPTION

The general purpose optocouplers consist of a gallium arsenide infrared emitting diode
driving a silicon phototransistor in a 6-pin dual in-line package.

31
FEATURES

• Also available in white package by specifying -M suffix, eg. 4N25-M

• UL recognized (File # E90700)

• VDE recognized (File # 94766)

- Add option V for white package (e.g., 4N25V-M)

- Add option 300 for black package (e.g., 4N25.300)

APPLICATIONS

• Power supply regulators

• Digital logic inputs

• Microprocessor inputs

WORKING OF ISOLATOR CARD

OPTOCOUPLE
R

40(VCC) 1 6

MICRO

CONTROLLER 2
P2.2 5

470ohm
3 4

12V

20(Gnd)

The P end of the infra red led has been connected to the VCC. But for the Led to glow it
needs to have a ground at the N terminal. The N terminal is connected to any pin of the ports

32
of the micro controller. Whenever A ‘0’ is transmitted by the M.C.U, the Led will glow and
the output of the opto-coupler ckt. would become zero. This zero is transmitted to the pnp
transistor attached in series through a resistor and the 12 V voltage would reach the collector
terminal of the transistor, from where it can be picked and used to operate any high load
device.

9.5 RELAY

The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an
electromagnet. When the coil is energised, by passing current through it, the core becomes
temporarily magnetised. The magnetised core attracts the iron armature. The armature is
pivoted which causes it to operate one or more sets of contacts. When the coil is de-energised
the armature and contacts are released. The coil can be energised from a low power source
such as a transistor while the contacts can switch high powers such as the mains supply. The
relay can also be situated remotely from the control source. Relays can generate a very high
voltage across the coil when switched off. This can damage other components in the circuit.
To prevent this a diode is connected across the coil.

33
As there are always some chances of high voltage spikes back from the switching circuit i.e.
heater so an optocoupler/isolator MCT2e is used. It provides and electrical isolation between
the microcontroller and the heater. MCT2e is a 6-pin IC with a combination of optical
transmitter LED and an optical receiver as phototransistor. Microcontroller is connected to
pin no 2 of MCT2e through a 470-ohm resistor. Pin no.1 is given +5V supply and pin no.4 is
grounded.

To handle the current drawn by the heater a power transistor BC-369 is used as a current
driver. Pin no.5 of optocoupler is connected to the base of transistor. It takes all it’s output to
Vcc and activates the heater through relay circuit. The electromagnetic relay consists of a
multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energized,
by passing current through it, the core becomes temporarily magnetized. The magnetized core
attracts the iron armature. The armature is pivoted which causes it to operate one or more sets
of contacts. When the coil is de-energised the armature and contacts are released. Relays can
generate a very high voltage across the coil when switched off. This can damage other
components in the circuit. To prevent this a diode is connected across the coil. Relay has five
points. Out of the 2 operating points one is permanently connected to the ground and the
other point is connected to the collector side of the power transistor. When Vcc reaches the
collector side i.e. signal is given to the operating points the coil gets magnetized and attracts
the iron armature. The iron plate moves from normally connected (NC) position to normally
open (NO) position. Thus the heater gets the phase signal and is ON. To remove the base
leakage voltage when no signal is present a 470-ohm resistance is used.

J4
p ha se
5 NC 1
3 2
D11 4
1 NO HEA TER
2
1 6
5 R4 RELA Y
V CC V CC
2 4 BC-3 69
R2 MCT2E

From P3.0 of
microcontroller

CHAPTER- 10
34
APPLICATIONS
OF MICROCONTROLLER

10.1) TELECOM

Mobile phone systems(handsets and base stations), Modems, routers. All of this find employ
the application of microcontrollers.

10.2) AUTOMATIVE APPLICATIONS

Braking systems, Traction control, Airbag release systems, Engine-management units, Steer-
by-wire systems, Cruise control applications.

10.3) DOMESTIC APPLIANCES

Dishwashers, Televisions, Washing Machines, Microwave ovens, Video Recorders, Security


Systems, Garage door controllers, Calculators, Digital Watches, VCRs, Digital Cameras,
Remote controls.

10.4) ROBOTIC

Fire Fighting robot, Automatic Floor Cleaner, Robotic Arm.

10.5) AEROSPACE APPLICATIONS

Flight control systems, Engine controllers, Autopilots, Passenger in-flight entertainment


systems.

35
10.6) MEDICAL EQUIPMENTS

An Anaesthesia monitoring system, ECG monitors, Pacemakers, Drug Delievery systems,


MRI scanners.

10.7) DEFENCE SYSTEMS

Radar systems, Fighter aircraft flight control systems, Missile guidance systems.

10.8) INTERFACING PURPOSE

It finds various applications interfacing the computer with real world entities like LEDs, Seven
Segments display, LCD, Buzzer, Relays, Stepper motor, DC motor.

36
CHAPTER-11
PROJECT- POWER SAVER WITH
SWITCHES

This project is basically a very great application of the micro controller in daily life. In
our daily life we normally forget or don’t care to switch off the electrical devices used at
our homes i.e. fans, tubes, bulbs etc. Every device has a particular power ratings
according to which it consumes electricity now the working of these devices without any
use will lead to wastage of power and ultimately to the electricity bills.

This project can be used to avoid this problem. In this project every room will be
monitored by a single microcontroller and the microcontroller will keep the record of the
number of persons in every room and when it finds the no of persons in a room to be
zero then it automatically cut the power line for that room. We can also use a LCD,
which will display the status of every room.

The project can be subdivided into three main parts. First is the one which will detect the
entry or exit of a person in the room this module will be applied at the door of each
room.

The second part, which will further differentiate between entry and exit and then
accordingly increase or decrease the count of each room and display the count of each
room on the timesharing bases on the LCD screen, will be installed at a single central
room.

Third and the last module will be used to control the power line of each room which will
work jointly with the second module to control the switching of power of each room.

37
11.1 BLOCK DIAGRAM

POWER SUPPLY

ENTRY
SWITCH POWER
OPTO TRANSISTOR
MCU ISOLATOR
UNIT
EXIT SWITCH

RELAY AND
SOCKET

38
11.2 CIRCUIT DIAGRAM

L M 7 8 0 5

1 2
V I N V O U T
I N 4 I 0N 0 4 7 0 0 7
4 7 0 K J 81
V C C
GND

1 T 2
15
3
1 0 0 0 U F 4
V C C U 1 V C C
5
3

4 0
220V AC

4 8 6 1 V C C
7 2 P 1 . 0 3 9
I N 4 I 0N 0 4 7 0 0 7 8 3 P 1 . 1 P 0 3 . 80 U 4

2
CS 3W 1 9 4 P 1 . 2 P 0 3 . 71 1 6
L E D 1 0 5 P 1 . 3 P 0 3 . 62 4 7 0 O H M
1 1 6 P 1 . 4 P 0 3 . 53 5
1 2 7 P 1 . 5 P 0 3 . 44
1 3 P 1 . 6 P 0 3 . 35

1
8 4

2
1 4 9 P 1 . 7 P 0 3 . 26 2
1 5 1 0R E S E TP 0 3 . 17 1 3
1 6 V C C
1 1R X D E A 3/ V0 P 4 N 3 5
Q 4
2T X D A L E / P

12V DC
R 1 1
I3 N T 0
L C D
1 2 9
1 4I N T 1 P S E N
1 5T 0
1 6T 1 2 8

2
1
3
1 W7 R 8 0 5 P1 2 2 . 77 R E
C 1 R D P 2 2 . 66
1 8 P 2 2 . 55
X 2 P 2 2 . 44 E N T R Y S W I T C H
P 2 . 33

4
5
Y 1 1 9 2 1 2
C 2 X 1 P 2 2 . 22
2 0 P 2 2 . 11 1 2
V S S P 2 . 0 E X I T S W I T C H

S O C K

The project “Microcontroller based Embedded Object Monitoring & Power-Saving System ”
is easy to implement in normal household and industrial applications. From the project it is
concluded that microcontrollers has their unlimited applications in all spheres of technology.
Here we have developed a system which is capable of counting the objects/persons in a room
and at the same time it is also controlling the power consumption according to the person
density. The same project can be used in the industries to count the packed objects on a
conveyer belt and in such same applications like car parking systems and auto bottling
systems. More over the system is intelligent enough to take decision on its own and is very
much economics as the components used are readily available and very inexpensive.
Finally it is observed that aesthetically and ergonomically designed product is versatile and
user friendly for monitoring objects and saving power consumption.

39
CHAPTER- 12
CONCLUSION
The training at the EEAST gave a though knowledge about microcontrollers. This training
increased my knowledge in how microcontrollers are useful as well in the real world.

I am sure that this training would help me a lot in future.

40
BIBLIOGRAPHY
WEBSITES:
1. www.procontechnology.com.amu

2. www.atmel.com

3. www.8051.com

BOOKS:
1. Second edition; Ayala Kenneth.J. ; 8051 Microcontroller: Architecture, Programming
and Application

2. Second edition; Mazidi Muhammad Ali, Mazidi Janice Gillispie, McKinley Rolin D,
The 8051 Microcontroller and Embedded systems

41

S-ar putea să vă placă și