Professional Documents
Culture Documents
1. Introduction:
The IEC 61131 standard is applicable for the programmable logic controllers (PLC).
In accordance with the rules of the European Union, this international standard has been
accepted in Germany as DIN EN 61131, in France as NF EN 61131, and in Britain as BS EN
61131.
The most important parts of the standard are quoted below. Quotes are in italics.
Part 3 of this standard defines the "Area of application" in Section 1.
" This Part of IEC 61131 specifies syntax and semantics of programming languages for
programmable controllers as defined in Part 1 of this Standard.
The functions of program entry, testing, monitoring, operating system, etc., are specified in Part
1.
This part of IEC 61131 specifies the syntax and semantics of a unified suite of programming
languages for PLCs. These consist of textual languages, IL (Instruction List) and ST (Structured
Text), and two graphical languages, LD (Ladder Diagram) and FBD (Function Block Diagram).
Sequential Function Chart (SFC) elements are defined for structuring the internal organization of
programmable controller programs and function blocks. Also, configuration elements are defined
which support the installation of programmable controller programs into programmable controller
systems...."
The programming language elements defined in this part may be used in an interactive
programming environment. The specification of such environments is beyond the scope of this
standard; however, such an environment shall be capable of producing textual or graphic
program documentation in the formats specified in this part.
Section 5 "Standards compliance" specifies:
"A programmable controller system, as defined in IEC 61131-1, which claims to comply, wholly
or partially, with the requirements of this Part of IEC 61131 shall do so only as described below:
"
Section 5.3 "Compliance declaration of the manufacturer" specifies:
"The manufacturer may define any consistent subset of characteristics that are listed in the characteristic
tables, and must make known the available subset in the "Compliance declaration of the manufacturer".
The compliance declaration of the manufacturer must be contained in the documentation that is included
with the system, or it must be generated by the system itself.
The format of the compliance declaration of the manufacturer must provide the following information.
Figure 4 shows an example.
The general information shall include the name and address of the manufacturer, the name and
version of the product, the type and version of the controller and the revision date.
The number of the corresponding characteristics table, the characteristics number and the applicable
programming language must be specified for each implemented characteristic.
The title and subtitle of the characteristics table, the description of the characteristic, examples,
manufacturers remarks etc. are optional.
Instruction List
AWL/STL
Ladder Logic
KOP/LAD
Function Block Diagram
FUP/FBD
"FUP/FBD")
Structured Control Language (SCL)
S7-GRAPH
Compliantly
implemented
in the language ()
Implementers
note
LD
FBD
IL
ST
2a
a, b, c
2b
Number sign:
See Table 5
2c
Dollar sign:
See Table 6
Table 2 - Identifiers
1
IW215
Table 3 - Comments
1
2a
Table 4 - Pragma
1
In source files
for blocks
Integer literal
-12
Real literal
-12.0
1.34E-12
Binary literal
2#1111_1111
Octal literals
8#377
Hexadecimal literal
16#FF
Typed literal
INT#-123
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
1b
1c
1d
1e
1f
1g
Possible using
feature 1g
Typed string
3b
Typed character
Dollar sign
Single quote
Line feed
Newline
Carriage return
Tabulator
Double quote
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
1b
1c
1d
1e
ms
short prefix
2b
long prefix
short prefix
3b
long prefix
Date literal
(long prefix)
1b
Date literal
(short prefix)
2a
(long prefix)
2b
(short prefix)
3a
(long prefix)
3b
(short prefix)
4a
(short prefix)
4b
(long prefix)
5a
(long prefix)
5b
(short prefix)
6a
6b
Boolean
BOOL
Short integer
SINT
Integer
INT
Double integer
DINT
Long integer
LINT
USINT
Unsigned integer
UINT
ULINT
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
10
Real numbers
REAL
11
Long reals
LREAL
12a
Duration
TIME
12b
Long duration
LTIME
13a
Date (only)
DATE
14a
TIME_OF_DAY or TOD
14b
LTIME_OF_DAY or LTOD
15a
DATE_AND_TIME or DT
15b
16a
17a
Single-byte character
CHAR
18
BYTE
19
WORD
20
DWORD
21
LWORD
STRING
6b
Array
Array
Global constants
Input location
Output location
Memory location
Size
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
4a
4b
None
%QX7.5
Addressing
10
BYTE bit
VB2.%X0
1b
WORD bit
VW3.%X15
1c
DWORD - bit
1d
LWORD - bit
2a
WORD byte
2b
DWORD - byte
2c
LWORD - byte
3a
DWORD - word
3b
LWORD - word
VW4.%B0
Depends on the
used function
Usage of EN only
Depends on the
used function
Depends on the
used function
Void used to
define
(without ENO)
4
Without result
FUNCTION ... END_FUNCTION
1b
With result
FUNCTION <name> : <data type>
END _FUNCTION
2a
Inputs
VAR_INPUT...END_VAR
2b
Outputs
VAR_OUTPUT...END_VAR
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
2c
In-outs
VAR_IN_OUT...END_VAR
2d
Temporary variables
VAR_TEMP...END_VAR
Graphical representation
Void used to
define
Overloaded function
ADD (ANY_Num to ANY_Num)
1a
2a
Typed functions:
ADD_INT
2b
Conversion:
WORD_TO_INT
Using the
correct function
is supported by
the editor
Typed conversion
input_TO_output
2a c
2b c
Typed truncation
input_TRUNC_output
3a d
Typed
input_BCD_TO_output
Convert of
BCD16 and
BCD32
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
10
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
81
82
83
84
85
86
87
88
89
90
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
11
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
12
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
13
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
68
69
70
71
72
73
74
75
76
LDT _TO_ DT
DT _TO_ LDT
DT _TO_ DATE
DT _TO_ LTOD
10
DT _TO_ TOD
11
12
ABS(x)
SQRT(x)
Logarithmic functions
3
LN(x)
LOG(x)
EXP(x)
Trigonometric functions
14
SIN(x)
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
COS(x)
TAN(x)
ASIN(x)
10
ACOS(x)
11
ATAN(x)
Addition
Multiplication
Subtraction
Division
Modulo
Exponentiation
Move
Shift left
SHL
Shift right
SHR
Rotation left
ROL
Rotation right
ROR
And (&)
Or (>=1)
Exclusive Or
Not
Move
(assignment)
MOVE
Binary selection
SEL
Extensible
maximum function
MAX
Extensible
minimum function
MIN
Limiter
LIMIT
Extensible multiplexer
MUX
15
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
Decreasing sequence
GT
>
Monotonic sequence
GE
>=
Equality
EQ
Monotonic sequence
LE
<=
Increasing sequence
LT
<
Inequality
NE
<>
String length
LEN
Left
LEFT
Right
RIGHT
Middle
MID
Extensible
concatenation
CONCAT
Insert
INSERT
Delete
DELETE
Replace
REPLACE
Find
FIND
16
1a
ADD
1b
ADD_TIME
1c
ADD_LTIME
2a
ADD
2b
ADD_TOD_TIME
2c
ADD_LTOD_LTIME
3a
ADD
3b
ADD_DT_TIME
3c
ADD_LDT_LTIME
4a
SUB
4b
SUB_TIME
4c
SUB_LTIME
5a
SUB
5b
SUB_DATE_DATE
5c
SUB_LDATE_LDATE
6a
SUB
6b
SUB_TOD_TIME
Compliantly
implemented
in the language ()
LD
FBD
6c
SUB_LTOD_LTIME
7a
SUB
7b
SUB_TOD_TOD
7c
SUB_TOD_TOD
8a
SUB
8b
SUB_DT_TIME
8c
SUB_LDT_LTIME
9a
SUB
9c
SUB_LDT_LDT
IL
Implementers
note
ST
10a
MUL
11a
DIV
CONCAT_DATE_TOD
1b
CONCAT_DATE_LTOD
2a
Declaration of inputs
VAR_INPUT ... END_VAR
2b
Declaration of outputs
VAR_OUTPUT ... END_VAR
2c
Declaration of in-outs
VAR_IN_OUT ... END_VAR
2d
2e
3a
Initialization of inputs
3b
Initialization of outputs
3c
See table 18
4a
4b
4c
4d
17
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
4e
4f
Declaration of FB instance(s)
Graphical call
6a
6b
8a
2a
18
Compliantly
implemented
in the language ()
LD
FBD
ST
IL
Implementers
note
1b
CTU_DINT
1c
CTU_LINT
1d
CTU_UDINT
1e
Down-counters
2a
2b
CTD_DINT
2c
CTD_LINT
2d
CTD_UDINT
19
Compliantly
implemented
in the language ()
2e
CTD_ULINT
Implementers
note
LD
FBD
IL
ST
Up-down counters
3a
3b
CTUD_DINT
3c
CTUD_LINT
3d
CTUD_UDINT
3e
CTUD_ULINT
Pulse, overloaded
TP
1b
1c
2a
On-delay, overloaded
2b
TON
2c
2d
On-delay, overloaded
(Graphical)
3a
Off-delay, overloaded
TOF
3b
3c
1b
3a
3b
20
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
Non-stored
overriding Reset
Set (Stored)
time Limited
time Delayed
Single sequence
Divergence of sequence
with left to right priority
Convergence of sequence
4a
Simultaneous divergence
after a single transition
4b
Simultaneous divergence
after conversion
4c
Simultaneous convergence
before one transition
4d
Simultaneous convergence
before a sequence selection
5a,b,c
Sequence skip
6a, b,
Sequence loop
1
2a
21
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
c
7
Directional arrows
CONFIGURATION...END_CONFIGURATION
RESOURCE...ON ...END_RESOURCE
5a
Periodic TASK
5b
Non-periodic TASK
VAR_GLOBAL
>> Definition as
PLC tag
In STEP 7, tasks
are implemented
as organization
blocks (OB)
Table 41 Task
In STEP 7, tasks
are implemented
as organization
Graphical representation of
periodic TASKs (with INTERVAL)
2b
Graphical representation of
non-periodic TASK (with SINGLE)
Identifier
(parameter
list)
Parentheses
Dereference
Negation
Unary Plus
Complement
NOT
Exponentiation b
**
Multiply
Divide
10
Modulo
MOD
11
Add
12
Subtract
13
Comparison
14
Equality
15
Inequality
<>
16a
Boolean AND
&
22
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
16b
Boolean AND
AND
17
Boolean Exclusive OR
XOR
18
Boolean OR
OR
1a
1b
1c
Call
2a
Function call
2b
RETURN
Selection
4
IF ...
THEN ...
ELSIF ...
THEN ...
ELSE ...END_IF
5
CASE ... OF
...
ELSE ...
END_CASE
Iteration
6
...
END_FOR
7
WHILE ... DO
...
END_WHILE
8
REPEAT ...
UNTIL ...
END_REPEAT
CONTINUE
10
EXIT an iteration
11
Empty Statement
23
Compliantly
implemented
in the language ()
LD
FBD
IL
Implementers
note
ST
Unconditional
jump
1a
FBD language
1---->>LABELA
1b
LD language
|
+---->>LABELA
|
Conditional jump
2a
FBD language
Example:
jump condition, jump target
X---->>LABELB
+---+
bvar0---| & |--->>NEXT
bvar50--|
|
+---+
NEXT:
+---+
bvar5---|>=1|---bOut0
bvar60--|
|
+---+
2b
LD language
Example:
jump condition, jump target
| X
+-| |---->>LABELB
|
|
|
bvar0
bvar50
+---| |-----| |--->>NEXT
|
|
NEXT:
|
bvar5
bOut0 |
+----| |----+----( )---+
|
bvar60 |
|
+----| |----+
|
|
|
Conditional return
3a
LD language
|
X
+--| |---<RETURN>
|
3b
FBD language
X---<RETURN>
Unconditional
return
4
LD language
|
+---<RETURN>
|
24
|
+--|
Compliantly
implemented
in the language ()
LD
3
Horizontal link
Vertical link
(with attached horizontal links)
-----------
|
----+-------+
|
+----
FBD
IL
Implementers
note
ST
Table 46 Contacts
Static contacts
1
***
--| |--
***
--|/|--
***
--|P|--
Transition-sensing contacts
3
5a
***
--|N|--
Table 47 Coils
1
Coil
***
--( )
Negated coil
***
--(/)
Latched coils
3
***
--(S)
***
--(R)
Transition-sensing coils
8
***
--(P)
***
--(N)
25