Lec#04 Intro To PLC Software
Lec#04 Intro To PLC Software
Control Applications
M1452
Intro to PLC SW
Lec.#04
Omar Salim; Ph.D.
Department of Electrical Engineering
Benha Faculty of Engineering
Benha University
April 2024
1
Programming Languages
Multiple language options, users can program different portions of application
in most appropriate language:
• Instruction List (IL) or Statement List (STL)
• Ladder Logic
• Function Block Diagrams
• Sequential Function Charts
• Structured Text
The availability of these languages will depend on the vendor and the
options that have been selected.
1
24/10/1445
Ladder Logic
Icon
Ladder Logic
Routine
Function
Block Diagram
Icon
Function
Block Diagram
Routine
2
24/10/1445
Sequential
Function Chart
Icon
Sequential
Function Chart
Routine
Structured
Text Icon
Structured
Text Routine
3
24/10/1445
Rungs
Branch
4
24/10/1445
Rungs
Ladder logic instructions are organized on rungs that order steps in
reading process:
Rungs
When placing rungs, keep these key points in mind:
• Rungs are scanned from zero to highest number (top to bottom).
• Each rung read from left to right.
• Rungs cannot be empty.
• Last rung is END instruction.
▫ It contains no instructions.
Power rails (i.e., the vertical lines connecting the ends of the rungs) are
the right and left side of a rung. Power rails are highlighted when the
computer is online and the controller is scanning logic.
10
5
24/10/1445
Instructions
Commands defining operations/evaluations performed by controller:
Two types of instructions:
11
Instructions
Several rules for placing instructions on rungs:
• Rung does not need input instructions
▫ must contain at least one output instruction
Output Instruction
12
6
24/10/1445
Instructions
Several rules for placing instructions on rungs:
• Input and output instructions can be mixed on a rung.
• Last instruction on rung must be output instruction.
13
Branches
Used to create alternative path for reading inputs and outputs:
14
7
24/10/1445
Branches
Can have more than one level and can include two types:
• Parallel Branch: A branch that has the same start and end point as the
branch it is below.
• Nested Branch: A branch that starts and ends inside another branch.
15
Branches
When placing branches in ladder logic, keep these key points in mind:
• Branches read left to right, top to bottom
• Branch must start and end on same level
• Parallel branch same start and end point as branch below:
– Parallel branches evaluated faster than nested branches
• Nested branch starts and ends inside same branch
Parallel Branch Nested Branch
16
8
24/10/1445
Logical Continuity
Logical continuity: condition where ladder logic rung has path of true
instructions to output.
Every instruction assigned a tag/address.
Each input instruction looks at value of corresponding tag determine if
input instruction true or false:
17
18
9
24/10/1445
False
True False (inactive)
True Instruction
Highlighted
19
Input Combinations
Three possible input combinations used to determine logical
continuity:
• AND
• OR
• AND with OR
20
10
24/10/1445
AND Logic
Selected when all conditions must be true.
Example: AND Logic
Input instructions 1 AND 2 must be true for output X to be true:
1 2 X
21
OR Logic
Selected when any one condition will make an output true.
Example: OR Logic
Either instruction 1 OR instruction 2 must be true for output X to be
true:
1 X
22
11
24/10/1445
1 2 3 X
23
24
12
24/10/1445
Output Combinations
Combinations can be used with output instructions:
25
Unconditional Output
Requires no input instructions.
Example:
There are no conditions, so output A is always true:
A
26
13
24/10/1445
Multiple Outputs
Parallel branches can be used to program multiple outputs. Serial
outputs can also be used.
Example:
If input instruction 1 is true, both output A and B are true:
1 A
Example:
If input instruction 1 is true, both output A and B are true:
1 A B
27
1 2 A
3 B
28
14
24/10/1445
Example:
When 1 AND 2 true, rung is true. Once rung is true, it will
remain true until condition 2 goes false and breaks seal.
1 2 A
29
1 2 A
30
15
24/10/1445
31
References
Text Books:
• Devdas Shetty and Richard A. Kolk, ‘Mechatronics System Design,’
2nd Edition, 2011, Cengage Learning
• Frank D. Petruzella, “Programmable Logic Controllers”, 4th Edition,
McGraw-Hill 2011
Lecture Notes:
• Omar Salim, Ph.D. Lecture notes for Industrial Control Systems and
Fundamentals of Instrumentations and Process control.
31
16