You are on page 1of 49

Contents

1. Introduction 2
2. PLC Architecture 3
3. PLC Advantages 3
4. Modes of operation 4
5. PLC Working 5
6. Programming languages 6
7. Input and output instructions 8
8. Exercises 10
9. Timers 20
10. Counters 27
11. Program control instructions 37
12. Data Manipulation instructions 42
13. Math instructions 45
14. Electrical drawings 47

1
PLC Solution book

Introduction:
This book provides programming solution to the Exercises provided in the PLC
Workbook. This book provides stepwise programming solution, which helps the user to
understand the problem and prepare a logical solution.
The programming language pertains to Ladder logic language that is being used in
Siemens S7-200. The user program is entered in the software package namely Step 7
microwin programming. The program is downloaded to the PLC through serial
communication.
A personal computer is the most commonly used programming device. The
computer makes it possible to carry out programming away from the physical location of
the programmable controller. When the programming is complete, it is saved and
downloaded to the PLC. PLC has an in-built EEPROM in which the program is stored.
Changes in the program can be made and the program can be downloaded to the PLC any
number of times. The program status can be viewed in the software, while the program
gets executed in the PLC.
The computer can be used to document the PLC program. The programmer can
add notes in the ladder diagram, which makes troubleshooting very easier.
The chart status option in the software helps in reading the current value of
registers, timers and counters.

2
this interface is to condition the various signals received from or sent to external field
devices.
The programming device or terminal is used to enter the desired program into the
memory of the processor. The program determines the sequence of operation and
ultimate control of the equipment or machinery. The programming device is connected to
the PLC only while entering or monitoring the program. A personal computer with
appropriate software can act as the program terminal.
There are two ways in which I/O is incorporated into PLC, fixed and modular.
The processor and the I/O are packaged together in Fixed I/O and the I/O terminals are
available but cannot be changed. The number of I/O points can be expanded by buying
additional units of fixed I/O. Modular I/O is divided by compartments into which
separate modules can be plugged. Modular I/O is flexible and the user can mix modules
according to the need. The modules plug into a rack. When a module is slid into the rack,
it makes electrical connection with a series of contacts called backplane, located at the
rear of the rack. The PLC processor is also connected to the backplane and can
communicate with all modules in the rack.
The power supply unit supplies DC power PLC and other modules that may be
connected to the PLC. The power supply for field devices is provided by external
alternating current, in case of large systems.

Advantages of PLC:
PLC is basically designed to operate in industrial environment with wide
range s of ambient temperature and humidity.
PLC's are not affected by electrical noise problems.

3
Hardware and software of the PLC are designed for easy use by the plant
technician and electricians.
PLC is programmed in relay ladder logic making programming simpler.
Troubleshooting is simpler with PLC's as they have been provided with fault
indicators and written fault information displayed on the screen.

PLC Size and Application:


PLC's are divided into three major categories based on the size-
Small size PLC
Medium size PLC
Large size PLC
Small size PLC covers up to 128 I/O and memory up to 128K. These PLC's are
capable of providing simple to advance level of machine control. Medium size
PLC cover up to 2048 I/O and memory up to 32K. Special I/O modules make
Medium size PLC's adaptable to temperature, pressure, flow, weight or other
analog functions commonly encountered in control applications. Large size PLC
cover up to 16,000 I/O and memory up to 2M bytes. Large size PLC's can control
individual production processes to entire plant. The selection of PLC is done
considering the current and future possibility of expansion.

Modes of Operation:
There are three modes of operation
Run mode
Program mode
Remote test mode

Run position:
Places the processor in the Run mode
Executes the ladder program and energizes output devices
Prevents online program editing

4
Program position:
Places the processor in the Program mode
Prevents the processor from scanning or executing the ladder diagram
Allows program entry and editing

Remote position:
Places the processor in the Remote position
Allows online editing
Processor mode can be changed.

PLC working:
The working of a PLC is similar to that of a computer. Once the PLC is placed in
Run mode, the processor reads all the input values and energizes or de-energizes the
outputs according to the user program. This process is known as Scan. The PLC scan
time indicates how fast the controller can react to changes in inputs. Scan time varies
with program content and length. The time required to make a single scan can vary from
1ms to 20ms.
The scan is normally continuous and sequential process of reading the status of
inputs, evaluating the control logic and updating the outputs. The processor examines the
input for a ON condition and when this happens the rung is said to be TRUE. The
processor then sets the output image table bit to 1 for the corresponding output. During
the next cycle, the actual output is turned ON. If the input is turned OFF, the rung
becomes FALSE. The processor then sets the output image table bit to 0 causing the
output device to turn off.
Each instruction entered in a program requires certain amount of time for the
instruction to be executed. Of example, the Processor takes less time to read the status of
an input than it does to read the accumulated value of a counter.
There are two basic scan patterns that PLC manufacturers use to adopt namely the
Horizontal Scan
Vertical Scan

5
In Horizontal scanning system, the processor examines input and output instructions from
the top left to right and then horizontally the next rung and so on.
In Vertical scanning system, the processor examines input and output instruction from the
top left and then vertically down column by column.

PLC Programming Languages:


