ELE-601 Industrial Electronics
Lecture 4 – PLC Ladder Logic
Dr. Arslan Dawood Butt
CLO 1 - Section 2
LADDER DIAGRAM
A ladder diagram is a means of graphically
representing the logic required in a relay logic
system.
Rail
start emergency stop
PB1 PB2
R1
Rung R1
R1
A
PLC WIRING DIAGRAM
Input PLC Output
A
01 01 02 20 11 C
B 02 12
20
03
20 11
External
switches
Stored program
SCAN
• A PLC resolves the logic of a ladder diagram (program) rung
by rung, from the top to the bottom.
• Usually, all the outputs are updated based on the status of
the internal registers.
• Then the input states are checked, and the corresponding
input registers are updated.
• Only after the I/Os have been resolved, is the program then
executed. This process is run in an endless cycle.
• The time it takes to finish one cycle is called the scan time. In
some controllers the idle state is eliminated.
• In this case, the scan time varies depends on the program
length.
PLC Scan
Output
Input
begin
Idle
Scan cycle
Resolve
logic
PLC Ladder Diagram INSTRUCTIONS
1) Relay,
2) Timer and counter,
3) Program control,
4) Arithmetic,
5) Data manipulation,
6) Data transfer, and
7) Others, such as sequencers.
LOGIC STATES
• ON : TRUE, contact closure, energize, etc.
• OFF: FALSE, contact open , de-energize, etc.
Do not confuse the internal relay and program with the external switch
and relay. Internal symbols are used for programming.
External devices provide actual interface.
(In the slides we use the symbol "~" to represent negation. AND and OR are logic
operators. )
PROGRAMMING
Normally Open Normally Closed
(NO) (NC)
• Power flows through these contacts when they are closed.
• The normally open (NO) is true when the input or output status
bit controlling the contact is 1.
• The normally closed (NC) is true when the input or output
status bit controlling the contact is 0.
9
Coils
• Coils represent relays that are energized when power flows to
them.
• When a coil is energized it causes a corresponding output to
turn on by changing the state of the status bit controlling the
output to 1.
• That same output status bit maybe used to control normally
open or normally closed contact anywhere in the program.
10
Boxes
Boxes represent various instructions or functions that are
Executed when power flows to the box. Some of these
Functions are timers, counters and math operations.
11
AND OPERATION
A B C
Rung
• Each rung or network on a ladder program represents a logic
operation.
• In the rung above, both inputs A and B must be true (1) in
order for the output C to be true (1).
12
OR OPERATION
A C
Rung
In the rung above, it can be seen that either input A or B
is be true (1), or both are true, then the output C is true (1).
13
NOT OPERATION
A C
Rung
In the rung above, it can be seen that if input A is be true (1),
then the output C is true (0) or when A is (0), output C is 1.
AND and OR LOGIC
PB1 PB2 R1
R1 = PB1.AND.PB2
AND PB3 PB4
R2
R2 = PB3.AND.~PB4
PB1 R1
R1 = PB1 .OR. PB2
OR PB2
COMBINED AND & OR
R1 = PB1 .OR. (PB2 .AND. PB3)
PB1 R1
PB2 PB3
PROGRAMMING EXAMPLE 1
Bar code reader
microswitch Stopper
Part Conveyor
Robot
Machine
Operation
PLC WIRING DIAGRAM
Input
Output
MS1 R1
01 11
C1 02 12 R2
C2 R3
03 13
C3 R4
04 14
C4 Programmable
05 Controller 15
PLC
Operation
• Rung 1. If part arrives and no part is
stopped, trigger the bar code reader.
• Rung 2. If it is a right part, activate the
stopper.
• Rung 3. If the stopper is up, the machine is
not busy and the robot is not busy, load the
part onto the machine.
• Rung 4. If the task is completed and the
robot is not busy, unload the machine.
PLC Ladder
14 11
01
02 14
14 04 03 12
05 03 13
Sequential Function Chart
Action Qualifiers:
N non-stored, executes while the
step is active
R resets a store action
S sets an action active
L time limited action, terminates
after a given period
D time delayed action.
P a pulse action, executes once in a
step
SD stored and time delayed
DS time delayed and stored
SL stored and time limited
Sequential Function Chart
A Detailed Design Process
• A Detailed Design Process
1. Understand the process
2. Hardware/software selection
3. Develop ladder logic
4. Determine scan times and memory
requirements
Specifications
• OUTPUT-PORT POWER RATINGS
• Each output port should be capable of
supplying sufficient voltage and current to drive
the output peripheral connected to it.
• SCAN TIME
This is the speed at which the controller executes the
relay-ladder logic program. This variable is usually
specified as the scan time per 1000 logic nodes and
typically ranges from 1 to 200 milliseconds.
• MEMORY CAPACITY
The amount of memory required for a particular
application is related to the length of the program
and the complexity of the control system. Simple
applications having just a few relays do not require
significant amount of memory. Program length tend
to expand after the system have been used for a
while. It is advantageous to a acquire a controller
that has more memory than is presently needed.
PLC Status Indicators
• Power On
• Run Mode
• Programming Mode
• Fault
Troubleshooting
1. Look at the process
2. PLC status lights
HALT - something has stopped the CPU
RUN - the PLC thinks it is OK (and probably is)
ERROR - a physical problem has occurred with the PLC
3. Indicator lights on I/O cards and sensors
4. Consult the manuals or use software if available.
5. Use programming terminal / laptop.
List of items required when working with PLCs:
1. Programming Terminal - laptop or desktop PC.
2. PLC Software. PLC manufacturers have their own
specific software and license key.
3. Communication cable for connection from Laptop to
PLC.
4. Backup copy of the ladder program (on diskette,
CDROM, hard disk, flash memory). If none, upload it
from the PLC.
5. Documentation- (PLC manual, Software manual,
drawings, ladder program printout, and Seq. of
Operations manual.)
PLC Outputs & Power Supply
Communication
Ports (RS-485)
Inputs
PLC Internal Architecture
PLC Input/ Output
PLC Input Devices
Push buttons
Switches (limit switches, level switches,
etc.)
Sensors
PLC Output Devices
Relay contacts
Solenoid valves
Signal devices (such as lamps, alarms, etc.)
Motors
...
Programming terminal
Programming terminal
Programming is done through programming
terminal
Programming terminal translates engineering
language (logic control) to machine language
(binary code)
Programming through standard computer
Most PLC manufacturers offer software packages
that allow a standard computer to be used as a
programming terminal
Programming through standard computer
Relating the program to inputs and outputs
SWITCHES
Non-locking Locking
Normally Ope n Normally Clos e d
SPDT
P1
DPST
P2
Multiple Throw Multiple Pole
Bre ak-before -make Make -be fore -bre ak
TERMS
Throw - number of states
Pole - number of connecting moving parts (number of
individual circuits).
A serial switch box (A-B box) has
two 25 pin serial ports to switch from.
SPDT
A B
Output
DPST Input
Knob
How is this switch classified?
TYPES OF SWITCHES
RATING:
• Selector switches •24 Volts AC/DC
• Pushbutton switches •48 Volts AC/DC
• Photoelectric switches •120 Volts AC/DC
• Limit Switches •230 Volts AC/DC
• Proximity switches •TTL level
(Transistor-to-
• Level switches transistor
• Thumbwheel switches ±5V)
• Slide switches •Isolated Input
RELAYS
A switch whose operation is activated by an electromagnet is called a "relay"
contact
coil
input
Relay coil
R1
Output contact R1
Q&A
45