Training on
(PROGRAMMABLE LOGIC
PLC
CONTROLLER)
Module 2: PLC Programming
Basics
Presented By
Belay E. (MSc. in
Mechatronics)
Biruk S. (MSc. in
Contents
2
Programming Languages of PLC
Ladder Logic
Logic Symbols
Ladder Logic for Basic gates
Latching
Safe and Unsafe Stop switches
Timers and Counter
3 January 2026
Programming Languages
3
of PLC
Most common languages encountered in
PLC programming are:
1) Ladder Logic (Commonly Used)
2) Functional Block Diagram
3) Sequential Function Chart
4) Boolean mnemonics
3 January 2026
Ladder Logic/Diagram
4
A Ladder diagram is a symbolic and
schematic representation of both the
process hardware and process control.
Its called a ‘Ladder’ because all the devices
are connected across the supply lines
making it look like a ladder.
Each parallel connection is called a ‘Rung’,
it can contain many inputs but only one
output.
3 January 2026
Logic Symbols
5
Normally Normally
Open Closed
Push button PB1 PB2
Switches
Limit Switches LS1 LS2
Temperature Limit TS1 TS2
Switches
Pressure Limit PS2
Switches
Level Limit LLS1 LLS2
Switches
On Delay Switches Delayed Delayed open
closed
Off Delay Switches
(Timer Contacts) 3 January 2026
OUTPUT DEVICES
Ladder Logic/Diagram
Contact Relay Normally closed
CR1
Normally Open
CR2
6
CR
1
Relay
R
Contactor
Motor
M1
Solenoid Valve SOV1
Indicating Lamp
R
Timer
TR
Counter Up Counter Down Counter
CT CT
R 3 January 2026
D
Physical or Relay Ladder
Example
7
RUNG
Condition Area Result Area
Active Supply Neutral Supply
3 January 2026
Ladder Logic
8
It is well suited to express combinational
logic.
The main ladder logic symbols represent
the elements:
Make contact
Break contact
Relay coil
3 January 2026
Ladder Logic for Basic
9 gates R Gate
AAND ORGate
Gate
Gate OR
A B Logic(Y) A B Logic(Y)
OFF OFF OFF
OFF OFF OFF
OFF ON ON
OFF ON OFF
ON OFF ON
ON OFF OFF
ON ON ON
ON ON ON
A
A
Y
A B Y
B
3 January 2026
Ladder Logic for Basic gate
10
NOR Gate NAND Gate
A B Logic(Y) A B Logic(Y)
OFF OFF ON OFF OFF ON
OFF ON OFF OFF ON ON
ON OFF OFF ON OFF ON
ON ON OFF ON ON OFF
B
A B Y Y
3 January 2026
Latching
11
• There are often situations where it is necessary
to hold an output energized, even when the
input ceases.
• A simple example of such a situation is a motor which
is started by pressing a push button switch. Though the
switch contacts do not remain closed, the motor is
required to continue running until a stop push button
switch is pressed.
• Latching is particularly useful for making a
momentary pushbutton switch perform as if it were
a maintained switch.
• The latch circuit is a self-maintaining circuit in that,
after being energized, it maintains that state until
another input is received. 3 January 2026
Latching Circuit with Start
12
Button
• The circuit shown can be
used to start a motor using
the Start push button.
• When Start is pressed,
the motor starts.
• When Start is released, the
holding contacts maintain
the circuit and hence the
power to the motor.
3 January 2026
• But How to stop the motor?
Latching Circuit with Start &
13
Stop Button
• To stop the motor, we add
another push button (Stop)
which is normally closed.
• When Stop button is pressed,
this disconnects the power to
the motor and the holding
contacts open. Thus when Stop
is released, there is no power
connected to the motor.
• In conclusion, we have a motor
which is started by Start and 3 January 2026
stopped by Stop push buttons.
Safe and Unsafe Stop
14 switches
To ensure
safety, stop
switches has
to be very
carefully
considered. (a) In the previous start-stop circuit, the
stop switch is unsafe
We have to
ensure that
the Stop
switch will
do its job
even when (b) A safe stop 3 January 2026
it fails. switch
Safe and Unsafe Stop
15 switches
• In electrical circuits, the "open" failures (open
switch contacts, broken wire connections, open
relay coils, blown fuses, etc.) are statistically more
likely to occur than any other type of failure.
• A stop switch is not safe if it is normally open and
has to be closed to give the stop action. Imagine
that the stop switch fails. It most likely fails open
(becomes open permanently). In this case, the
system cannot be stopped.
• A better arrangement is to program the stop switch
in the ladder program as open and use a stop switch
that is normally closed and operating opens it.
3 January 2026
Example 1
16
Water Level Control:
i. It’s a single point level control.
ii. When the Level is above set point the output pump
should be OFF
iii. When the Level is below set point the output pump
should be ON
Pump
Set Point
TANK
3 January 2026
Solution 1
17
The number of inputs are Pump ‘ON’
(X1), Pump ‘OFF’ (X2) and Level
Switch (X3)
The number of outputs; Y1
TheX1 conditions
X2 for inputs
X3 and
Y1
(Pump (Pump (Limit (Output)
outputs
ON)
are:
OFF) Switch)
High Low Low High
--- High --- Low
High Low High Low
3 January 2026
Solution 1
18
Supply Line
Neutral
X1 X2 R1
R1
R1 X3 Y1
Here relay R1 acts as a Latch.
3 January 2026
Timers and Counters
19
PLC timers and counters are internal instructions that
provide the same functions as hardware timers and
counters.
They activate or deactivate a device after a time
interval has expired or a count has reached a preset
value.
Timer and counter instructions are generally considered
internal outputs.
3 January 2026
Timers and Counters
20
Timers are used in applications to add a specific amount of
delay to an output in the program.
Counter instructions are used to count events, such as parts
passing on a conveyor belt.
Counters, along with timers, must have two values:
Preset value is the target number of ticks or counting numbers
that must be achieved before the timer or counter turns its output
ON.
Accumulated value is the current number of ticks (timer) or counts
(counter) that have elapsed during the timer or counter operation.
3 January 2026
Timers Instructions
21
3 January 2026
On-Delay Energize
22 Timer
An ON-delay energize timer (TON) output instruction
either provides time-delayed action or
measures the duration for which some event
occurs.
Once the rung has continuity, the timer begins
counting time-based intervals and counts down until
the accumulated time equals the preset time.
When these two values are equal, the timer
energizes the output and closes the timed-out
3 January 2026
On-Delay Energize
23 Timer
The timed contact can be
used throughout the program
as either a normally open or
normally closed contact.
If logic continuity is lost
before the timer times
out, the timer resets the
accumulated register to zero.
3 January 2026
Off-Delay Energize
24 Timer
An OFF-delay energize timer (TOF) output
instruction provides time-delayed action.
If the control line rung does not have
continuity, the timer begins counting
time-based intervals until the
accumulated time value equals the
programmed preset value.
3 January 2026
Off-Delay Energize
25 Timer
When these values are equal,
the timer energizes the output
and closes the timed-out contact
associated with the output.
If logic continuity occurs
before the timer times out,
the accumulated value
resets to zero.
3 January 2026
Counter Instructions
26
There are two basic types of counters: those that can count
up and those that can count down.
3 January 2026
Up Counter
27
An up counter (CTU) output instruction adds a count, in
increments of one, every time its referenced event occurs.
An up counter increases its accumulated value (the count
value in its accumulated register) each time the up-count
event makes an OFF-to-ON transition.
When the accumulated value reaches the preset value,
the counter turns ON the output, finishes the count, and
closes the contact associated with the referenced output.
3 January 2026
Down Counter
28
A down counter (CTD) output instruction decreases the count
value in its accumulated register by one every time a certain event
occurs.
Sometimes, a down counter is used in conjunction with an up
counter to form an up/ down counter, given that both counters have
the same reference registers.
For example, while an up counter counts the number of filled
bottles that pass a certain point, a down counter with the same
reference address can subtract one from the accumulated count
value every time it senses an empty or improperly filled bottle
3 January 2026
Counter Reset
29
A counter reset (CTR) output instruction resets
up counter and down counter accumulated
values to zero.
When programmed, a counter reset coil has the
same reference address as the corresponding
up/down counter coils.
If the counter reset rung condition is TRUE, the
reset instruction will clear the referenced address.
3 January 2026
Counter
30
• The counter will count up when
contact 10 closes, count down
when contact 11 closes, and
reset register 1003 to 0 when
contact 12 closes.
If the count is equal to 15 as a result of either an up or down count,
output 100 will be ON.
If contents of register 1003 are greater than 15, output 101 will be ON.
Output 102 will be ON if the accumulated count value is less than 15
3 January 2026
Tank Used to Mix Two
31 Liquids
MOTOR
A
FS FLOAT SWITCH
SOLENOIDS B
SOLENOID
C
TIMER
1 -MINUTE
3 January 2026
Tank Used to Mix Two
32 Liquids
A tank is used to mix two liquids. The control
circuit operates as follows:
1. When the start button is pressed, solenoids A
and B energize. This permits the two liquids to
begin filling the tank.
2. When the tank is filled, the float switch trips.
This de-energizes solenoids A and B and starts the
motor used to mix the liquids together.
3. The motor is permitted to run for one minute.
After one minute has elapsed, the motor turns off
3 January 2026
and solenoid C energizes to drain the tank.
Tank Used to Mix Two
33 Liquids
4. When the tank is empty, the float switch de-
energizes solenoid C.
5. A stop button can be used to stop the process at
any point.
6. If the motor becomes overloaded, the action of
the entire circuit will stop.
7. Once the circuit has been energized it will
continue to operate until it is manually stopped.
3 January 2026
Typical Block diagram of a PLC
34
Siemens
Logo!