The term PLC programming refers to the method by which the user
communicates information to the PLC. The three most commonly used language
structures are
Ladder diagram language
Boolean language
Function chart
Ladder Logic Programming:
Ladder diagram language is by far the most commonly used PLC language. Ladder logic
programming is similar to relay ladder wiring making the programming simpler. Ladder
logic programming is basically a symbolic set of instructions used to create the program.
Since the instruction set is composed of contact symbols, ladder logic diagram is also
called Contact Symbology.
The main function of the ladder logic program is to control outputs based on input
conditions. The control is accomplished through the use of Ladder rung. A Rung consists
of set of input conditions represented by contact instructions and an output instruction at
the end of the rung represented by the coil symbol. Each contact or coil is identified with
a unique address. For an output to be activated, at least one left to right path of the
contacts must be closed. A complete closed path is said to have logical continuity. When
logical continuity exists in at least one path, the rung condition is said to be TRUE. The
rung condition is FALSE, if no path has continuity.

Boolean Language Programming:


Boolean language programming incorporates the statement list. Statement list refers to
basic AND, OR and NOT logic gate functions.

6
Function Chart Programming:
The Function chart programming was originally developed in Europe and is
called Grafcet. This method uses a more structured approach. Function chart
programming approach is uses Function blocks (steps and transition units). A function
chart is a pictorial representation of a sequential control process. It shows the possible
paths the process can take and the conditions necessary to go from one block to another.
A major advantage of function chart programming is that block of logic can be
programmed as a module and transition logic ensures that only appropriate software
modules will operate at any given time. Other advantages include simpler programming,
faster scan time, enhanced maintainability and ease of future enhancements.
Interlocks are a major drawback with ladder logic programming. Much of effort is
spend in overcoming the conditions that may occur again and again. Interlocks are
overcome with function chart programming in which the processor scans only the active
steps. Processor does not even scan those parts of the program that are inactive, thus
reducing the number of complex interlocks required.
Some PLC’s support Sequential function chart programming. Sequential function
chart programming is more structured into sections and modules which simplifies
troubleshooting and maintenance.

7
Input Instructions:
Inputs are normally represented by
Normally open contact
Normally closed contact
Normally open contacts are defined as those contacts that are open when no
current flows through the coil, but close as soon as the coil conducts. Normally closed
contacts are closed when the coil is de-energized and open when the coil is energized.
Input devices connected to the Input module are represented as open and closed
contacts. Input devices such as pushbuttons, limit switches. sensors, selector switches
are hardwired to the terminals of the input module. Input devices are configured as
Normally open and close switches as per the manufacturer specification.
The inputs are scanned and their status are updated in the input register table. The
program scan compares the input device status with the programming status and
updates the input register status. The normal state of input does not matter for the
controller. What matters is the user program which is nothing but a logical circuit .If
the contacts in the ladder provide a continuous path from left to right end of the rung,
then the rung is said to be TRUE and the outputs are updated in the output register
table. The table helps in configuring the contacts in the program to obtain the desired
results.

Input device status Programming status Execution status


Normally open switch Normally open Normally open
Normally open switch Normally closed Normally closed
Normally closed switch Normally open Normally closed
Normally closed switch Normally closed Normally open

8
Internal Relay instructions:
Most PLC’s have an area of the memory allocated for internal storage bits. These
storage bits are called internal outputs or internal coils. Internal coil operates in the same
way as any output, however the output is strictly restricted for internal purposes.
The advantage of using internal outputs is that there are many situations where an
output instruction is required in the program, but no physical connection is required.
Internal memory bits can be programmed by the user to perform relay functions without
occupying a physical output.

Output Instructions:
Outputs are normally represented by coil symbol. The PLC output module can
operate a variety of output control devices. These devices include pilot lights, control
relays, motor starters, alarms, solenoids, small motors and horns. In general mostly
outputs are actuators. An actuator is a device that converts electrical signal into linear
mechanical motion. The principle types of actuators are relays, solenoids and motors.
Output latch instruction with a bit level address. When the instruction is true, it
sets a bit in the output image file. It is a retentive instruction because the bit remains Set
even when the latch instruction goes false. In most applications, it is used with an
Unlatch instruction. When the instruction is true, it resets a bit in the output image file. It
is also a retentive instruction because the bit remains Reset even when the latch
instruction goes false
An Electrical relay is a magnetic switch. It uses electromagnetism to switch
contacts. A relay will have one coil and number of normally open and closed contacts.
Thus a number of control devices can be controlled by means of a single relay. Control
relays do not carry heavy currents and voltages. The contacts are usually rated between 5
and 10 Amps with a maximum coil voltage of 120V AC. Contactors are special type of
relays designed to handle heavy power loads. Contactors are designed to make and break
electrical circuits.

9
Entering the Ladder diagram:
The ladder diagram is entered into the PLC by means of a Programming
device. The programming device is usually a PC with appropriate software. The user can
pick the input contacts (NO and NC) and output coil instructions from the programming
window and create the appropriate program for their application. The following pages
will have some virtual applications for which the user can write ladder programs. The
solution for the application is available with the PLC Solution book.

