Professional Documents
Culture Documents
The three most commonly used methods for programming PLCs are:
S1 S2 Y1
S3
STR S1
OR S2
AND S3
OUT Y1
S1
S2
Y1
S3
Ladder Diagram
S1 K1
K1 Y1
The ladder diagram is read from left to right and from top to bottom (this is also
how it is scanned by the PLC).
Each rung must start with one or more inputs and must end with one output.
Inputs are shown in their normal or rest position e.g. a n/o switch is shown open
in the ladder diagram.
The same input contact may appear in several rungs of the ladder.
All the inputs and outputs are identified in the ladder diagram by their addresses.
Ladder Symbols
Instruction Lists
Some smaller PLCs require that the program be entered by a hand-held device
using commands similar to instruction lists. Typical mnemonics for the logic
instructions are:
STR ST A or O
STR NOT ST/ AN or ON
AND AN A
AND NOT AN/ AN
OR OR O
OR NOT OR/ ON
OUT OT =
Logic Functions
The basic logic functions examined previously using relays will now be
considered using PLCs. Ladder diagrams and instruction lists for the following
logic functions are shown using symbols for the inputs and outputs instead of
I/O addresses:
S1 Y1
STR S1
OUT Y1
Identity function
S1 Y1
STR NOT S1
OUT Y1
NOT function
S1 Y1
STR S1
OR S2
S2 OUT Y1
OR function
S1 S2 Y1
STR S1
AND S2
OUT Y1
AND function
S1 Y1
STR NOT S1
S2 OR NOT S2
OUT Y1
NAND function
S1 S2 Y1 STR NOT S1
AND NOT S2
OUT Y1
NOR function
Latch
A PLC output may be latched or held on using a hold-on contact. The next
diagram shows the electrical circuit for indirect control of a solenoid using a
relay and its implementation as a ladder diagram. The relay is held on by the
hold-on contact K1 when S1 is pressed and the latch can be broken by pressing
S2. Note that in the ladder diagram the relay coil and contact K1 are not needed.
S1 S2 Y1
Y1
The previous ladder diagram for the latch is shown again together with a
modified version of the latching circuit. The instruction list for each of the
circuits has been added. An alternative version of the latching circuit is also
shown using a retentive coil with set (S) and reset (R) inputs.
S1 S2 Y1
STR S1
OR Y1
Y1 AND NOT S2
OUT Y1
Latch 1
S1 Y1
STR S1
OR ( Y1 AND
Y1 S2 NOT S2)
OUT Y1
Latch 2
S1 Y1
S STR S1
S2 Y1 SET Y1
STR S2
RST Y1
R
Set and Reset
Internal Relays
Internal relays (or internal coils) are bits or memory locations within the PLC
which behave like relays. These can be switched on and off in the ladder
diagram like normal relays but do not produce external outputs from the PLC.
They are assigned addresses like real outputs and may be used to indirectly
control external devices connected to the PLC.
S1 IR1
STR S1
OUT IR1
STR IR1
IR1 Y1 OUT Y1
Internal Relay
Timers
Most PLCs have delay-on timers and some also have delay-off timers. Examples
of both delay-on and delay-off timers with timing diagrams are shown. The
delay-on timer starts timing when switch S1 closes. After 10 seconds the timer
contact TMR1 closes switching on the output Y1. The timer resets when switch
S1 opens. With the delay-off timer the output switches on and the timer starts
timing when switch S1 closes. After 10 seconds the timer contact TMR1 opens
switching off the output Y1. The timer resets itself when the contact TMR1
opens.
S1 TMR1
STR S1
TMR1
10s
K 10
TMR1 Y1 STR TMR1
OUT Y1
Delay-on Timer
S1 TMR1 Y1
STR S1
OR Y1
AND NOT TMR1
Y1 TMR1 OUT Y1
TMR1
K 10
10s
Delay-off Timer
Counters
Most PLCs have up counters and some also have down counters. An example of
an up counter with timing diagram is shown. The counter counts up by one each
time switch S1 closes and reopens. When the count reaches five the contact
CNT1 closes and switches on output Y1. The counter is reset by closing switch
S2.
CNT1 5
S1
STR S1
S2 STR S2
CNT1
K 5
CNT1 Y1 STR CNT1
OUT Y1