You are on page 1of 21

UNIT – IV

PROGRAMMEBLE LOGIC CONTROLLERS

4.1 INTRODUCTION
v A PLC or a programmable logic controller, is a solid state digital industrial
computer, in which control devices such as limit switches, push buttons,
proximity or photoelectric sensors, float switches or pressure switches, etc.,
provide incoming control signal into the unit.
v This incoming control signal is called an input.
v A formal definition is given by National Electrical Manufactures Association
(NEMA):
v A PLC is a digitally operated electronic system designed for use in an
industrial environment which uses a programmable memory for the internal
storage of user oriented instructions for implementing specific functions such
as logic, sequencing, timing, counting and arithmetic to control, through
digital and analog inputs and outputs, various types of machines or processes.
v This was designed in the early 1970s to replace electromechanical relays,
mechanical timers, counters and sequencers. It is small, requires less power,
has fast switching capability, and a reliable control device.
v Just like the other controller chips explained in the previous chapter PLC
follows the instructions stored in PLC’ s memory.
v The processor or CPU reads the input signals, initiates the processes by
prompting the PLC. PLC in turn carries out the operations on the inputs and
converts them into the proper control operations or switching operations on
the system.

Advantages
1. This is a hardened industrial computer designed to withstand the harsh factory
environment.
2. The troubleshooting is easy so also the installation.
3. They are compact and are reusable.

4.2 BASIC STRUCTURE


The block diagram of a PLC is given in Fig.4. I. The six major sections of a PLC are
1. Sensing inputs or controlling hardware.
2. Input section.
3. CPU
4. Handheld programming device or personal computer.
5. Output section.
6. Output devices

1
Fig. 4.1. Programmable logic controller block diagrani

1. Sensing section: These are usually made up of sensors and switches which transmit
the signals from the input devices.
2. Input section: This contains two major areas — the physical terminals where the
input signals from the input devices are attached to the PLC and the internal
conversion electronics. This internal conversion electronics converts and isolates the
high voltage inpul level from field devices, into +5 V dc which is necessary for th
microprocessor and the other solid state circuitry.
3. Controller: This is the processor which processes the signals from input section and
generates controlling signals for the system.
4. Programmer: This is usually a PC which is used to enter the program to the PLC.
5. Output section: This receives the signals from the PLC which are used to control
the system to which the PLC is connected.
6. Field hardware devices: This is the system which is controlled by the PLC. As
mentioned before, it may be a motor which controls the movement of a conveyor or a
lift, it may be metal cutting machine whose outputs are to be precision made, etc.

4.3 PLC HARDWARE


These are two different types of physical configurations in PLC.
1. Fixed Input / Output
2. Modular Input / Output
1. Fixed I/O PLCs: This contains a fixed or a built-in I/O section. The section is built
inside the PLC and cannot be changed.
2. Modular I/O PLCs: This contains I/O ports as in a microprocessor to which
removable I/O units or modules can be connected as desired. Here the user can select
separate modules for I/O or mix them according to use. Typical modules will contain
4, 8, 12, 16 or 32 1/0 points. The printed circuit board which acts as I/O port is built
into the chassis and is called backplane. Some PLCs have a simple rail called DIN rail
to which the modules simply clip together. The advantage of this type is that it
permits the easy addition and removal of modules.

2
3
Modular PLC installation on a DIN rail is explained below.
v The power supply which is connected to the line voltage is installed either on
the right side, or left side or in any position in the modular rack or chassis.
v Some PLCs allow the power supply to be installed as either in the chassis or as
a standalone device outside the chassis.
v CPU takes up the next position to the power supply. The remaining slots are
taken up by the I/O modules.

4.4 I/O SIGNALS


v A standard input modules has 16 input points. So a 16 bit input is given as
signal. To indicate the 16 inputs 16 LEDs serve as indicators.
v Eight point input modules are also available.
v In these, only the lower 8 bits are used. Fig,4.5 shows the correlation of input
signals into control signals in 8, 1 6 bit I/O modules.

4
Fig. 4.5, (b) Input conditions reflected in the input module (8 bit)

v A 24 bit I/O module is represented with 2 words of 16 bit.