Exercise 1:
A 12V DC motor is to be operated by means of a Start switch. The motor is
switched off by means of a Stop switch.
Normally open Start switch to start the motor
Normally closed Stop Switch to stop the motor
A relay to switch on the motor.
Motor connected to NO point of the relay.

12V Motor
START STOP

10
Exercise 2:
A two position single solenoid valve is used to operate a double-acting
cylinder. The cylinder moves in the forward direction when the pushbutton is pressed and
the cylinder retracts when the pushbutton is released.
Normally open pushbutton switch
A Single solenoid coil
A double acting pneumatic cylinder

Forward motion
of piston

Sol A Start
Exhaust
P

11
Exercise 3:
A two position double solenoid valve is used to operate a double-acting
cylinder. The cylinder moves in the forward direction when the pushbutton is pressed and
the cyliner is in fully retracted position. The cylinder retracts when it has reached the
extended position.
Normally open pushbutton Start switch
A double solenoid coil
Magnetic reed switches A0 and A1 at the retracted and extended position.
A double acting pneumatic cylinder

A0 A1

Sol A Sol B
Start
Exhaust
P

12
Exercise 4:
A water pump connected to a storage tank is to be controlled by means of a
ON/OFF switch and a selector switch. The selector switch has 2 positions namely Auto
and manual. The level of water in the tank is indicated by means of 2 level sensors fixed
at the low level and high level. The pump is switched ON and OFF by means of a
switch.The pump will start in manual mode, if the level of water in the tank is at any level
except low. When the level of water is high, the pump will start in Auto-mode and will
stop automatically when the water reaches Low level. The selector switch remains in
manual mode by default.
+

ON/OFF switch for pump control


Selector switch for mode control
Normally open high and low level Sensors
Relay for controlling motor
Pilot lamps for Pump running, and level indication.
Pump Low High
Running level level

G R Y

High level sensor

Low level sensor

Pump
motor
13
Exercise 5:
An industrial conveyor unit is driven by means of a motor. The conveyor is
used for transporting materials from one end to the other. The conveyor motor is initiated
by means of a Start switch and a limit switch at the end of the conveyor stops the motor.
An Emergency stop switch is provided to stop the motor in case of any emergency.
Normally open start switch
Normally closed E-stop switch.
Normally open limit switch
A relay for motor control
Pilot lamps to indicate motor running and idle condition.

Package Motor
Stop
R

Run
G
LS

E-stop Start

14
Exercise 6:
A simple drilling operation requires the drill press to turn ON only if there is a
material loaded in the vice and the operator has one hand on each of the start switches.
This precaution will protect the drill bit from being damaged and also will ensure that the
operator hands are not in the way of the drill.

Normally open pushbutton switches PB1 and PB2


Normally open part sensor
Relay to operate the drill motor

Drill motor PB1 PB2

Part sensor

15
Exercise 7:
A motorized overhead garage door is to be operated by means of a control
panel that includes the following
Normally closed Down limit switch to sense when the door is fully
closed
Normally closed Up limit switch to sense when the door is fully open
Normally open door Up button for the up direction
Normally open door Down button for the down direction
Normally closed door stop button for stopping the door
Red door light to signal the partially open condition
Yellow door light to signal the fully closed condition
Green door light to signal the fully open condition
A relay for operating the motor
A relay for changing direction of the motor

Up limit Motor
switch

R G Y

Up Down Stop
Down limit
switch

16
Exercise 8:
A continuous filling operation requires boxes moving on a conveyor to be
automatically positioned and filled.
Normally open Start switch for starting the Conveyor
Normally closed Stop switch for stopping the Conveyor
Normally open photo-electric sensor for material sensing
Normally open level sensor for material filling
A relay for operating the Conveyor motor
A Solenoid for material filling operation
Pilot lamps for indicating conveyor status (running and stop) and material
filled status

Hopper
G Run

R Standby

Y Full
Solenoid
Level sensor
Start
Stop

Photo-electric
Motor sensor

17
Exercise 9:
A pump is to be used for filling two storage tanks. The pump is manually
started by the operator from a start/ stop station. When the first tank is full, the control
logic must automatically stop flow to the first tank and direct flow to the second tank
through the use of a level sensor and electric solenoid valves. When the second tank is
Full, the pump must shut down automatically. Indicator lamps are included to indicate
each tank is full.
Normally open start switch for starting the pump motor
Normally closed stop switch for manually stopping the pump
Normally open high and low level sensors for both the tanks
Solenoid coils for directing flow
Indicator lights for indicating tank level.
Tank Full Tank Tank Full Tank
Empty Empty

G R Y B

High level sensor High level sensor


Tank 2
Tank 1

Low level sensor Low level sensor

Sol A Sol B

Pump
motor Start
Stop

18
Exercise 10:
A temperature control system consists of four thermostats controlling three
heating units. The thermostat contacts are set to close at 50 degree, 60 degree and 70
degree and 80 degree celsius respectively. The PLC program is to be designed in such a
way that at a temperature below 50 degree, three heaters are to be ON. Between 50 deg to
60 deg, two heaters are to be ON. For 60 deg to 70 deg, one heater is to be ON. Above 80
deg, there is a safety shut-off for all three heaters. A pushbutton switch is used to turn ON
the unit.
Normally open Start switch for starting the unit
Normally open Thermostat Switches
Normally closed E-Stop switch
Relays for switching the Heaters.

