Beruflich Dokumente
Kultur Dokumente
Ladder Diagrams
The diagram shows the
circuit for switching on or off
an electric motor.
In a ladder diagram, we use
two vertical lines to
represent the input power
rails and stringing the rest of
the circuit between them.
Another example: Motor
start-stop
2
Simple Example
Ex01Sw
ON-OFF SWITCH
Logic Functions
There are many control situations requiring
actions to be initiated when a certain
combination of conditions is realized.
The drill motor is to be activated when the limit
switches are activated that indicate the presence of
the workpiece and the drill position as being at the
surface of the workpiece.
Such a situation involves the AND logic function.
7
1 AND
An output is not energized
unless two, normally open,
switches are both closed.
Inputs
A
O
O
1
1
Output
B
0
1
0
1
0
0
0
1
2 OR
An output is energized when
switch A or B, both normally
open, is closed.
Inputs
A
O
O
1
1
Output
B
0
1
0
1
0
1
1
1
Simple Example
Ex02Sw
PUSH-BUTTON SWITCH
10
3 NOT
There is an output when there
is no input and no output when
there is an input. The gate is
sometimes referred to an
inverter.
Input
A
0
1
Output
1
0
Simple Example
Ex03Sw
RUN-STOP MOTOR
12
13
Ex04Motoroperation
Forward operation,
Set an interlock with
reverse operatin
(P41, P02)
Reverse operation,
Set an interlock with
forward operatin
(P44, P01)
14
4 NAND
Follow an AND gate with a
NOT gate, invert all the outputs
from the AND gate.
An alternative, which gives
exactly the same results, is to
put a NOT gate on each input
and then follow that with OR
Inputs
Output
A
B
O
0
1
O
1
1
1
0
1
1
1
0
Example: A warning light that
comes on if, with a machine
tool, the safety guard switch
has not been activated and the
limit switch signaling the
presence of the workpiece has
not been activated.
15
5 NOR
Follow an OR gate by
a NOT gate, invert the
outputs of the OR gate.
An alternative, which
gives exactly the same
results, is to put a NOT
gate on each input and
then an AND gate for
the resulting inverted
inputs
Inputs
A
0
0
1
1
Output
B
0
1
0
1
1
0
0
0
16
Ex05DemorganLaw
17
6 Exclusive OR
(XOR)
Gives an output when
either of the inputs is 1
but not when both are
1.
Inputs
A
0
0
1
1
Outputs
B
0
1
0
1
0
1
1
0
18
Latching
There are often situations where it is necessary to hold
an output energized, even when the input ceases.
A motor which is started by pressing a push button switch.
19
Ex06MotorOn-OffwithLamps
Motor output
20
Multiple Outputs
With ladder diagrams, there can be more than one
output connected to a contact.
Outputs P40, P41 and P42 are switched on as the
contacts in the sequence given by the contacts P00,
P01 and P02 are being closed.
Until P00 is closed, none of the other outputs can be
switched on.
When P00 is closed, P40 is switched on.
When P01 is closed, P41 is switched on.
When P02 is closed, P42 is switched on.
Ex07MultipleOutput
21
22
Ladder Symbols
There are several methods that can be used for
keying in programs.
a keypad having keys with symbols depicting the various
elements of the ladder diagram and keying them in so that
the ladder diagram appears on the screen of the
programming terminal.
Computers can be used to draw up a ladder program.
These involve loading the computer with the relevant
software and then selecting items from menus on the
screen.
23
Instruction Lists
Mnemonic codes
Another PLC programming method.
Each code corresponding to a ladder element.
The codes used may differ from manufacturer
to manufacturer, though a standard IEC 1131-3
has been proposed.
Step
0
1
2
Instruction
LD
X400
AND
X401
OUT
Y430
24
Branch codes
Step
0
1
2
3
4
5
Instruction
LD
X400
ANI
X401
LDI
X400
AND
X401
ORB
OUT
Y430
25
Instruction
LD
OUT
LDI
OUT
26
Boolean Algebra
Instruction lists and ladder
programs can be derived from
Boolean expressions.
In Boolean algebra there are just
two digits 0 and 1.
AND
A.B=Q
OR A+B=Q
NOT
A- =Q
27
Ex ample 1
A+B.C= Q
X400 + X401.X402 = Y430
Ex ample 2
Fr om the l ogi c diag r am
( A.B + C) D - E F - = Q
28
29
Programming examples
Example 1
Ex08SignalLamp
Pump
Pressure
Lamp
Test
30
Example 2
Ex09SafetySw
31
Example 3
Ex10Level
A Level Application
We are controlling lubricating oil being
dispensed from a tank. This is possible by
using two sensors. We put one near the
bottom and one near the top.
The fill motor to pumps lubricating oil into
the tank until the high level sensor turns
on. At that point we want to turn off the
motor until the level falls below the low
level sensor. Then we should turn on the
fill motor and repeat the process.
We use 2 inputs (sensors) and 1 output
(the fill motor). 0500 is just an indicator
lamp.
How a Ladder is scanned (ANIMATED)
32
5 Internal Relays
33
Internal Relays
Do not exist in the real-world switching devices but are
merely bits in the storage memory that behave in the same
way as relays.
For programming, they can be treated in the same way as
an external relay output and input.
It has to be activated on one rung of a program and then its
output used to operate switching contacts on another rung,
or rungs, of the program.
To distinguish internal relay outputs from external relay
outputs, they are given different types of addresses.
Different manufacturers tend to use different terms for
internal relays.
34
35
Ex11AutomaticBarrierLifting
37
38
2 Latching Programs
It would be possible to devise a ladder diagram
which has individually latched controls for each
such output. However, a simpler method is to
use an internal relay.
Ex12MultipleOutputs
Example
The first rung has the latch for keeping the
internal relay IR 1 on when the start switch gives
a momentary input. The second rung will then
switch the power on. The third rung will also
switch on and give output Out 2 if input 2
contacts are closed. The third rung will also
switch on and give output Out 3 if input 3
contacts are closed.
Thus all the outputs can be switched on when
the start push button is activated.
All the outputs will be switched off if the stop
switch is opened.
Thus all the outputs are latched by IR 1.
39
Design example
Parking Lot (in and out) barriers, each opens when a sensor signals a
car in and closes when another sensor signals that the car has passed.
40
Battery-Backed Relays
Ex13BatteryBackedRelay
Turn-off the supply then turn it back on to test the Keep relay.
42
Ex17PowerFailure
43
One-Shot Operation
Ex14PulseOutputDInstruction
45
Ex15OnOffToggle
46
Ex16OneShotWWW
47
48
Ex18PandKrelsys
49
Example
Ex19SetRest-to-OneShot
set-reset function can be used to build the pulse (one-shot) function described
earlier.
An input P00 causes the internal relay M00 in the first rung to be activated.
So, second rung, in the setreset of P40 is being set. This setting action results in
M00 in the first rung opening and so, despite there being an input in the first rung,
M00
Because the rungs are scanned in sequence from top to bottom, a full cycle must
elapse before the internal relay in the first rung opens. A pulse of duration one cycle
has thus been produced.
The system is reset when P00 ceases.
One-pulse appears on P41
50
52
Animated Example
Ex21MCRwww
53
Ex22MCRManualAutomaticDoor
Automatic Mode
Manual Mode
Common Part
P40 opens
P41 closes
(Automatic or Manual)
54
Jump
If the appropriate
conditions are met, this
function enables part of
a ladder program to be
jumped over.
Example
when there is an input to In 1, the program
jumps to Rung 4 and then proceeds with rungs
5,6, etc.
When there is no input to In 1, the jump relay is
not energized and the program then proceeds
to rungs 2,3, etc.
55
Ex23Jump
56
to rung 8.
If the condition is not met then the program continues to rung 3.
If the condition for the jump instruction 1 is realized then the
program jumps to rung 6.
If the condition is not met then the program continues through the
rungs.
Ex24NestedJump
57
6 Timers
58
Types of Timers
59
Programming Timers
All PLCs generally have
delay-on timers, small PLCs
possibly having only this type
of timer.
Figure 6.3 shows a ladder
rung diagram involving a
delay-on timer.
Whenever the input to the
TON timer is 0, the timer
resets to 0.
Ex25TimerSimple
60
Example
Ex35TimerWWW
Animated
61
1 Sequencing
Ex26sequencing
Example 1
When the input P01 is on, P40 is switched on.
The contacts associated with this output then start the timer.
The contacts of the timer will close after the preset time delay,
in this case 0.5 s.
When this happens, output P41 is switched on.
Thus, following the input P01, P40 is switched on and followed
O.5 s later by P41.
62
Ex27Sequence3Motors
Example 2
Timers are used to start three outputs, e.g. three motors, in sequence following
a single start button being pressed.
When the start push button is pressed there is an output from internal relay M0.
This latches the start input. It also starts both the timers, T0 and T1, and motor
1.
When the preset time for T0 has elapsed then its contacts close and motor 2
starts.
When the preset time for timer T1 has elapsed then its contacts close and
motor 3 starts.
The three motors are all stopped by pressing the stop push button.
63
2 Cascaded Timers
Timers can be linked together,
the term cascaded is used, to
give longer delay times than
are possible with just one timer.
Example
Timer 1 has a delay time of 999 s. This timer
is started when there is an input to In 1.
When the 999 s time is up, the contacts for
timer 1 close.
This then starts timer 2. This has a delay of
100 s.
When this time is up, the timer 2 contacts
close and there is an output from Out 1.
Thus the output occurs 1099 s after the input
to In 1.
64
Ex28CascadedTimers
65
66
Off-Delay Timers
Ex30OffDelayTimerEmulation
67
TON timer
Input High, the timer is set to 0 and starts counting. At full
count, it becomes 0 and remains 0 as long as its input is 0.
Input Low, the timer is set to 0 and resets.
TOFF timer
Input High, the timer is set to 1 and Loaded.
Input Low, starts counting. At full count, it becomes 0 and
remains 0 as long as its input is 0.
Ex31TOFFtimer
68
In this example:
Motor 1 needs a TOFF Timer.
Starts immediately with the
switch and turns off after a
delay when the switch is
off.
Motor 2 needs a TON Timer
(at turn-on) ORed with a TOFF
timer (at turn-off).
Starts after a delay with
the switch and turns off
after a delay when the
switch is off.
Motor 3 needs a TON Timer.
Starts after a delay with
the switch and turns off
immediately when the
switch is off.
69
Ex32ConveyerControlTOFF
70
One-Shot Timers
It is used to produce a fixed duration output from some
initiating input.
Ex33OneShotTimerEmulation
71
Example
Ex34OnWhenOutputTimerCeases
When there is an input to P1, M1 is energized. The timer does not start at this
point because the normally closed P1 contacts are open.
The closing of the M1 contacts means that the M2 is energized. There is,
however, no output from P40 at this stage because, NC P1 contacts are open.
When P1 ceases, both the internal relays remain energized and the timer is
started. They latch each other. Also P40 becomes on.
After the set time, the timer contacts, which are normally closed, open and switch
off M2. This in turn switches off M1. It also, in the bottom rung, switches off the
output P40.
Thus the output is off for the duration of the input, then being switched on for a
predetermined length of time.
72
Ex36TMR
73
Ex37DrillAlarmTMR
74
Ex38MONsimple
75
Ex39ChatteringPreventionTMON
Even if P0 is
chattering P41
remains on for
200 mSec
76
Ex40TRTGsimple
77
Ex41CConveyerFaultDetectionTRTG
78
7 Counters
79
Forms of Counters
A counter is set to some preset number value and,
when this value of input pulses has been received,
it will operate its contacts. Thus normally open
contacts would be closed, normally closed contacts
opened.
There are three types of counter
Down-counters CTD
Up-counters CTU
Up-Down counters CTUD
Ring counter CTR
80
Programming
When there is a pulse input
P1, the counter is reset.
When there is an input to P0,
the counter starts counting.
If at any time during the
counting there is an input to
P1, the counter will be reset
and start all over again.
Ex42CounterSimple
81
Counter Application
The machine directs 6 tins along one path for packaging in a box and then 12 tins along
another path for packaging in another box.
A pulse input to P02, resets both the counters (push button switch used to start the conveyor moving).
The input which is counted is P01 (a photocell sensor which detects the presence of tins passing
along the conveyor).
C0 starts counting after P02 is momentarily closed.
When C0 has counted six items, it closes its contacts and so gives an output at P40 (a solenoid
which is used to activate a deflector to deflect items into one box or another).
When C0 stops counting it closes its contacts and so allows C1 to start counting.
C1 counts for 12 pulses to P01 and then closes its contacts.
This results in both counters being reset and the entire process can repeat itself.
Ex43aCansCounter
82
83
Ex44CTUDsimple
84
Ex46ParkingLotCounter
85
Ex46A ParkingLotCounter
86
Ex47MotorControl
87
Sequencers
The PLC sequencer consists of a master
counter that has a range of presets counts
corresponding to the different steps.
Each step in the count sequence relates
to a certain output or group of outputs.
The outputs are internal relays, these in turn
being used to control the external output
devices.
88
Example
Ex48Sequencer
89
Ex48ATimeSequencer
90
Ex49CTRsimple
91
8 Shift Registers
The shift register is a number of
internal relays grouped together which
allow stored bits to be shifted from one
relay to another.
92
Shift Registers
A register is a number of internal relays grouped together,
normally 8, 16 or 32.
Each internal relay is either effectively open or closed,
these states being designated as 0 and 1. The term bit is
used for each such binary digit.
With the shift register it is possible to shift stored bits.
Shift registers require three inputs,
one to load data into the first location of the register,
one as the command to shift data along by one location and
one to reset or clear the register of data.
93
Ladder Programs
Example 1
Ex50ShiftRegister
94
Example
Ex51ShiftRegisterWWW
ANIMATED
95