An introduction to PLC languages - Instruction Language (IL) , Functional Block Diagram (FBD) , Ladder Logic Diagram (LD) and Sequential Function Chart (SFC).
(Download and open with Adobe Reader to see animations)
2. Table of contents
1
Introduction
2
PLC programming languages
Instruction List Programming
Structured Text Programming
Functional Block Programming
Ladder Logic Programming
Sequential Function Chart
Liju G Chacko
PLC Programming Languages
2 / 25
3. Introduction
Introduction
PLC(Programmable logic controller) is a multiple
inputs and output digital computer used for
automation of electromechanical processes.
These are the processes normally a PLC will carry
out during one cycle.
Step 1-: Self diagnosis.
Step 2-: Read inputs and store values.
Step 3-: Process logics/instructions.
Step 4-: Write outputs
(Above four steps are repeated again and again)
PLCs are programmed using application a software on personal
computers. From computer, binary or pseudocode will be
downloaded to PLC through Ethernet, RS-232, RS-485 or
RS-422 cable.
Liju G Chacko
PLC Programming Languages
3 / 25
4. PLC programming languages
PLC programming languages
PLC Programming languages mentioned in IEC
61131-3
Instruction List Programming
Structured Text Programming
Functional Block Programming
Ladder Logic Programming
Sequential Function Charts
Liju G Chacko
PLC Programming Languages
4 / 25
5. PLC programming languages
Instruction List Programming
Instruction List(IL) Programming
Allen Bradley supports IL programming only on the
Micrologix 1000,
IL is similar to mnemonic programming languages
IL make use of an important concept – STACK
IL instructions(Allen Bradley version)
LD A- Store A to stack
LD A- Put A back to memory
ORB - ’OR’ the last two variables in stack
ANB - ’AND’ the last two variables in stack
Liju G Chacko
PLC Programming Languages
5 / 25
7. PLC programming languages
Structured Text Programming
Structured Text Programming
Similar to high level language, such as Basic or C
ExampleAverage of 5 numbers
F8:10 := 0;
WHILE (N7:0 < 5) DO
F8:10 := F8:10 + F8:[N7:0];
N7:0 := N7:0 + 1;
END_WHILE;
Liju G Chacko
PLC Programming Languages
7 / 25
8. PLC programming languages
Structured Text Programming
Structured Text(ST) Programming
Structures in ST Language
Structures
Explanation
IF-THEN-ELSIF-ELSE-END IF normal if-then structure
CASE-value:-ELSE-END CASE a case switching function
FOR-TO-BY-DO-END FOR
for-next loop
WHILE-DO-END WHILE
while loop
TAN(A), COS(A), A**B,,. . .
Basic math functions
Liju G Chacko
PLC Programming Languages
8 / 25
9. PLC programming languages
Functional Block Programming
Functional Block Programming
It is a graphical dataflow programming method
Liju G Chacko
PLC Programming Languages
9 / 25
10. PLC programming languages
Ladder Logic Programming
Ladder Logic Programming
It is a graphical programming language evolved from
electrical relay circuit
Each program statement is a line called the rung
with inputs to the left and the output to the
right.Execution starts from the top rung, down to
the last rung.
Liju G Chacko
PLC Programming Languages
10 / 25
11. PLC programming languages
Ladder Logic Programming
Ladder Logic Programming
Types of contact inputs
Examine if close
Examine if open
Positive transition sense
Negative transition sense
Liju G Chacko
PLC Programming Languages
11 / 25
12. PLC programming languages
Ladder Logic Programming
Ladder Logic Programming
Types of relay outputs
Output energized
Negative output energized
Output latch/set
Output unlatch/unset
Liju G Chacko
PLC Programming Languages
12 / 25
13. PLC programming languages
Ladder Logic Programming
Ladder Logic Programming
Function Blocks
On Delay Timer
Liju G Chacko
Off Delay Timer
PLC Programming Languages
13 / 25
14. PLC programming languages
Sequential Function Chart
SEQUENTIAL FUNCTION CHART
Sequential Function Charts (SFCs) are a graphical
technique for writing concurrent control programs
SFC is based on GRAFCET (GRAphe Fonctionnel
de Commande Etapses/Transitions) [itself based on
binary petri nets]
Main components of SFC are:
Steps with associated actions
Transitions with associated logic conditions
Directed links between steps and transitions
Liju G Chacko
PLC Programming Languages
14 / 25
17. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Macrostep(subroutines)
Liju G Chacko
PLC Programming Languages
17 / 25
18. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Concurrent control flow (two or more loops running in
parallel)
Liju G Chacko
PLC Programming Languages
18 / 25
19. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Action Block
Actions can be written in Ladder Logic, Instruction language or
structured text language. Action block is not a part of a Step. Step
just activates or deactivates the action block depending on the
qualifier, as long the step itself is active
eg;- Action 1
Liju G Chacko
PLC Programming Languages
19 / 25
20. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Action Qualifiers
Non-store(N)
Action is executed as long as the step is active
Set(S)
The action starts execution as soon as the step is active,
continues till R qualifier is executed .
Liju G Chacko
PLC Programming Languages
20 / 25
21. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Action Qualifiers(Continue...)
Overriding(R)
The action started by S, SD, DS, and SL qualifiers are
aborted by R qualifier.
Liju G Chacko
PLC Programming Languages
21 / 25
22. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Action Qualifiers(Continue...)
QUALIFIER
-NoneN
R
S
L
D
P
SD
DS
SL
P1
P0
Liju G Chacko
EXPLANATION
Non-stored(null qualifier)
Non-stored
Overriding reset
Set(stored)
time limited
timer delayed
pulse
stored and time delayed
delay and stored
stored andtime limited
Pulse(rising edge)
pulse(falling edge)
PLC Programming Languages
22 / 25
23. PLC programming languages
Sequential Function Chart
Sequencial Function Chart
Important rules for SFC evolution[IEC 61131-3]
1
Evolution of active states of steps shall take place
along the directed links.(i.e, transition from one step
to another should take place along the connected
lines only )
2
The clearing time of transitions(transition condition)
should be as short as possible. Clear the transition
condition as soon as the next step is activated.
Liju G Chacko
PLC Programming Languages
23 / 25
24. PLC programming languages
Sequential Function Chart
References
[1] IEC 61131
[2] Automated Manufacturing Systems PLCs, by Hugh
Jack
[3] http://en.wikipedia.org/wiki/
Programmable logic controller
Liju G Chacko
PLC Programming Languages
24 / 25