Reactor tank

Thermostat-4

Thermostat-3

Thermostat-2

Thermostat-1

Heating Heating Heating


unit -1 unit -2 unit -3

E-stop
Start

19
Timers:
The most commonly used instruction next to contacts and coils is Timer
instruction. The timing function was previously established by Mechanical timing relay.
The required time delay was established by positioning the needle valve. Thus the set-up
needs to be altered for any timing modification.
PLC timers are output instructions that provide delay for opening and closing
a contact. They are used to activate or de-activate a device after a preset interval of time.
The number of timers that can be programmed depends on the model of the PLC and
have a minimum number of 100.
The advantage of PLC timers is that the timer settings can be altered in the
software by changing the values without having to change any hardware connections.
Secondly, timer accuracy and repeatability are extremely high since it is based on solid
state technology. There are three different types of timers namely the On-delay timer,
OFF delay timer and Retentive timer. The timer instruction is usually associated with the
following terms,
Preset time:
The preset time represents the time duration for the timing circuit.
Accumulated time:
The accumulated time represents the amount of time elapsed from the
moment, the coil was energized.
Timer base:
The intervals that the timers time out are generally referred to as the time base
of the timer. Timers can be programmed with several different time bases: 1s, 0.1s, 0.01s.
The required time delay is determined based upon
Time delay = preset time * timer base
For example, in order to generate a time delay of 50s with timer base of 0.1s, the user
must enter 500 in the preset value.
When the timer rung has logical continuity, the timer begins counting time-
based intervals and times until the accumulated value is equal to the preset value. When
the accumulated time equals the preset time, the output is energized, and the timed output

20
contact associated with the output is closed. The timer contact can be used any number of
times in the program as normally open or normally closed contacts.

ON-Delay Timer:
The On-delay timer operates in such a way that when the rung containing the
timer is TRUE, the timer begins to count. At the end of the timer period, the output is
made active. The ON-delay timer is the commonly used timer. The timer provides an
output only when the timer has timed out completely. If the rung goes FALSE during the
time-out period then the accumulated value resets to zero. This timer is a non-retentive
timer because loss of power flow to the timer causes the timer to reset.

OFF-Delay Timer:
The timer operates in such a way that when the rung containing the timer is
FALSE, the timer begins to count. The timer counts until the accumulated time equals the
programmed preset value. The timer provides an output only when the timer has timed
out completely. If logical continuity is attained before the time-out period, then the
accumulated value is reset to zero. This time is also a non-retentive timer.

Retentive Timer:
A retentive timer accumulates time whenever the device receives power and
maintains the current time even when the power is switched OFF. As soon as logical
continuity is attained, the timer starts counting from the last value. Once the accumulated
value becomes equal to the preset value, the timer contact switches the output. Loss of
power to the timer does not affect the state of the output. The retentive timer must be
reset with a separate signal for the accumulated value to become zero and for the contacts
to return back to the previous state. Thus Retentive timer instruction is always
accompanied by a Reset instruction.

21
Exercise 11:
A simple ladder logic program to control a motor. The motor is initially
switched ON by means of a pushbutton switch. The motor should be automatically
switched off after 2 minutes.
Normally open pushbutton Start switch
A relay to operate the motor

12V Motor
START

Exercise 12:
The headlamp of a Car needs to be controlled automatically. The lamp should
be ON immediately after the key is turned on. The lamp should turn OFF automatically
only 2 minutes after the key is turned OFF.
Normally open ON/OFF switch
Pilot lamp

ON

OFF

22
Exercise 13:
A simple ladder logic to simulate the operation of a sequential taillight system.
The light system consists of three separate lights. There has to be 1-second time delay
between the activation of each light and a 1-second delay when the lights are OFF. A
simple pushbutton switch switches ON the light system. When the start switch is pressed
momentarily, first light gets ON immediately and then the second light after 1 sec and the
third light after 1 sec. The third light glows for 1 second and all the lights are switched
OFF for 2 seconds. The sequence starts again automatically after 2 seconds. The
operation continues indefinitely until the system is brought to halt by a Stop switch.
Normally open Start switch and a normally closed Stop switch.
Tail lights 1, 2 and 3.

L1 L2 L3

Start Stop

Exercise 14:
When the lights are Turned OFF in a building, an Exit door light must remain ON
for an additional 2 minutes and the parking light are to remain ON for an aditional 3
minutes after the Buliding light goes out. All the lights are initially switched ON by
means of a main power Switch.
Building Exit door Parking
Normally open ON/OFF
light light swicth
light

Buliding light,
L L light andL exit door light.
parking

ON

OFF

23
Exercise 15:
A certain amount of chemicl solute is to be mixed with a solvent. The solutr
particles are loaded in the tank. The solvent entry into the tank is made possible by means
of a solenoid valve. The mixing action is carried out by means of an agigate motor. The
mixing takes place for about 3 minutes. When mixing is completed, the solution is
drained into a container through a separate solenoid valve. The process is brought to halt
at any time by means of a stop switch. The tank level is indicated by mans of two level
sensors.
Normally open Start switch
Normally closed Stop switch
Normally open level sensors
Solenoid valves for Solvent entry and Solution exit
A relay to operate the agitate motor

