0% found this document useful (0 votes)
13 views16 pages

Lec#04 Intro To PLC Software

The document discusses programming languages and components used in programmable logic controllers (PLCs), including ladder logic, function block diagrams, and structured text. It describes the basic elements of ladder logic including rungs, instructions, branches, and how to ensure logical continuity. It also covers input and output combinations like AND, OR, and interlaced inputs/outputs.

Uploaded by

mido AA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views16 pages

Lec#04 Intro To PLC Software

The document discusses programming languages and components used in programmable logic controllers (PLCs), including ladder logic, function block diagrams, and structured text. It describes the basic elements of ladder logic including rungs, instructions, branches, and how to ensure logical continuity. It also covers input and output combinations like AND, OR, and interlaced inputs/outputs.

Uploaded by

mido AA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

24/10/1445

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

Example: Ladder Logic


Ladder logic suited for relay or discrete applications:

Ladder Logic
Icon

Ladder Logic
Routine

Example: Function Block Diagrams


Function Block Diagrams (FBD) suited for continuous process and drives
control applications:

Function
Block Diagram
Icon

Function
Block Diagram
Routine

2
24/10/1445

Example: Sequential Function Charts


Sequential Function Charts (SFCs) suited for motion/batch applications:

Sequential
Function Chart
Icon

Sequential
Function Chart
Routine

Example: Structured Text


Structured Text suited for complex math or array applications or for programs
converted from other projects created in high-level languages like C:

Structured
Text Icon

Structured
Text Routine

3
24/10/1445

Ladder Logic Components


Ladder Logic: programming language that uses elements based on
symbols in electrical relay diagrams used by electricians:

Ladder Logic Components


Ladder logic uses basic elements:
• Rungs
• Instructions
• Branches
Instructions

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:

• Input Instructions: evaluate data in controller


• Output Instructions: set data in controller
Inputs
Output

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.

Input Output Input 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.

Parallel Branch Nested Branch

A branch must contain at least one instruction.

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:

If the condition for which an input Then the input instruction is . . .


instruction is examining . . .
Is detected True

Is NOT detected False

17

Example: Logical Continuity


Rung shows logical continuity because all input instruction values true:

True True True (enabled)

In the software, instructions are highlighted when they are true,


or enabled.

18

9
24/10/1445

Example: No Logical Continuity


Rung does not show logical continuity because second input instruction
does not detect correct value for bit:

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

AND logic requires inputs on the same level of the rung

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

AND with OR Logic


Selected for more complex evaluations.
Example: AND with OR Logic
The following rung uses both AND and OR logic:
• If instructions 1 AND 2 AND 3 are true, then output instruction X is true
OR
• If instructions 4 AND 3 are true, then output instruction X is true:

1 2 3 X

23

Interlaced Inputs and Outputs


In preceding examples, all input instructions were placed on the left of the
rung and all output instructions were placed on right.

Some controllers support interlaced inputs and outputs.


In this construction only input instructions to the left of an output must be
true for the output to be true:
• If instruction 1 is true then output X is true
• If instruction 1 is true and 2 is true then output Y is also true
1 X 2 Y

24

12
24/10/1445

Output Combinations
Combinations can be used with output instructions:

• Output can be unconditional


• Multiple outputs can be programmed on same rung
• Outputs can have separate input conditions
• State of output can be examined as input condition

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

Outputs that Require Separate Inputs


If outputs share common conditions, enter common conditions once.
Use a branch to place any additional condition(s).
Example:
Both outputs require instruction 1 AND 2 to be true; however,
path to output B also requires instruction 3 to be true.

1 2 A

3 B

28

14
24/10/1445

Examination of an Output State


State of output can be examined as condition of rung by using
conditional instruction with output's address:

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

Examination of an Output State


This type of "seal-in logic" is used often in programming. For example,
if a momentary push button is used to turn a motor on, the motor will
remain on even when the operator releases the pushbutton.

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

You might also like