v The first word gets all the 16 bit signals while the second word gets only the
lower 8 Bits and higher order 8 bits are ignored. For a 32 bit I/O module, all
the 16 bits of both words are used.
v In a modular PLC, let us assume 4 I/O modules are fixed. So there will be 4
input words corresponding to them.
v These input words at different instants are grouped together to form the data
file stored in the memory as shown in Table 4.1.

5
v Here the word 0 indicates the input status of input module 0, word I
corresponds to input module 1 and so on.
v This data file representing a data word for each input module in the system is
called the input status file.
v This data is processed by the CPU when the program is executed. This is also
called I/O mapping.
v Similar to this there is an output status file which stores the ON or OFF status
of each output module.
v This output then is used to control the load connected to the output module.
This is shown in Fig.4.6.

6
1. Fig.4.7 shows how more than one module is connected in a PLC.
2. The main advantage of modular PLC is that after connecting the power
supply and CPU in the first two slots we are free to fix up any module
whether input or output in any of the slots as shown in Fig.4.7.

7
1. Power supply
2. Processor and memory
3. 1/0 interfaces (modules)
v Usually a separate programming device like a handhold unit for small PL(’ s or
a PC for larger PLCs is separately added.
v Whatever the size of the PLC, the processor or controller and memory are in
the same unit called the CPU.
v Since the memory has already been explained, let us carry on with the
microprocessor part.
v We have already seen an 8 bit microprocessor 8085 in the previous chapter.
PLCs can operate with any one of the Intel microprocessors as its heart.
v Intel has developed 8 bit, 16 bit, 32 bit microprocessors with the clock speeds
ever increasing.
v Although some high end, larger PLCs use the 80486 chip, some smaller PLCs
use 8 bit iP like 8085.

8
4.8 POWER SUPPLIES
v Typically a bridge rectifier with a filter and a regulator constitute a PLC power
supply.
v In addition a battery back up system is also provided.

v The battery back up switch is provided for emergencies where the power
supply fails. If the line input to the power supply ceases the switch switches
the output from power supply to battery back up power quickly and
automatically so that the power input to the PLC is not affected.
v
4.9 INPUT I OUTPUT PROCESSING
v PLC is capable of handling discrete as well as analog I/O sigrals.
v Discrete input module is the most common input interface used with
programmable controllers.
v Discrete input signals from field devices can be either AC or DC.
v The most common module types are listed below.

AC input modules
The block diagram of a typical AC input circuit is shown below.

9
v A 120 V AC’ input module will accept signals between 80 and 135 V AC.
v This module is considered the load for the field input device.
v The module’ s job is to convert the 1 20 V AC high voltage signal to the 5 V dc
level, with which the PL(. can work. It verifies the input as a valid signal,
isolate the high voltage field device signal from the lower voltage CPU signal
and send the appropriate ON or OFF signal to the CPU for placement in the
input status file.
v As shown in Fig.4.l0 the module consists of three parts.
1. Power file conversion,
2. Isolation and
3 Logic.
v Rectifier and filter constitutes the power conversion section.
v The DC output thus got is passed on to a threshold detector.
v This detects if the incoming signal has reached or exceeded a predetermined
value for a predetermined time and whether it should be classified as a valid
ON OFF signal.
v A typical valid OFF signal is between 0 and 20 or 30 V AC and ON signal is
between 80 and 132 V AC depending on the manufacturer.
v The optical isolation circuit is usually made up of an opto coupler which is a
combination of a photoemissive device (LED) and a photodetective device
(photodiode).
v The input signal energises the LED which transmits a signal of light energy to
the receiver i.e., photodiode.
v There is no actual electrical or physical coupling between LED and
photodiode. So this provides the necessary isolation between power
conversion circuitry and the logic circuitry.
v This is necessary because the input is 120 V AC but CPU runs from 5 to 18 V
DC and any electrical short between these two will prove fatal for the system.
v There are two types of input devices commonly interfaced to an input module.
One type includes the mechanical limit switch, toggle switch, selector switch,
push button and contacts from an electromechanical relay.
v All these mechanical contacts which require no electrical power. Circuit
continuity is made or broken by physically opening a set of contacts.

v The second type is a solid state proximity device which requires electrical
power to operate.
v A small amount of current called “leakage current” must continuously flow
through the device, even in the OFF state to keep the internal electronics
working so that the switch will be able to sense the presence of an object.
v DC input modules: Low voltage, 24 V DC inputs are commonly used for start
/ stop control circuitry and sensor interface to the PLC.
v DC sensors can drive electromechanical relays, counters and solenoids and
other solid state devices.
v A DC sensor with a proper DC input module does not need any interfacing
device. The sensors, are commonly solid state sensors like inductive proximity
sensors, capacitive proximity sensors or photoelectric sensors. Typical sensors
use IOV —3OVDC.

10
v The sensor’ s switch which controls the input into the module is made of either
NPN or PNP transistor.
v The input device with NPN transistors are called sinking input devices and
those with PNP transistors are called sourcing input devices.
Sourcing and Sinking:
v Conventional flow of current is defined from positive to negative of the
battery. So if a switch is connected to the positive of the battery it is said to be
sourcing the current and if it is connected to the negative of the battery it is
said to be sinking the current. Similarly a load may also be sinking or sourcing
the current in the same way.
v Fig.4.11 shows the different combinations.

The block diagram of a typical DC input module is shown below.

Typical PLC input and output devices with indications to show how they are indicated
in the circuit diagrams in the following topics.

11
4.10. PROGRAMMING EQUIPMENT AND OPERATIONS PROCEDURE
v To design any PLC based system, just like any other system, block diagrams
are to be drawn.
v In addition, one more diagram indicating the flow of control over the different
subsystems, the conditions to be satisfied, also has to be drawn. It is the ladder
logic diagram.
A ladder logic diagram is one where all the different inputs and outputs are shown in
their order in different branches called rungs of ladder.

12
v The first rung contains the first input and output and the second one the second
pair and so on.
v Example 4.1 I Let us take an example system to explain the actual operation /
process of I/O with PLC : A relay coil is to be activated when two toggle
switches and one limit switch are operated.
v The first step is to assign individual PLC identification numbers to the inputs
and outputs.
v Inputs are indicated by 1 N and outputs by CR (Control Relay). Therefi)re, the
following members can be assigned.
Switch I for relay IN 001
Switch 2 for relay IN 002
Limit switch for relay IN 003
Relay output CR 001
Next, sketch a ladder logic diagram to represent the operational circuit as shown in
Fig.4.15.

The next step is the actual hardware connection of input and output modules.
Assuming an eight terminal input and output, the connections are shown in Fig.4. 16.

Finally the ladder program must be entered into the CPU by means of a keyboard. For
this any one of the programming equipments may he used.
The general procedure to enter the program in ladder format is
1. Clear the PLC program memory with the CPU on stop.
2. Go into the EDIT mode and start entering the relay control line as follows.
(a) Select the input function and enter the number 001. The contact should appear on
the monitor.
(b) Moving the cursor one space to right repeat the same procedure for the 002 input
and 003 input.
(c) Select the coil / output key and enter 001.
(d) If the arrangement looks correct, select the “ladder” key and enter. The ladder
diagram for this arrangement will appear on the monitor as below.

13
Though the procedure explained above is a general procedure, most of the
programming equipments are the same to operate.
Three types of programming monitors or PMs are in use.
1. Hand held, palm size units with dual function keypads and a Liquid Crystal Display
(LCD) or Light Emitting Diode (LED) window.
2. Full size keyboards accompanied by a large LCD display or Cathode Ray Tube
(CRT) screen.
3. PCs with software for developing the PLC program.
Advantages of using handheld programming terminal
1. Easy editing and debugging.
2. Compact in size, low cost and easy to use.
3. Easy transport to the field.

Disadvantages
1. Not compatible with all PLC CPUs.
2. Limited memory and so limited number of programs.
3. Small screen size and so limited capability to display ladder rungs.
4. Documentation not displayed.
5. Volatile memory, so battery back up is required.

Advantages of Software Programming Using PC


1. Larger screen so possible to display multiple rungs of logic, easy to troubleshoot.
2. More non-volatile memory, so storage possible.
3. Easy to transport the program through a floppy or CD, also useful for back up.
4. Rung comments, instruction comments, symbols, etc., are easy to be displayed or
added for editing.
5. Data tables can be easily monitored.
The different products follow different formats for programming the PLC. But a
general procedure for this as explained in Example 4.1 can be devised along with its
ladder diagram for any system.
Limitations: There are some limitations to be observed when programming a PLC
ladder diagram. When incorrectly formatted ladder diagrams are given, they will not
be received by the PLC CPU. Such limitations are to be followed when drawing a
ladder diagram.
1. A contact must always be inserted in slot I in upper left.
2. A coil must be inserted at the end of a rung.

3. All contacts must run horizontally. No vertically oriented contacts are allowed.
4. The number of contacts matrix is limited.
5. Only one output may be connected to a group of contacts.
6. Contacts must be nested properly or in some PLCs not at all.
7. Flow must be from left to right.
8. Contact progress should be right across.

14
4.11 PLC LOGIC
v The devices in an electrical schematic diagram are described as being open or
closed. Each of the PLC ladder rungs indicate a program statement.
v A program statement consists of a condition or conditions, along with some
type of action.
v Inputs are the conditions and the action or output is the result of the
conditions.
v The PLC combines the ladder program instructions, similar to the physical
wiring hardware devices, in series or parallel. For this, it uses logical operators
— AND, OR and NOT. They are combined for the instructions on a PLC rung
so as to make the outcome of each rung either true or false, which is the result.
AND Logic: This represents a series circuit. For example, switch I AND switch 2
must be closed in Fig.4. 18 to energise the light.

v Combinational Logic: Most of the PLC ladder rungs will include some
combination of AND, OR and NOT logic.
v For each of the rung, there must at least be one logic combination which gives
an output of 1.
Priority of Logic:
v This is very important in a program. Priority is the method of fixing sequence
of the portion of the problem to be solved first and then rest in subsequent
steps.
v If this sequence is not precisely followed then there is every possibility of an
error occurring.
v Some of the handheld programmers allow us to enter rungs of logic rather than
a list of instructions.
v So by entering the rungs of logic, we can see that they are placed in the proper
position and so the priority of logic problem does not arise.
v Similarly when PC is used for programming, the same procedure is carried
out.
v The programmer physically places the instruction on the rung and in the
correct position in relation to surrounding instructions, so concerns about logic
element priority are eliminated.
v For example, the evaluation of following program shows how the PLC rungs
are built.
Program: LOAD 11
AND 12
OR 13
AND 14
OUT 05

15
v Both (a) and (b) seem to be correct for the given set of instructions, though
they are not equivalent.
v This is where logic priority becomes important. So to solve this problem,
while programming, the following rules are to be adopted.
1. Each rung begins at the left power rail.
2. Start each rung with the appropriate beginning instruction — either “Store” or
“Load” instruction.
3. Program the next logic element closest to the one already programmed. In case a
series and a parallel logic element are equidistant, always program the parallel logic
function first.
4. For connecting two or more instructions in a parallel branch, special instructions
are used to connect or group, parallel instructions on that branch.
If no grouping instructions are included in the program, they will be programmed as
one instruction per parallel branch.

4.12 LADDER DIAGRAMS


v Ladder diagrams are the elementary or line diagrams used for non-electronic
control circuits.
v There are two types of ladder diagrams used in control systems, the control
ladder diagram and the power ladder diagrams.

v Fig.4.23 shows two basic control ladder diagrams.


v The first one A is for a single switch that turns a relay output CR on and off.
v The second, B is a single function diagram with parallel lines for control and
parallel lines for output.
v The two outputs can be turned on using any one or both of the two switches.
v The general rules to be followed while drawing the basic control ladder
diagrams are

16
1. All coils, pilot lights and outputs are on the right.
2. An input line can feed more than one output, which are connected in parallel.
3. Switches, contacts and so on may be connected in multiple contacts of series,
parallel or series parallel starting from left to right.
4. Every connection node should be given a unique identification number, along with
the relays, switches, lights, etc.
Let us draw a t function control diagram as below.

Explaining this diagram, we can see that the sequence of instructions should be as
follows.
1. All switches are open to start; both coils are off.
2. Closing SWI or SW2 or both energises both R and L
3. Closing the contact C enables line 3 but does not energise R
4. Closing C and SW3 energises R
Power Ladder Diagrams
v For applications like motor control, power ladder diagrams are drawn.
v The operation of these power ladder diagrams is straight forward.
v In Fig.4.25, when the power contactor coil is energised, the power contacts
close and power is applied to the motor or the load device.
v The main difference between the power ladder diagram and ordinary ladder
diagrams is that the connecting lines are thick.

For a large process, creating a ladder diagram is a little complicated. Hence the
following steps are used for planning a program for a large process.
1. Define the process to be controlled.
2. If possible, do a pictorial explanation of the process, either using a block diagram
or detailed diagram.
3. Create an algorithm with all the steps of process in sequence.
4. Add the necessary control relays, inputs and outputs, sensors according to the
process sequence, in the above diagram.
5. Add manual controls as required for the process or testing.
6. Add or adjust controls keeping the safety of the operating personnel in mind.
7. Add master stop switches, as required, for safe shutdown.
8. Create the ladder logic.

17
4.13 PLC PROCESSOR
v This is a microprocessor with memory and circuits to store and retrieve
information from and also communication circuits. Just like a microprocessor
based control system, the operations are carried out as per the instructions
given.
v So the explanations are the same as in the systems explained in the previous
chapter. The process of reading inputs, solving logic and updating outputs is
called the processor scan or processor sweep or operating cycle.
v As in any other program, PLC program also will be executed from the top.
v So the first rung of the ladder will be executed and subsequent rungs will
follow, unless altered by an instruction specifically designed to alter the flow
of the program. Program flow instructions direct this flow of instructions and
their execution within a ladder. As in microprocessor, jump and branch alter
the course of program.

Steps
1. The inputs are read and stored in the input status file.
2. The ladder program is solved starting from rung zero and it goes on to the
subsequent instructions.
3. While evaluating the rung, the PLC proceeds from instruction to instruction till
output instruction is reached.
4. Executing the output instruction, the logical one or zero output status is placed in
the output status file. The output status is the logical resultant of the solved input logic
for that rung.
5. After the last rung is executed, there is one additional rung which is automatically
inserted by the software and is called “end rung” This rung alerts the CPU that it has
reached the end of the ladder program.
6. After this the CPU services communications which is really the updating of
handheld or personal computers monitor screen or sending this through to other PLCs
in the network etc.
Housekeeping and Overhead: These are part of the scan cycle in which the CPU takes
care of memory management, updating timers and counters, internal time base, the
processor status file and other internal registers.

4.14 PLC INSTRUCTIONS


v There are many different PLCs in the market, and though they all operate in
basically the same way, there are many differences in features and instruction
sets.
v Basic instructions are the same but they may be programmed differently.
v Before going into the actual instructions, it will be better if the registers in the
PLC are explained along with how the data and program files are built in a
PLC.
v There are 10 types of data files which are created automatically by the
processor and are assigned a file number and alphabetical file identifier

They are 1. Output status file 2. Input status file


3. Processor status file 4. Bit file
5. Timer file 6. Counter file
7. Control file 8. Integer file
9. Floating point file 10. Common interface file

18
1. Output status file:
v This is, by default, file 0. This is made up of single bits grouped into 16 bit
words.
v Each bit refers to the ON or OFF state of one output point.
v Status file is created only if the processor finds an output module in that
particular slot.
2. Input status file:
v File I is the input status file.
v Similar to the output status file, this is also made up of 16 bit words each bit
for one input point.
3. Processor status file:
v This is file 2. Information in this file includes that on PLC’ s operating system.
v The information falls into 3 classifications.
v First, status information that cannot be modified or monitored.
v Second, dynamic configuration status words, bytes or bits used to select
processor options while in run mode.
v Third, static configuration status words which select processor options before
entering run mode.
4. The bit file :
v The bit file is file 3.
v A bit file is used to store single bits in a 16 bit word format.
v There can be many bit files for a single processor file. Any data file greater
than file 10 can be assigned as an additional bit file.
v Each file will have 255 sixteen bit words.
5. The Timer file :
v This file, file 4 is used to store timer data.
v Each timer has three 16 bit words called a “Timer element”.
v As in a bit file, this has 256 timer elements and additional files may be
created.
v The timer element with three 16 bit words consists of three parts.
v Word zero is for status bits.
v Word one is for preset value.
6. Counter file:
v This is file 5 and is used to store counter data.
v Here also as in timer file, there are three 16 bit words, called “counter
elements”.
v The details of the three words are as in timer file.
v The counter element format is shown below.
7. Control file:
v This is file 6 and is used to store status information for bit shift, first in and
first out stacks (FIFO), last in and first out stacks (LIFO), sequencer
instructions and certain ASCII instructions.
v This is similar to counter and bit files in that this also has three word element
with three 16 bit words.
v Word zero —Status word
v Word one —Length of the bit array or file. Word two —Current position in
the bit array

19
8. Integer file:
v This is file 7.
v The integer file element a 16 bit word representing one whole number, i.e., it
stores the binary equivalent of one whole number.
9. Floating point file:
v This is file 8.
v This stores the floating point data in two word elements.
v One word to store the integer and the second word is to store the exponent.
10. Common interface file:
v This is file 9.
v This is used as the target file in a PLC when the data is transferred from one
system to another when connected in a network.
v Each system will have a unique identifier called a node address.
v Apart from these default files, the programmer can create an ASCII file in any
unused data file numbered from 10 to 255.
v ASCII data file information is comprised of one word elements.
v Two hex characters are typically used to represent an ASCII character.
v String data is another type of data used in PLC. The difference between an
ASCII file and a string file is that the string file strings together a number of
ASCII characters rather than treat them separately.
v This can contain upto 255 elements, with each element made up of 42 words.
Any unused data file or files other than the default data files can be designated
as a string file.
v There are a total of 256 files available in a PLC.
v Files beyond the automatically created data files (default files) are available as
‘user defined files
The user can define these files for any specific application. No two files will share the
same number.

4.15. PLC REGISTERS


v In PLC, the registers are found in two locations.
v The microprocessor has internal registers, most of which are not directly
accessible by the user.
v These are used by the microprocessor for the different arithmetic and logic
operations. These include accumulators, data registers, index registers,
condition code registers, scratch pad registers and instruction registers.
v In addition to these internal registers, the CPU’ s RAM also contains slots that
are the external registers.
v These are 16 bits wide.
v Usually these registers are designated using prefixes followed by numbers like
OG1 (output group register 1) or HR 55 (Holding register 55), etc.
v It can be seen that a certain numerical series of addresses may be assigned to a
specific task or a function.
v There are 5 key registers in a PLC.
(a) Holding registers.
(b) Single input registers
(c) Group input registers
(d) Single output registers
(e) Group output registers
Holding register:

20
v This holds the contents of a calculation, arithmetic or logic.
v In many PLCs, this register is not directly accessible to inputs or outputs.
Separate input and output register will be used for the purpose.
v The use of this holding register is shown in the Fig.4.27.
v Processor manipulates the data in the holding register which has been
transferred from input registers. This data will be moved to the output register
next.
v The number of holding registers will depend on the length of the data and the
operation. It varies from 16 for small PLCs to hundreds in large machines.

v For a timer function, the holding register is the register in which the count
takes place.
v Similarly for the counter function, the preset count value is placed in a
constant or designated register and the count takes place in the holding
register.

Input Registers:
v This has the same characteristics as a holding register but it is the intermediate
register between an input device and a holding register.
v The number of input registers in a PLC is normally one tenth of holding
registers.
v These may also be grouped together so that the data may be received from
consecutive input ports. If we have 16 input ports, with 8 bits each, the first bit
of each of the 16 ports is connected to one register, the second bit of each port
is connected to the second register and so on.
v So at least one input point of one port will be connected to a register.
v This is illustrated in Fig.4.28. The advantage of this group register system is
that only one register is required to service 16 inputs. Without this, 16 input
registers are required.
Output registers:
v These are similar to input registers except that the data flow is from the
holding registers.
v This also has the same classification of single and group registers.

4.16. PLC INSTRUCTION SET


v As in the case of microprocessors, each manufacturer’ s PLC processors have
their own vocabulary of instructions.
v But the basic instructions called the relay instructions are shared by all PLCs.
v The relay instructions and their illustrations with rungs of ladder are given
below.

21

You might also like