Motor

Sol A

Full Level sensor

Solute particles

Empty Level sensor

Sol B

Start
Stop

24
Exercise 16:
A simple process involves pumping fluid from Tank A to Tank B. When the Start
button is momentarily pressed, the pumping action begins. The pump stops when the
Stop button is pressed. The over-ride pressure is set with two pressure switches. The two
pressure switches closes 5 seconds after the pump is switched ON. In case, either of the
switch opens, the pump shuts off and cannot be switched on again for 2 minutes. The
pressure switches, in case of low pressure indicating that fluid level is low in Tank 1.
Normally open Start switch
Normally closed Stop switch
Normally open Pressure switches
A relay for operating the pump.

Tank B
Tank A

PS1

PS2

Pump
motor

Start
Stop

25
Exercise 17:
A ladder logic diagram to simulate the working of Traffic light in one direction.
The traffic light system is controlled automatically and the system works continuously
unless there is a power failure due to low battery.
Red – 30 seconds On
Green- 25 seconds On
Amber- 5 seconds On

R G Y

26
Counters:
The most commonly used instruction next to contacts, coils and timers is
Counter instruction. The counting function was previously established by Mechanical
Counters. Every time, the actuator lever moves, the counter attached to it adds one
number, while the actuating lever returns automatically to its original position.
Electronic counters can count up, count down or can be combined to count up
and count down. The counter instruction is similar to timers except the fact that counters
do not operate on internal clock but are dependent on external or program sources for
counting. There are two different types of counters namely
Up counter
Down counter
The counter instruction is associated with a preset value and accumulated value.
The Up counter increments its accumulated value by 1 each time the counter rung makes
a False to True transition. When the accumulated value equals the preset value, the output
is energized and the counter output is closed. The counter contact can be used many
number of times in the program as NO or NC contact. A counter Reset instruction is
always used in conjunction with the counter instruction. Up counters are always reset to
zero and the down counters are reset to the Preset value. Reset instruction forms a part of
the Counter instruction in many PLC’s. Counter instructions are retentive because
whatever count was contained in the counter at the time of power shutdown will be
restored to the counter on power-up condition. However, the counter may reset, if the
reset condition of the counter is activated at the time of power shutdown.

Up Counter:
The count Up instruction is an output instruction whose function is to increment
its accumulated vale on false to true transition. Thus it can be used to count False to True
transitions of an input instruction and trigger an event after a required number of counts.
The Up counter increments by 1 for every negative to positive transition. The reset
condition resets the counter to zero.
Preset value is the set point of the counter and it has a range from –32768 to
32767. The accumulated value is the current count based on the number of times the

27
Rung has gone from negative to positive transition. The accumulated value has the same
range has the preset value. The accumulated value counts past the preset value instead of
stopping at the preset value. Therefore the counter must be reset in-order to bring it back
to zero. Any number of counters can be used in a PLC program (about 256 counters). The
counters are provided with a number for easier programming.

Down Counter:
The down counter decrements by 1 each time the rung changes from False to True
state. Down counter normally counts from the preset value down to zero. This counter
also requires a reset condition. The reset condition resets the counter to its Preset value.
Normally, a down counter is used in conjunction with a up counter to form a Up/Down
counter.

Cascading counters:
Sometimes, it may be necessary to count events that far exceed the maximum
number allowed for a counter instruction. This can be accomplished by means of
interconnecting two counters. This is called Cascading. For example, when it is required
to count up to 250000, we can make use of 2 counters for achieving this count. Both
counters can have a Preset value of 500. Whenever counter 1 reaches 500, its output
contact resets the counter 1 and increments counter 2 by one. When the second counter
completes 500, a total count of 250000 would have been attained.

28
Exercise 18:
A conveyor is used for transporting some cases in an industrial application. The
cases are packed in a wooden box. When 50 cases have reached the end of the conveyor,
the conveyor stops automatically and the package is closed. A start button is used to start
the conveyor motor. A proximity sensor detects the case moving over the conveyor. The
conveyor can be started and stopped manually without loss of the accumulated count. The
counter is reset externally by means of a counter reset switch.
Normally open Start switch
Normally closed Stop switch
Normally open Counter reset switch
Normally open Proximity sensor
A relay to operate the conveyor motor.

Proximity
sensor

Case

12V Motor

Counter
reset switch
Start
Stop

29
Exercise 19:
A conveyor line transports materials coming to final packaging. Each package
must contain 10 parts and the box is closed by means of a solnoid operation. A display is
provided to indicate the number of materials coming for final packaging and the number
of package that has been completed. A pushbutton is provided to restart counting at the
beginning of the day. A proximity sensor detects the material over the conveyor

Normally closed pushbutton reset switch


Normally open photo-electric sensor
A solenoid valve for closing the package

Material

Photo-electric Solenoid
sensor
Package

Counter Display unit


reset switch
00 00

No. of No. of
materials packages

