Unit 4
Unit 4
Microcontroller
Unit-4
• Microprocessor is an IC which has only the CPU
inside them i.e. only the processing powers such
as Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc.
• These microprocessors don’t have RAM, ROM, and
other peripheral on the chip. A system designer
has to add them externally to make them
functional.
• Application of microprocessor includes Desktop
PC’s, Laptops, notepads etc.
• But this is not the case with Microcontrollers.
Microcontroller has a CPU, in addition with a fixed
amount of RAM, ROM and other peripherals all
embedded on a single chip. At times it is also termed
as a mini computer or a computer on a single chip.
• Today different manufacturers produce
microcontrollers with a wide range of features
available in different versions. Some manufacturers
are ATMEL, Microchip, TI, Freescale, Philips,
Motorola etc.
Microprocessor is heart of Computer system. Micro Controller is a heart of embedded system.
It is just a processor. Memory and I/O components have to Micro controller has external processor along with internal
be connected externally memory and i/O components
Since memory and I/O has to be connected externally, the Since memory and I/O are present internally, the circuit is
circuit becomes large. small.
Can be used in compact systems and hence it is an efficient
Cannot be used in compact systems and hence inefficient
technique
Cost of the entire system increases Cost of the entire system is low
Due to external components, the entire power consumption Since external components are low, total power
is high. Hence it is not suitable to used with devices running consumption is less and can be used with devices running on
on stored power like batteries. stored power like batteries.
Microprocessor have less number of registers, hence more Micro controller have more number of registers, hence the
operations are memory based. programs are easier to write.
Mainly used in personal computers Used mainly in washing machine, MP3 players
Programmable Logic Controllers
Introduction
Controllers
The programmable logic controller
• A programmable logic controller (PLC) is a special
form of microprocessor- based controller that
uses a programmable memory to store
instructions and to implement functions such as:
– logic,
– sequencing,
– timing,
– counting and
– arithmetic
• The term logic is used because programming is
primarily concerned with implementing logic and
switching operations;
– if A or B occurs switch on C, if A and B occurs switch on
D. Input devices, e.g. sensors such as switches, and
output devices in the system being controlled, e.g.
motors, valves, etc., are connected to the PLC.
• The operator then enters a sequence of
instructions, i.e. a program, into the memory of the
PLC.
• The controller then monitors the inputs and outputs
according to this program and carries out the control rules
for which it has been programmed.
A programmable logic controller
• PLCs are similar to computers but whereas
computers are optimised for calculation and display
tasks, PLCs are optimised for control tasks and the
industrial environment. Thus;
– Rugged and designed to withstand vibrations,
temperature, humidity and noise.
– Have interfacing for inputs and outputs already inside
the controller.
– Are easily programmed and have an easily understood
programming language which is primarily concerned
with logic and switching operations.
Typical PLC system
• has the basic functional components of processor
unit, memory, power supply unit, input/output
interface section, communications interface and the
programming device.
Internal architecture
1. The processor unit or central processing unit
(CPU)
is the unit containing the microprocessor and this
interprets the input signals and carries out the control
actions, according to the program stored in its memory,
communicating the decisions as action signals to the
outputs.
2. The power supply unit :
is needed to convert the mains a.c. voltage to the
low d.c. voltage (5 V) necessary for the processor
and the circuits in the input and output interface
modules.
3. The programming device
• is used to enter the required program into the
memory of the processor. The program is developed
in the device and then transferred to the memory
unit of the PLC.
4. The memory unit :
is where the program is stored that is to be used for
the control actions to be exercised by the
microprocessor and data stored from the input for
processing and for the output for outputting.
5. The input and output sections:
• are where the processor receives information
from external devices and communicates
information to external devices. The inputs
might thus be from switches, sensors such as
photo-electric cells, temperature sensors, or
flow sensors, etc.
• The outputs might be to motor starter coils,
solenoid valves, etc.
PLC input output module
• It Includes:
Modular plug-in periphery
AC voltage input and output,
DC voltage input and output,
Low level analog input,
High level analog input and output,
Special purpose modules, e.g.., high speed
timers,
Stepping motor controllers, etc. PID, Motion
6. The communications interface
– is used to receive and transmit data on
communication networks from or to other remote
PLCs.
– It is concerned with such actions as device
verification, data acquisition, synchronisation
between user applications and connection
management.
LADDER DIAGRAM
Fundamentals
Basic Components and Their Symbols
• Control Transformers
• Fuses
Switches
Switch Actuators
Limit Switches
• Indicator Lamps
Relays
Time Delay Relays
Delay-Off Timer (TOF) Relay
Fundamentals of Ladder Diagrams
• Basic Diagram Framework
Reference Designators
• With such a diagram the power supply for the
circuits is always shown as two vertical lines
with the rest of the circuit as horizontal lines.
• The power lines, or rails as they are often
termed, are like the vertical sides of a ladder
with the horizontal circuit lines like the rungs of
the ladder.
• Circuit diagrams often show the relative physical
location of the circuit components and how they
are actually wired.
certain conventions
• The vertical lines of the diagram represent the power rails
between which circuits are connected. The power flow is
taken to be from the left-hand vertical across a rung.
• Each rung on the ladder defines one operation in the
control process.
• A ladder diagram is read from left to right and from top
to bottom
• This procedure of going through all the rungs of the
program is termed a cycle.
• The end rung might be indicated by a
• block with the word END or RET for return, since the
program promptly returns to its beginning.
Scanning the ladder program
• Each rung must start with an input or inputs and
must end with at least one output.
– The term input is used for a control action, such as
closing the contacts of a switch, used as an input to the
PLC. The term output is used for a device connected to
the output of a PLC, e.g. a motor
• Electrical devices are shown in their normal
condition.
– Thus a switch which is normally open until some object
closes it, is shown as open on the ladder diagram. A
switch that is normally closed is shown closed.
Basic symbols
Update-Solve Ladder-Update
• Update:
– The first thing the PLC does when it begins to function is
update I/O.
– This means that all discrete input states are recorded from
the input unit and all discrete states to be output are
transferred to the output unit.
– PLC has I/O registers for I/P data with specific addresses
associated with it
– These I/O registers updates I/O discrete data
– This I/O updating is accomplished with Image registers.
– Each discrete input point has associated with it one bit of an
input image register. Likewise, each discrete output point has
one bit of an output image register associated with it.
• When I/O updating occurs, each input point that is
ON at that time will cause a 1 to be set at the bit
address associated with that particular input. If the
input is off, a 0 will be set into the bit address.
• At I/O update, the status of the input image register
is set according to the state of all discrete inputs
and the status of the output image register is
transferred to the output unit.
• This transfer of information typically only occurs at
I/O update.
• It may be forced to occur at other times in PLC's
which have an Immediate I/O Update command.
Solve the Ladder
• After the I/O update has been accomplished, the
PLC begins executing the commands programmed
into it.
• The contact configuration on the left side of each
rung can be visualized as switches and the coils on
the right as lights.
• If the switches are turned on and off in the proper
configuration, the light to the right will illuminate.
• The PLC executes this program from left to right and
top to bottom, in that order.
• It first looks at the switch (contact) configuration to
determine if current can be passed to the light
(coil). The data for this decision comes from the
output and input image registers. If current can be
passed, the light (coil) will then be turned on. If not,
the light (coil) will be turned off.
• This is recorded in the output image register.
• Once the PLC has looked at the left side of the rung it
ignores the left side of the rung until the next time it
solves that particular rung.
• Once the light (coil) has been either turned on or off it
will remain in that state until the next time the PLC
solves that particular rung.
• After solving a rung, the PLC moves on to solve the
next rung in the same manner and so forth until the
entire ladder has been executed and solved.
• One rule that is different from general electrical
operation is the direction of current flow in the rung. In
a ladder logic, rung current can only flow from left to
right and up and down; never from right to left.
• To review, after the I/O update, the PLC moves to the
first rung of ladder logic. It solves the contact
configuration to determine if the coil is to be
energized or de-energized.
• It then energizes or de-energizes the coil. After this
is accomplished, it moves to the left side of the next
rung and repeats the procedure. This continues until
all rungs have been solved.
• When this procedure is complete with all rungs
solved and all coils in the ladder set up according to
the solution of each rung, the PLC proceeds to the
next step of it‘s sequence, the I/O update.
• At I/O update, the states of all coils which are
designated as outputs are transferred from the
output image register to the output unit and the
states of all inputs are transferred to the input
image register.
• The state of each coil is recorded to the output
image register as each rung is solved.
• However, these states are not transferred to the
output unit until I/O update time.
Physical Components vs. Program
Components
• We will be connecting physical components
(switches, lights, relays, etc.) to the external
terminals on a PLC.
• Then when we program the PLC, any physical
components connected to the PLC will be
represented in the program as program
components.
• A programming component will not have the same
reference designator as the physical component,
but can have the same name.
Example
• A lighting control system is to be developed. The
system will be controlled by four switches, SWITCH1,
SWITCH2, SWITCH3, and SWITCH4. These switches
will control the lighting in a room based on the
following criteria:
1. Any of three of the switches SWITCH1, SWITCH2,
and SWITCH3, if turned ON can turn the lighting on,
but all three switches must be OFF before the lighting
will turn OFF.
2. The fourth switch SWITCH4 is a Master Control
Switch. If this switch is in the ON position, the lights
will be OFF and none of the other three switches have
any control.