30
Exercise 20:
A procees monitoring system continuously displays the number of in-process
parts. Before starting, the system is completely empty of parts and the counter is reset by
means of a reset switch. There are two photo-electric sensors at the entry and at the end
of the assembly line. The infeed (photo -electric sensor at the entrance) counts the
incoming material and the outfeed sensor (photo -electric sensor at the exit) counts the
outgoing material.
Normally open infeed sensor(photo -electric sensor at the entrance)
Normally open outfeed sensor(photo -electric sensor at the exit)
Normally closed Counter reset switch.

Material
processing station

Outfeed sensor
Infeed sensor

Infeed Outfeed
(Raw parts) (Finished parts)

Counter Display unit


reset switch
00

Material in
process

31
Exercise 21:
A ladder logic program to generate a Real time clock. The clock displays
Seconds, minutes and hours. The real time clock application is combined with a pressure
generator unit. Constant pressure is to be maintained inside the boiler unit. The clock is
initiated at the time of switching on the boiler unit. When the pressure falls below the set
level, the clock stops automatically and the pressure is set again. Thus the time of failure
can be determined.
Normally open pressure switch
A display unit for time display
A relay to operate the Boiler

Pressure switch

Boiler
Display unit

00 00 00

Hour Minute Seconds

32
Exercise 22:
An automatic stacking operation is carried out after final inspection. Materials
coming after final inspection from Conveyor 1 are dropped over another stationary
conveyor. When 15 pieces have been stacked, the second conveyor starts moving to the
despatch section and the first conveyor is stopped. The second conveyor movement is
carried out for just 25 seconds during which it reaches the end. The process starts again
automatically after the second conveyor has reached the end. A photo-electric sensor
fixed in the second conveyor is used for counting the pieces.
Normally open Start switch
Normally closed Stop switch
Normally photoelectric sensor
Relays to operate both the conveyor motors.`

Stack

Conveyor 1
Photoelectric
sensor

Conveyor 2

Start
Stop

33
Exercise 23:
A ladder logic program to generate extremely long time delay for switching on a
Lamp. An ON/OFF switch is used to switch on a lamp after 1,00,000 seconds.
Normally open ON/OFF switch
Pilot lamp

Lamp

ON

OFF

Exercise 24:
A typical servomotor with encoder feedback is used for running a Conveyor
motor. A pushbutton start switch is used to start the Conveyor motor. Two limit switches
are fixed at the start and end positions of the conveyor. The motor needs to be stopped at
an intermediate position A, approximately 10 mm from the starting position. The Encoder
pulse is read in a counter. The motor generates 2 pulses for every mm. After a time delay
of 10 seconds, the motor should start again and stop at the end position. An Emergency
stop switch is used to stop the operation at any time and to reset the counter.
Normally open Start switch
Normally closed E- Stop switch
A relay to operate the motor.
Forward A

Encoder
LS 1 E-stop
LS 2 Start

34
Exercise 25:
A quality inspection process requires 1 part out of 1000 parts moving over the
assembly line to be sent for quality control. A start/switch is used to turn the conveyor On
and Off. A proximity sensor counts the parts as they move over the conveyor. When 1000
is reached, the counter output activates the Gate solenoid to be open which facilitates
material to switch over to the inspection line. The gate solenoid resets automatically after
2 seconds and the counter also gets reset. The process continues again in the same
manner. A reset button is provided to manually reset the counter.
Normally open Start switch
Normally closed Stop switch
Normally open Reset button.
Normally open proximity sensor
Gate solenoid coil
A relay to operate the Conveyor motor

Material
inspection

Proximity
sensor

Gate
Solenoid

Counter
reset button Start
Stop

35
Exercise 26:
A company that makes electronic assembly kits needs a counter to count and
control the number of resistors placed into each kit. The controller must stop the spool at
a pre-determined amount of resistors, say 100. A worker on the floor will then cut the
resistor strip and place in it the kit. A start/ stop switch is provided to turn th spool motor
ON and OFF. A through sensor is used to count the number of resistors. A display is
provided to count the grand total made in a day. Manual reset buttons are provided for the
counters that are used
Normally open Start switch
Normally closed Stop switch
Normally open through beam sensor
A display unit
A relay to operate the spool motor.
Normally closed reset buttons

Spool motor drive

Through beam sensor

Display unit
Counter Counter
reset button reset button Start 00

Stop
No. of
Resistors

36
Program Control Instructions:
The use of program control instrcutions in a program can shorten the time
required to complete a program scan. Portions of the program not being utilized at any
particular time can be jumped over. The program control instructions allows for greater
flexibility and greater efficiency in the program scan. Most PLC’s have Label, Jump, For-
Next and Subroutine instruction under program control instruction set.

Jump Instruction:
As in computer programming, it is sometimes desirable to jump over certin
program conditions, if certain condition exists. The jump instruction is an output
instruction. The advantage to the jump instruction is the ability to reduc processor scan
time by jumping over certain instructions that are not intended for the machine at that
instant. The important uses include
The programmable controller can hold more than one program and
scan only the program appropriate to operator requirements.
Sections of the program can be jumped over when a production fault
occurs.
The jump instruction is always accompanied by a Label instruction. The label is
the target of the jump and its always TRUE. If the jump coil is energized, all logic
between the jump and label instruction is bypassed and the processor continues scanning
after the LBL instruction.

Label instruction:
The label instruction is used to identify the ladder rung that is the target of the
jump instruction. The label address number must match that of the Jump instruction with
which it is used. The label instruction does not contribute to logical continuity and for
practical purposes, its always TRUE. Input conditions are not scanned in the portion
between jump and label and the outputs remain in their last state. Any timer opr counter
within the jump area do not operate. A single Label instruction can be used as destination
for multiple jumps. Its also possible to jump backward in the program. Care should be
taken that the scan does not remain too long in the loop. The processor has a Watchdog

37
timer that sets the maximum allowable time for a total program scan. If this time is
exceeded, the processor indicates a fault and shutdown occurs.

Sub-routine Instruction:
As in computer programming, it is possible to escape from the main program and
go to a program Subroutine to perform certain functions and return to the main program.
When certain function has to be performed several times, the Subroutine can be an useful
option. The subroutine will be performed when the rung containing the Call Subroutine is
true. The exit from the Subroutine is always returned to the rung following the call
subroutine instruction. The subroutine is returned by RET instruction. This RET
instruction is optional and the program control returns automatically to the main program.

For- Next instruction:


For-Next instruction is very useful, when a particular process has to be
performed “n” number of times. The program scan completes the portion between For
and Next. The index value increments everytime the loop is executed and when the index
value becomes equal to final value, the loop is terminated. The Next instruction marks the
termination of FOR loop.

Immediate Input and Output instructions:


The immediate input and output instructions interrupt the normal program scan to
update the input image table file with current input data or update an output with the
current output image table file data. These instructions are intended to be used in areas
where timing is critical.
The immediate input instruction is a special version of Normally open and
Normally closed instruction to read an input condition before the I/O update is
performed. This instruction is used with critical input devices that require updating in
advance of I/O scan. The immediate input instruction is most useful, if the instruction
associated with the critical input device is at the middle or toward the end of the program.

38
Even though the immediate input instruction sppeds up the updating of bits, its scan time
interruption increases the total scan time of the program.
The immediate output instruction is a special version of the output energize
instruction that is used to update the status of an output device before the I/O update is
performed. The immediate output instruction is used with critical output devices that
require updating in advance of the I/O scan.

END instruction:
The Conditional END (END) instruction terminates the main user program based
upon the condition of the preceding logic.The Conditional END instruction can be used
in the main program, but cannot be used in either subroutines or interrupt routines.

STOP instruction:
The STOP instruction terminates the execution of the program immediately by
causing a transition of the CPU from RUN to STOP mode.If the STOP instruction is
executed in an interrupt routine, the interrupt routine is terminated immediately, and all
pending interrupts are ignored. The rest of the program is scanned and the transition from
RUN to STOP mode is made at the end of the current scan.

Watchdog instruction:
The Watchdog Reset instruction allows the CPU system watchdog timer to be re-
triggered. This extends the time that the scan is allowed to take without getting a
watchdog error.

39
Exercise 27:
A certain mixing operation is carried out in a chemical Reactor unit. The
temperature of the unit is maintained by means of a thermostat. When the temperature
falls below 100 deg, heater is switched ON. The level of water in the unit is maintained
by means of a Level sensor. When the level falls below, pump is switched On for 5
minutes and then switched OFF. The pressure level in the tank is maintained by means of
a pressure switch. When the pressure level exceeds a certain limit, pressure switch opens
and an Alarm is activated immediately and all the other outputs left in the previous state.
The chemical solution is drained OFF at this stage, which brings back the pressure to
normal level. The entire unit is shut down by a ON/OFF switch.
Normally open ON/OFF switch
Normally open Thermostat
Normally open Level sensor
Normally closed pressure switch
A relay to operate the Pump
A relay to operate the heater
A relay to operate the solenoid controlling the Drain valve.
An Alarm Reactor tank

Pressure sensor
Thermostat
Solenoid valve
Level sensor

Discharge tank

Heater
Alarm

ON

OFF
40
Exercise 28:
A conveyor used for transporting beads is fixed with a weight sensor.. The
weight sensor has a pre-determined value of weight, which makes sure that the weight of
the material over the conveyor does not exceed the limit. The materials are transported to
the Conveyor from a hopper via a solenoid valve. When the weight limit exceeds the
preset value, alarm light flashes and the solenoid is de-energized. When the material is
removed from the conveyor, the alarm light returns to its normal state. An E-stop switch
is programmed to stop the unit immediately.
Normally open Start switch
Normally closed E-stop switch
Normally open Weight sensor
A relay to operate the Conveyor motor
A solenoid
A flashing alarm light

Hopper

FL Flashing
Alarm

Solenoid

Weight sensor E-stop


Start

Motor

41
Data Manipulation Instructions:
Data manipulation involves transferring data and operating on data with math
Functions, data conversion, data comparison and logical operations. Data manipulation
instructions enable the PLC to take some of the qualities of a computer system. Most
PLC’s are equipped with the capability to manipulate data. Each instruction requires two
or more words of data memory for operation. The words of data memory are referred to
as Registers.
Data transfer instructions involves the transfer of the contents from one word to
another. Data transfer instructions are Output instructions. The MOVE instruction is used
to copy the value in one word to another word. The instruction copies data from a source
word to a destination word.
Data compare instructions are input instructions. Data comparison instructions are
useful in cases such as
To start an action or process when the counter value at a specific value.
To verify that an input device’s data (Analog input) is within the range.
To verify that the parts are within tolerance limit.
Data comparison instruction includes a wide range of instructions such as
Greater than
Lesser than
Equal to
Not equal to
Greater than or equal to
Lesser than or equal to

42
Exercise 29:
Three different types of products are run on a conveyor line. The storage rack has
room for only 300 boxes of product A or 175 boxes of product B or 50 boxes of product
C. A photoelectric switch fixed over the conveyor counts the number of objects. A
selector switch is provided to select the product label that is being transported. A pilot
lamp is used to indicate the FULL status of the Storage rack. The three switches help in
setting the preset value for the counter. Manual reset button is provided to reset the
counter
Normally open Photoelectric switch
Normally open switches A, B and C
Pilot lamp

Forward A

Photoelectric
switch

Counter
A B
reset button L
C
Lamp

43
Exercise 30:
A simple ladder logic program to switch on a lamp 5 seconds after the Start
pushbutton is pressed. The light should glow for another 30 seconds and then switch OFF
automatically.
Normally open Start switch
A pilot lamp

L
Start

Exercise 31:
A certain Pneumatic operation requires operation of four solenoids in a time delay
sequence. A single pushbutton is switch is used to switch On the system. As soon as the
Start button is pressed, Solenoid A gets energized. After 5 seconds, Solenoid B gets
energized and C gets energized 10 seconds later and Solenoid D is energized 20 seconds
later. A stop button is used to stop the sequence at any time.
Normally open Start switch
Normally closed Stop switch
Four Solenoid valves

Start Stop
Sol A Sol B Sol C Sol D

44
Math Instructions:
Math instructions enable the PLC to replicate some of the qualities of a computer
system. The Math functions allow the processor to perform arithmetic functions on
values stored in Memory word. The basic math functions include Addition, Subtraction,
Division and Multiplication. These math functions can be performed on two numbers or
values stored in memory locations.

Addition instruction:
The ADD instruction performs the addition of two values stored in memory
locations. Addition is performed when the rung containing the Function block is TRUE.
When performing addition care should be taken to ensure that the result is within the
range that the data table can take.

Subtraction instruction:
The SUBTRACT instruction is similar to ADD instruction and it subtracts the two
values stored in memory locations. Subtraction is performed when the rung containing
the Function block is TRUE. When the second number is larger than the first number, a
negative number results.

Multiplication instruction:
The MULTIPLY instruction multiplies the two values stored in memory
locations. Multiplication is performed when the rung containing the Function block is
TRUE. When the multiplication result is larger, the value is stored in a Double word.

Divide instruction:
The DIVIDE instruction divides the two values stored in memory locations.
Multiplication is performed when the rung containing the Function block is TRUE. The
result of division is stored in two words. The first word stores the integer part and the
second word stores the decimal fraction.

45
Exercise 32:
A certain operation requires a Light to come on only when the Sum of two
counters is zero. First counter starts counting when the limit switch 1 is closed. Similarly,
second counter starts counting when limit switch 2 is closed. A reset button is provided to
reset the counters.
Normally open Limit switches
Normally closed reset button
A pilot lamp

L
Reset
LS 1 LS 2
button

Exercise 33:
A filling application requires 5 kg(preset) of raw material to be filled in a vessel.
When the start button is pressed, the fill solenoid is activated and the filling light is also
turned ON. When the weight reaches 5 kg, the solenoid is de-energized and the filling
pilot lamp is switched off. The Full pilot lamp gets turned ON when 50 kgs has been
reached. If by chance, the weight exceeds a tolerance limit of 20 grams, an Alarm is
energized and stays On until the excess weight is removed.
Normally open Start switch
Normally closed stop switch
Normally open weight transducer( Analog input)

Sol A
Start Stop
Fi Fu
Alarm

Weight
transducer
46
Exercise 34:
A certain application requires temperature display in Fahrenheit. The input
temperature is recorded in Celsius degree. The output Fahrenheit temperature is displayed
in a display unit. The thermostat records the input temperature.
Normally open Thermostat
A display unit
Display unit
Thermostat

00 F

Exercise 35:
An industrial Oven needs automatic control of upper and lower set point limits.
The upper and lower limits are set automatically at +- 1% regardless of the set point
value. The set point temperature is adjustable b y means of a thumbwheel switch. An
analog thermocouple module monitors the current temperature. The heater is switched On
when the temperature falls below the low point and the heater is turned Off when the
temperature reaches the upper limit. A red pilot lamp turns On when the lower limit is
reached and a green pilot lamp turns On when the upper limit is reached.
Normally open On/Off switch
Normally open thermocouple
Pilot lamps and a relay to operate heater

Thumbwheel switch

Oven
L H

Thermocouple
ON

OFF

Heater

47

You might also like