IEC 61131-3:2003
(Main)Programmable controllers - Part 3: Programming languages
Programmable controllers - Part 3: Programming languages
IEC 61131-3:2003 specifies syntax and semantics of programming languages for programmable controllers as defined in part 1 of IEC 61131. This second edition of IEC 61131-3 cancels and replaces the first edition, published in 1993, and constitutes a technical revision. This bilingual version (2015-06) corresponds to the English version, published in 2003-01.
Automates programmables - Partie 3: Langages de programmation
L'IEC 61131-3:2003 spécifie la syntaxe et la sémantique des langages de programmation utilisés pour les automates programmables tels que définis dans la Partie 1 de la CEI 61131. Cette seconde édition de la CEI 61131-3 annule et remplace la première édition publiée en 1993, dont elle constitue une révision technique. La présente version bilingue (2015-06) correspond à la version anglaise monolingue publiée en 2003-01.
General Information
- Status
- Published
- Publication Date
- 20-Jan-2003
- Technical Committee
- SC 65B - Measurement and control devices
- Drafting Committee
- WG 7 - TC 65/SC 65B/WG 7
- Current Stage
- DELPUB - Deleted Publication
- Start Date
- 20-Feb-2013
- Completion Date
- 26-Oct-2025
Relations
- Effective Date
- 05-Sep-2023
- Effective Date
- 05-Sep-2023
Overview
IEC 61131-3:2003 - "Programmable controllers - Part 3: Programming languages" - is the international standard that specifies the syntax and semantics of programming languages for programmable controllers (PLCs) as defined in Part 1. This second edition (2003) replaces the 1993 edition and provides a vendor-neutral, structured model for PLC software: software, communication and programming models, data types, variables, program organization, and language semantics. (A bilingual 2015 version corresponds to the 2003 English edition.)
Key topics and technical requirements
- Programming languages: Formal definitions for the five standard PLC languages - Instruction List (IL), Structured Text (ST), Ladder Diagram (LD), Function Block Diagram (FBD), and Sequential Function Chart (SFC) - including syntax and semantics.
- Software and communication models: Standardized models for how controller software components interact and exchange data.
- Programming model and program organization units: Definitions and rules for functions, function blocks, programs, and how they are declared, initialized and executed.
- Data types and variables: Elementary, generic and derived data types, multi-element variables (arrays, structures), initialization, type assignment and conversion rules.
- Control and execution: Tasking, resource and configuration elements, evaluation order, and SFC evolution rules for sequential control.
- Standard functions and blocks: Core library behavior (timers, counters, edge detection, numerical and string functions) and rules for overloading and type conversion.
- Compliance requirements: Clauses for system compliance and program compliance to ensure consistent behavior across tools and devices.
- Formal language specification: Annexes provide textual syntax and semantic specification methods for tool implementers.
Applications and practical value
- Enables consistent, portable PLC programs across vendors and tools, reducing rework and vendor lock-in.
- Useful for designing, documenting and validating industrial control software in manufacturing, process industries, building automation and robotics.
- Provides a clear basis for tool vendors (IDE, compiler, simulator) to implement compliant editors, compilers and debuggers.
- Supports system integration, quality assurance, and maintenance by standardizing program structure, data typing and execution semantics.
Who should use this standard
- Automation engineers, PLC programmers, control system architects
- System integrators and OEMs developing controller-based equipment
- Software/tool vendors creating PLC development environments
- QA, validation and compliance teams in industrial automation
Related standards
- IEC 61131-1 (general definitions and architecture - referenced by Part 3)
- IEC 61131-2 (equipment requirements and tests)
- Other IEC automation and safety standards for complementary system-level requirements
Keywords: IEC 61131-3, IEC 61131-3:2003, PLC programming, programmable controllers, Structured Text, Ladder Diagram, Function Block Diagram, Instruction List, Sequential Function Chart, industrial automation.
IEC 61131-3:2003 - Programmable controllers - Part 3: Programming languages Released:1/21/2003 Isbn:2831866537
IEC 61131-3:2003 - Programmable controllers - Part 3: Programming languages Released:1/21/2003 Isbn:9782832226162
Frequently Asked Questions
IEC 61131-3:2003 is a standard published by the International Electrotechnical Commission (IEC). Its full title is "Programmable controllers - Part 3: Programming languages". This standard covers: IEC 61131-3:2003 specifies syntax and semantics of programming languages for programmable controllers as defined in part 1 of IEC 61131. This second edition of IEC 61131-3 cancels and replaces the first edition, published in 1993, and constitutes a technical revision. This bilingual version (2015-06) corresponds to the English version, published in 2003-01.
IEC 61131-3:2003 specifies syntax and semantics of programming languages for programmable controllers as defined in part 1 of IEC 61131. This second edition of IEC 61131-3 cancels and replaces the first edition, published in 1993, and constitutes a technical revision. This bilingual version (2015-06) corresponds to the English version, published in 2003-01.
IEC 61131-3:2003 is classified under the following ICS (International Classification for Standards) categories: 25.040.40 - Industrial process measurement and control; 35.240.50 - IT applications in industry. The ICS classification helps identify the subject area and facilitates finding related standards.
IEC 61131-3:2003 has the following relationships with other standards: It is inter standard links to IEC 61131-3:2013, IEC 61131-3:1993. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.
You can purchase IEC 61131-3:2003 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of IEC standards.
Standards Content (Sample)
IEC 61131-3
Edition 2.0 2003-01
INTERNATIONAL
STANDARD
Programmable controllers –
Part 3: Programming languages
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form
or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from
either IEC or IEC's member National Committee in the country of the requester.
If you have any questions about IEC copyright or have an enquiry about obtaining additional rights to this publication,
please contact the address below or your local IEC member National Committee for further information.
IEC Central Office
3, rue de Varembé
CH-1211 Geneva 20
Switzerland
Email: inmail@iec.ch
Web: www.iec.ch
About the IEC
The International Electrotechnical Commission (IEC) is the leading global organization that prepares and publishes
International Standards for all electrical, electronic and related technologies.
About IEC publications
The technical content of IEC publications is kept under constant review by the IEC. Please make sure that you have the
latest edition, a corrigenda or an amendment might have been published.
ƒ Catalogue of IEC publications: www.iec.ch/searchpub
The IEC on-line Catalogue enables you to search by a variety of criteria (reference number, text, technical committee,…).
It also gives information on projects, withdrawn and replaced publications.
ƒ IEC Just Published: www.iec.ch/online_news/justpub
Stay up to date on all new IEC publications. Just Published details twice a month all new publications released. Available
on-line and also by email.
ƒ Electropedia: www.electropedia.org
The world's leading online dictionary of electronic and electrical terms containing more than 20 000 terms and definitions
in English and French, with equivalent terms in additional languages. Also known as the International Electrotechnical
Vocabulary online.
ƒ Customer Service Centre: www.iec.ch/webstore/custserv
If you wish to give us your feedback on this publication or need further assistance, please visit the Customer Service
Centre FAQ or contact us:
Email: csc@iec.ch
Tel.: +41 22 919 02 11
Fax: +41 22 919 03 00
IEC 61131-3 ®
Edition 2.0 2003-01
INTERNATIONAL
STANDARD
Programmable controllers –
Part 2: Equipment requirements and tests
INTERNATIONAL
ELECTROTECHNICAL
COMMISSION
COMMISSION
ELECTROTECHNIQUE
PRICE CODE
INTERNATIONALE
XH
CODE PRIX
ICS 25.040; 35.240.50 ISBN 2-8318-6653-7
– 2 – 61131-3 IEC:2003(E)
CONTENTS
FOREWORD .8
1 General.9
1.1 Scope.9
1.2 Normative references .9
1.3 Definitions.9
1.4 Overview and general requirements .14
1.4.1 Software model.14
1.4.2 Communication model.16
1.4.3 Programming model .18
1.5 Compliance.19
1.5.1 System compliance .20
1.5.2 Program compliance.22
2 Common elements .23
2.1 Use of printed characters .23
2.1.1 Character set .23
2.1.2 Identifiers .23
2.1.3 Keywords.24
2.1.4 Use of white space .24
2.1.5 Comments .24
2.1.6 Pragmas .25
2.2 External representation of data .25
2.2.1 Numeric literals.25
2.2.2 Character string literals .26
2.2.3 Time literals .28
2.2.3.1 Duration .28
2.2.3.2 Time of day and date.29
2.3 Data types .29
2.3.1 Elementary data types.30
2.3.2 Generic data types .31
2.3.3 Derived data types.32
2.3.3.1 Declaration .32
2.3.3.2 Initialization.33
2.3.3.3 Usage .35
2.4 Variables.36
2.4.1 Representation .36
2.4.1.1 Single-element variables .36
2.4.1.2 Multi-element variables .38
2.4.2 Initialization.38
2.4.3 Declaration .39
2.4.3.1 Type assignment .41
2.4.3.2 Initial value assignment.42
2.5 Program organization units .45
2.5.1 Functions .45
2.5.1.1 Representation .46
2.5.1.2 Execution control.49
2.5.1.3 Declaration .50
2.5.1.4 Typing, overloading, and type conversion.52
2.5.1.5 Standard functions.55
2.5.1.5.1 Type conversion functions.55
2.5.1.5.2 Numerical functions.56
2.5.1.5.3 Bit string functions .59
2.5.1.5.4 Selection and comparison functions.59
2.5.1.5.5 Character string functions .62
2.5.1.5.6 Functions of time data types .64
2.5.1.5.7 Functions of enumerated data types.66
61131-3 IEC:2003(E) – 3 –
2.5.2 Function blocks.66
2.5.2.1 Representation .67
2.5.2.1a) Use of EN and ENO in function blocks .68
2.5.2.2 Declaration .69
2.5.2.3 Standard function blocks.77
2.5.2.3.1 Bistable elements .77
2.5.2.3.2 Edge detection.78
2.5.2.3.3 Counters .78
2.5.2.3.4 Timers.81
2.5.2.3.5 Communication function blocks.83
2.5.3 Programs.83
2.6 Sequential Function Chart (SFC) elements.84
2.6.1 General.84
2.6.2 Steps.84
2.6.3 Transitions .86
2.6.4 Actions.89
2.6.4.1 Declaration .89
2.6.4.2 Association with steps .91
2.6.4.3 Action blocks .92
2.6.4.4 Action qualifiers .93
2.6.4.5 Action control.94
2.6.5 Rules of evolution.99
2.6.6 Compatibility of SFC elements.107
2.6.7 SFC Compliance requirements .108
2.7 Configuration elements.108
2.7.1 Configurations, resources, and access paths .110
2.7.2 Tasks .114
3 Textual languages .123
3.1 Common elements .123
3.2 Instruction list (IL) .123
3.2.1 Instructions .123
3.2.2 Operators, modifiers and operands.124
3.2.3 Functions and function blocks.126
3.3 Structured Text (ST).129
3.3.1 Expressions .129
3.3.2 Statements .131
3.3.2.1 Assignment statements .133
3.3.2.2 Function and function block control statements .133
3.3.2.3 Selection statements .133
3.3.2.4 Iteration statements.134
4 Graphic languages .135
4.1 Common elements .135
4.1.1 Representation of lines and blocks .135
4.1.2 Direction of flow in networks.135
4.1.3 Evaluation of networks .136
4.1.4 Execution control elements .138
4.2 Ladder diagram (LD) .139
4.2.1 Power rails.139
4.2.2 Link elements and states.139
4.2.3 Contacts .140
4.2.4 Coils.140
4.2.5 Functions and function blocks.140
4.2.6 Order of network evaluation .141
4.3 Function Block Diagram (FBD).143
4.3.1 General.143
4.3.2 Combination of elements.143
4.3.3 Order of network evaluation .143
– 4 – 61131-3 IEC:2003(E)
ANNEX A (normative) Specification method for textual languages .144
A.1 Syntax .144
A.1.1 Terminal symbols.144
A.1.2 Non-terminal symbols .144
A.1.3 Production rules .145
A.2 Semantics .145
ANNEX B (normative) Formal specifications of language elements.146
B.0 Programming model.146
B.1 Common elements.146
B.1.1 Letters, digits and identifiers .146
B.1.2 Constants .147
B.1.2.1 Numeric literals .147
B.1.2.2 Character strings.147
B.1.2.3 Time literals.148
B.1.2.3.1 Duration.148
B.1.2.3.2 Time of day and date .148
B.1.3 Data types .149
B.1.3.1 Elementary data types .149
B.1.3.2 Generic data types.149
B.1.3.3 Derived data types .149
B.1.4 Variables .151
B.1.4.1 Directly represented variables .151
B.1.4.2 Multi-element variables .151
B.1.4.3 Declaration and initialization .152
B.1.5 Program organization units .154
B.1.5.1 Functions.154
B.1.5.2 Function blocks .155
B.1.5.3 Programs.156
B.1.6 Sequential function chart elements.156
B.1.7 Configuration elements .157
B.2 Language IL (Instruction List) .159
B.2.1 Instructions and operands.159
B.2.2 Operators .159
B.3 Language ST (Structured Text) .160
B.3.1 Expressions.160
B.3.2 Statements .160
B.3.2.1 Assignment statements.161
B.3.2.2 Subprogram control statements.161
B.3.2.3 Selection statements.161
B.3.2.4 Iteration statements.161
ANNEX C (normative) Delimiters and keywords.162
ANNEX D (normative) Implementation-dependent parameters.165
ANNEX E (normative) Error conditions .167
ANNEX F (informative) Examples .169
F.1 Function WEIGH .169
F.2 Function block CMD_MONITOR.170
F.3 Function block FWD_REV_MON .173
F.4 Function block STACK_INT.178
F.5 Function block MIX_2_BRIX .183
F.6 Analog signal processing .186
F.6.1 Function block LAG1 .187
F.6.2 Function block DELAY .187
61131-3 IEC:2003(E) – 5 –
F.6.3 Function block AVERAGE.188
F.6.4 Function block INTEGRAL.188
F.6.5 Function block DERIVATIVE .189
F.6.6 Function block HYSTERESIS .189
F.6.7 Function block LIMITS_ALARM .190
F.6.8 Structure ANALOG_LIMITS.190
F.6.9 Function block ANALOG_MONITOR.191
F.6.10 Function block PID.192
F.6.11 Function block DIFFEQ .193
F.6.12 Function block RAMP .194
F.6.13 Function block TRANSFER.195
F.7 Program GRAVEL.195
F.8 Program AGV .203
F.9 Use of enumerated data types .206
F.10 Function block RTC (Real Time Clock).206
F.11 Function block ALRM_INT.206
ANNEX G (informative) Reference character set.208
Index .210
Table 1 - Character set features.23
Table 2 - Identifier features.24
Table 3 - Comment feature.25
Table 3a - Pragma feature.25
Table 4 - Numeric literals.26
Table 5 - Character string literal features.27
Table 6 - Two-character combinations in character strings .28
Table 7 - Duration literal features .29
Table 8 - Date and time of day literals.29
Table 9 - Examples of date and time of day literals .29
Table 10 - Elementary data types .30
Table 11 - Hierarchy of generic data types .32
Table 12 - Data type declaration features .33
Table 13 - Default initial values of elementary data types.34
Table 14 - Data type initial value declaration features .35
Table 15 - Location and size prefix features for directly represented variables.37
Table 16a - Variable declaration keywords .39
Table 16b - Usages of VAR_GLOBAL, VAR_EXTERNAL and CONSTANT declarations .41
Table 17 - Variable type assignment features.41
Table 18 - Variable initial value assignment features.43
Table 19 - Graphical negation of Boolean signals .47
Table 19a - Textual invocation of functions for formal and non-formal argument list .49
Table 20 - Use of EN input and ENO output .50
Table 20a - Function features.51
Table 21 - Typed and overloaded functions.53
Table 22 - Type conversion function features .55
Table 23 - Standard functions of one numeric variable.57
Table 24 - Standard arithmetic functions.58
– 6 – 61131-3 IEC:2003(E)
Table 25 - Standard bit shift functions.59
Table 26 - Standard bitwise Boolean functions.60
d
Table 27 - Standard selection functions .61
Table 28 - Standard comparison functions.62
Table 29 - Standard character string functions .63
Table 30 - Functions of time data types .64
Table 31 - Functions of enumerated data types.66
Table 32 - Examples of function block I/O variable usage .68
Table 33 - Function block declaration and usage features .71
a
Table 34 - Standard bistable function blocks .77
Table 35 - Standard edge detection function blocks.78
Table 36 - Standard counter function blocks.79
Table 37 - Standard timer function blocks.81
Table 38 - Standard timer function blocks - timing diagrams.82
Table 39 - Program declaration features.83
Table 40 - Step features.85
Table 41 - Transitions and transition conditions.87
a,b
Table 42 - Declaration of actions .90
Table 43 - Step/action association .92
Table 44 - Action block features.93
Table 45 - Action qualifiers.94
Table 45a - Action control features .98
Table 46 - Sequence evolution.101
Table 47 - Compatible SFC features.108
Table 48 - SFC minimal compliance requirements .108
Table 49 - Configuration and resource declaration features.112
Table 50 - Task features.116
Table 51a - Examples of instruction fields.124
Table 51b - Parenthesized expression features for IL language.125
Table 52 - Instruction List operators.125
Table 53 - Function Block invocation and Function invocation features for IL language.127
Table 54 - Standard Function Block input operators for IL language.129
Table 55 - Operators of the ST language.131
Table 56 - ST language statements .132
Table 57 - Representation of lines and blocks .136
Table 58 - Graphic execution control elements.138
Table 59 - Power rails.139
Table 60 - Link elements .140
a
Table 61 - Contacts .141
Table 62 - Coils .142
Table C.1 - Delimiters.162
Table C.2 - Keywords.163
Table D.1 - Implementation-dependent parameters .165
Table E.1 - Error conditions.167
61131-3 IEC:2003(E) – 7 –
Table G.1 - Character representations.208
Table G.2 - Character encodings .209
Figure 1 - Software model .15
Figure 2 a) - Data flow connection within a program.16
Figure 2 b) - Communication via GLOBAL variables.16
Figure 2 c) - Communication function blocks .17
Figure 2 d) - Communication via access paths .17
Figure 3 - Combination of programmable controller language elements .19
Figure 4 - Examples of function usage.45
Figure 5 - Use of formal argument names.48
Figure 6 - Examples of function declarations and usage .52
Figure 7 - Examples of explicit type conversion with overloaded functions .54
Figure 8 - Examples of explicit type conversion with typed functions .54
Figure 9 - Function block instantiation examples .67
Figure 10 - Examples of function block declarations.70
Figure 11 a) - Graphical use of a function block name as an input variable .73
Figure 11 b) - Graphical use of a function block name as an in-out variable.74
Figure 11 c) - Graphical use of a function block name as an external variable .75
Figure 12 - Declaration and usage of in-out variables in function blocks.76
Figure 14 - ACTION_CONTROL function block - External interface (Not visible to the user) .95
Figure 15 a) - ACTION_CONTROL function block body with “final scan” logic.96
Figure 15 b) - ACTION_CONTROL function block body without “final scan” logic.97
Figure 16 a) - Action control example - SFC representation.98
Figure 16 b) - Action control example - functional equivalent .99
Figure 17 - Examples of SFC evolution rules.105
Figure 18 a) - Examples of SFC errors: an “unsafe” SFC.106
Figure 18 b) - Examples of SFC errors: an “unreachable” SFC.107
Figure 19 a) - Graphical example of a configuration .109
Figure 19 b) - Skeleton function block and program declarations for configuration example .110
Figure 20 - Examples of CONFIGURATION and RESOURCE declaration features.113
Figure 21 a) - Synchronization of function blocks with explicit task associations .120
Figure 21 b) - Synchronization of function blocks with implicit task associations .121
Figure 21 c) - Explicit task associations equivalent to figure 21 b) .122
Figure 22 - EXIT statement example.134
Figure 23 - Feedback path example.137
Figure 24 - Boolean OR examples .143
– 8 – 61131-3 IEC:2003(E)
INTERNATIONAL ELECTROTECHNICAL COMMISSION
____________
PROGRAMMABLE CONTROLLERS –
Part 3: Programming languages
FOREWORD
1) The IEC (International Electrotechnical Commission) is a worldwide organization for standardization comprising
all national electrotechnical committees (IEC National Committees). The object of the IEC is to promote
international co-operation on all questions concerning standardization in the electrical and electronic fields. To
this end and in addition to other activities, the IEC publishes International Standards. Their preparation is
entrusted to technical committees; any IEC National Committee interested in the subject dealt with may
participate in this preparatory work. International, governmental and non-governmental organizations liaising
with the IEC also participate in this preparation. The IEC collaborates closely with the International
Organization for Standardization (ISO) in accordance with conditions determined by agreement between the
two organizations.
2) The formal decisions or agreements of the IEC on technical matters express, as nearly as possible, an
international consensus of opinion on the relevant subjects since each technical committee has representation
from all interested National Committees.
3) The documents produced have the form of recommendations for international use and are published in the form
of standards, technical specifications, technical reports or guides and they are accepted by the National
Committees in that sense.
4) In order to promote international unification, IEC National Committees undertake to apply IEC International
Standards transparently to the maximum extent possible in their national and regional standards. Any
divergence between the IEC Standard and the corresponding national or regional standard shall be clearly
indicated in the latter.
5) The IEC provides no marking procedure to indicate its approval and cannot be rendered responsible for any
equipment declared to be in conformity with one of its standards.
6) Attention is drawn to the possibility that some of the elements of this International Standard may be the subject
of patent rights. The IEC shall not be held responsible for identifying any or all such patent rights.
International Standard IEC 61131-3 has been prepared by subcommittee 65B: Devices, of IEC
technical committee 65: Industrial-process measurement and control.
The text of this standard is based on the following documents:
FDIS Report on voting
65B/456/FDIS 65B/465/RVD
Full information on the voting for the
...
IEC 61131-3 ®
Edition 2.0 2003-01
INTERNATIONAL
STANDARD
NORME
INTERNATIONALE
Programmable controllers –
Part 3: Programming languages
Automates programmables –
Partie 3: Langages de programmation
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form
or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from
either IEC or IEC's member National Committee in the country of the requester. If you have any questions about IEC
copyright or have an enquiry about obtaining additional rights to this publication, please contact the address below or
your local IEC member National Committee for further information.
Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne peut être reproduite
ni utilisée sous quelque forme que ce soit et par aucun procédé, électronique ou mécanique, y compris la photocopie
et les microfilms, sans l'accord écrit de l'IEC ou du Comité national de l'IEC du pays du demandeur. Si vous avez des
questions sur le copyright de l'IEC ou si vous désirez obtenir des droits supplémentaires sur cette publication, utilisez
les coordonnées ci-après ou contactez le Comité national de l'IEC de votre pays de résidence.
IEC Central Office Tel.: +41 22 919 02 11
3, rue de Varembé Fax: +41 22 919 03 00
CH-1211 Geneva 20 info@iec.ch
Switzerland www.iec.ch
About the IEC
The International Electrotechnical Commission (IEC) is the leading global organization that prepares and publishes
International Standards for all electrical, electronic and related technologies.
About IEC publications
The technical content of IEC publications is kept under constant review by the IEC. Please make sure that you have the
latest edition, a corrigenda or an amendment might have been published.
IEC Catalogue - webstore.iec.ch/catalogue Electropedia - www.electropedia.org
The stand-alone application for consulting the entire The world's leading online dictionary of electronic and
bibliographical information on IEC International Standards, electrical terms containing more than 30 000 terms and
Technical Specifications, Technical Reports and other definitions in English and French, with equivalent terms in 15
documents. Available for PC, Mac OS, Android Tablets and additional languages. Also known as the International
iPad. Electrotechnical Vocabulary (IEV) online.
IEC publications search - www.iec.ch/searchpub IEC Glossary - std.iec.ch/glossary
The advanced search enables to find IEC publications by a More than 60 000 electrotechnical terminology entries in
variety of criteria (reference number, text, technical English and French extracted from the Terms and Definitions
committee,…). It also gives information on projects, replaced clause of IEC publications issued since 2002. Some entries
and withdrawn publications. have been collected from earlier publications of IEC TC 37,
77, 86 and CISPR.
IEC Just Published - webstore.iec.ch/justpublished
Stay up to date on all new IEC publications. Just Published IEC Customer Service Centre - webstore.iec.ch/csc
details all new publications released. Available online and If you wish to give us your feedback on this publication or
also once a month by email. need further assistance, please contact the Customer Service
Centre: csc@iec.ch.
A propos de l'IEC
La Commission Electrotechnique Internationale (IEC) est la première organisation mondiale qui élabore et publie des
Normes internationales pour tout ce qui a trait à l'électricité, à l'électronique et aux technologies apparentées.
A propos des publications IEC
Le contenu technique des publications IEC est constamment revu. Veuillez vous assurer que vous possédez l’édition la
plus récente, un corrigendum ou amendement peut avoir été publié.
Catalogue IEC - webstore.iec.ch/catalogue Electropedia - www.electropedia.org
Application autonome pour consulter tous les renseignements
Le premier dictionnaire en ligne de termes électroniques et
bibliographiques sur les Normes internationales,
électriques. Il contient plus de 30 000 termes et définitions en
Spécifications techniques, Rapports techniques et autres
anglais et en français, ainsi que les termes équivalents dans
documents de l'IEC. Disponible pour PC, Mac OS, tablettes
15 langues additionnelles. Egalement appelé Vocabulaire
Android et iPad.
Electrotechnique International (IEV) en ligne.
Recherche de publications IEC - www.iec.ch/searchpub
Glossaire IEC - std.iec.ch/glossary
La recherche avancée permet de trouver des publications IEC Plus de 60 000 entrées terminologiques électrotechniques, en
en utilisant différents critères (numéro de référence, texte, anglais et en français, extraites des articles Termes et
comité d’études,…). Elle donne aussi des informations sur les Définitions des publications IEC parues depuis 2002. Plus
projets et les publications remplacées ou retirées. certaines entrées antérieures extraites des publications des
CE 37, 77, 86 et CISPR de l'IEC.
IEC Just Published - webstore.iec.ch/justpublished
Service Clients - webstore.iec.ch/csc
Restez informé sur les nouvelles publications IEC. Just
Published détaille les nouvelles publications parues. Si vous désirez nous donner des commentaires sur cette
Disponible en ligne et aussi une fois par mois par email. publication ou si vous avez des questions contactez-nous:
csc@iec.ch.
IEC 61131-3 ®
Edition 2.0 2003-01
INTERNATIONAL
STANDARD
NORME
INTERNATIONALE
Programmable controllers –
Part 3: Programming languages
Automates programmables –
Partie 3: Langages de programmation
INTERNATIONAL
ELECTROTECHNICAL
COMMISSION
COMMISSION
ELECTROTECHNIQUE
INTERNATIONALE
ICS 25.040; 35.240.50 ISBN 978-2-8322-2616-2
– 2 – IEC 61131-3:2003 IEC 2003
CONTENTS
FOREWORD . 8
1 General . 9
1.1 Scope . 10
1.2 Normative references . 10
1.3 Definitions . 10
1.4 Overview and general requirements . 15
1.4.1 Software model . 15
1.4.2 Communication model . 17
1.4.3 Programming model . 19
1.5 Compliance . 20
1.5.1 System compliance . 21
1.5.2 Program compliance. 23
2 Common elements . 24
2.1 Use of printed characters . 24
2.1.1 Character set . 24
2.1.2 Identifiers . 24
2.1.3 Keywords . 25
2.1.4 Use of white space . 25
2.1.5 Comments . 25
2.1.6 Pragmas . 26
2.2 External representation of data . 26
2.2.1 Numeric literals . 26
2.2.2 Character string literals . 27
2.2.3 Time literals . 29
2.2.3.1 Duration . 29
2.2.3.2 Time of day and date . 30
2.3 Data types . 30
2.3.1 Elementary data types . 31
2.3.2 Generic data types . 32
2.3.3 Derived data types . 33
2.3.3.1 Declaration . 33
2.3.3.2 Initialization . 34
2.3.3.3 Usage . 36
2.4 Variables . 37
2.4.1 Representation . 37
2.4.1.1 Single-element variables . 37
2.4.1.2 Multi-element variables . 38
2.4.2 Initialization . 39
2.4.3 Declaration . 40
2.4.3.1 Type assignment . 42
2.4.3.2 Initial value assignment . 43
2.5 Program organization units . 46
2.5.1 Functions . 46
2.5.1.1 Representation . 47
2.5.1.2 Execution control . 50
2.5.1.3 Declaration . 51
2.5.1.4 Typing, overloading, and type conversion . 53
2.5.1.5 Standard functions. 56
2.5.1.5.1 Type conversion functions . 56
2.5.1.5.2 Numerical functions . 57
2.5.1.5.3 Bit string functions . 60
2.5.1.5.4 Selection and comparison functions . 60
2.5.1.5.5 Character string functions . 63
2.5.1.5.6 Functions of time data types . 65
2.5.1.5.7 Functions of enumerated data types . 67
2.5.2 Function blocks . 67
2.5.2.1 Representation . 68
2.5.2.1a) Use of EN and ENO in function blocks . 69
2.5.2.2 Declaration . 70
2.5.2.3 Standard function blocks . 78
2.5.2.3.1 Bistable elements . 78
2.5.2.3.2 Edge detection . 79
2.5.2.3.3 Counters . 79
2.5.2.3.4 Timers . 82
2.5.2.3.5 Communication function blocks . 83
2.5.3 Programs . 83
2.6 Sequential Function Chart (SFC) elements . 84
2.6.1 General . 84
2.6.2 Steps . 85
2.6.3 Transitions . 87
2.6.4 Actions . 90
2.6.4.1 Declaration . 90
2.6.4.2 Association with steps . 92
2.6.4.3 Action blocks . 93
2.6.4.4 Action qualifiers . 94
2.6.4.5 Action control . 95
2.6.5 Rules of evolution . 100
2.6.6 Compatibility of SFC elements . 108
2.6.7 SFC Compliance requirements . 109
2.7 Configuration elements. 109
2.7.1 Configurations, resources, and access paths . 111
2.7.2 Tasks . 115
3 Textual languages . 124
3.1 Common elements . 124
3.2 Instruction list (IL) . 124
3.2.1 Instructions . 124
3.2.2 Operators, modifiers and operands . 125
3.2.3 Functions and function blocks . 127
3.3 Structured Text (ST) . 130
3.3.1 Expressions . 130
3.3.2 Statements . 132
3.3.2.1 Assignment statements . 134
3.3.2.2 Function and function block control statements . 134
3.3.2.3 Selection statements . 134
3.3.2.4 Iteration statements . 135
4 Graphic languages . 136
4.1 Common elements . 136
4.1.1 Representation of lines and blocks . 136
4.1.2 Direction of flow in networks . 136
4.1.3 Evaluation of networks . 137
4.1.4 Execution control elements . 139
4.2 Ladder diagram (LD) . 140
4.2.1 Power rails . 140
4.2.2 Link elements and states . 140
4.2.3 Contacts . 141
4.2.4 Coils . 141
4.2.5 Functions and function blocks . 141
4.2.6 Order of network evaluation . 142
4.3 Function Block Diagram (FBD) . 144
4.3.1 General . 144
4.3.2 Combination of elements . 144
– 4 – IEC 61131-3:2003 IEC 2003
4.3.3 Order of network evaluation . 144
ANNEX A (normative) Specification method for textual languages . 145
A.1 Syntax . 145
A.1.1 Terminal symbols . 145
A.1.2 Non-terminal symbols . 145
A.1.3 Production rules . 146
A.2 Semantics . 146
ANNEX B (normative) Formal specifications of language elements . 147
B.0 Programming model . 147
B.1 Common elements . 147
B.1.1 Letters, digits and identifiers . 147
B.1.2 Constants . 148
B.1.2.1 Numeric literals . 148
B.1.2.2 Character strings . 148
B.1.2.3 Time literals . 149
B.1.2.3.1 Duration . 149
B.1.2.3.2 Time of day and date . 149
B.1.3 Data types . 150
B.1.3.1 Elementary data types . 150
B.1.3.2 Generic data types . 150
B.1.3.3 Derived data types . 150
B.1.4 Variables . 152
B.1.4.1 Directly represented variables . 152
B.1.4.2 Multi-element variables . 152
B.1.4.3 Declaration and initialization . 153
B.1.5 Program organization units . 155
B.1.5.1 Functions . 155
B.1.5.2 Function blocks . 156
B.1.5.3 Programs . 157
B.1.6 Sequential function chart elements . 157
B.1.7 Configuration elements . 158
B.2 Language IL (Instruction List) . 160
B.2.1 Instructions and operands . 160
B.2.2 Operators . 160
B.3 Language ST (Structured Text) . 161
B.3.1 Expressions . 161
B.3.2 Statements . 161
B.3.2.1 Assignment statements . 162
B.3.2.2 Subprogram control statements . 162
B.3.2.3 Selection statements . 162
B.3.2.4 Iteration statements . 162
ANNEX C (normative) Delimiters and keywords . 163
ANNEX D (normative) Implementation-dependent parameters . 166
ANNEX E (normative) Error conditions . 168
ANNEX F (informative) Examples . 170
F.1 Function WEIGH . 170
F.2 Function block CMD_MONITOR . 171
F.3 Function block FWD_REV_MON . 174
F.4 Function block STACK_INT . 179
F.5 Function block MIX_2_BRIX . 184
F.6 Analog signal processing . 187
F.6.1 Function block LAG1 . 188
F.6.2 Function block DELAY . 188
F.6.3 Function block AVERAGE . 189
F.6.4 Function block INTEGRAL . 189
F.6.5 Function block DERIVATIVE . 190
F.6.6 Function block HYSTERESIS . 190
F.6.7 Function block LIMITS_ALARM . 191
F.6.8 Structure ANALOG_LIMITS . 191
F.6.9 Function block ANALOG_MONITOR . 192
F.6.10 Function block PID . 193
F.6.11 Function block DIFFEQ . 194
F.6.12 Function block RAMP . 195
F.6.13 Function block TRANSFER . 196
F.7 Program GRAVEL . 196
F.8 Program AGV . 204
F.9 Use of enumerated data types . 207
F.10 Function block RTC (Real Time Clock) . 207
F.11 Function block ALRM_INT . 207
ANNEX G (informative) Reference character set . 209
Index . 211
Table 1 - Character set features . 24
Table 2 - Identifier features. 25
Table 3 - Comment feature. 26
Table 3a - Pragma feature . 26
Table 4 - Numeric literals . 27
Table 5 - Character string literal features . 28
Table 6 - Two-character combinations in character strings . 29
Table 7 - Duration literal features . 30
Table 8 - Date and time of day literals . 30
Table 9 - Examples of date and time of day literals . 30
Table 10 - Elementary data types . 31
Table 11 - Hierarchy of generic data types . 33
Table 12 - Data type declaration features . 34
Table 13 - Default initial values of elementary data types . 35
Table 14 - Data type initial value declaration features . 36
Table 15 - Location and size prefix features for directly represented variables . 38
Table 16a - Variable declaration keywords . 40
Table 16b - Usages of VAR_GLOBAL, VAR_EXTERNAL and CONSTANT declarations . 42
Table 17 - Variable type assignment features . 42
Table 18 - Variable initial value assignment features . 44
Table 19 - Graphical negation of Boolean signals . 48
Table 19a - Textual invocation of functions for formal and non-formal argument list . 50
Table 20 - Use of EN input and ENO output . 51
Table 20a - Function features . 52
Table 21 - Typed and overloaded functions . 54
Table 22 - Type conversion function features . 56
Table 23 - Standard functions of one numeric variable . 58
Table 24 - Standard arithmetic functions . 59
– 6 – IEC 61131-3:2003 IEC 2003
Table 25 - Standard bit shift functions . 60
Table 26 - Standard bitwise Boolean functions . 61
d
Table 27 - Standard selection functions . 62
Table 28 - Standard comparison functions . 63
Table 29 - Standard character string functions . 64
Table 30 - Functions of time data types . 65
Table 31 - Functions of enumerated data types . 67
Table 32 - Examples of function block I/O variable usage . 69
Table 33 - Function block declaration and usage features . 72
a
Table 34 - Standard bistable function blocks . 78
Table 35 - Standard edge detection function blocks . 79
Table 36 - Standard counter function blocks . 80
Table 37 - Standard timer function blocks . 82
Table 38 - Standard timer function blocks - timing diagrams . 82
Table 39 - Program declaration features . 84
Table 40 - Step features . 86
Table 41 - Transitions and transition conditions . 88
a,b
Table 42 - Declaration of actions . 91
Table 43 - Step/action association . 93
Table 44 - Action block features . 94
Table 45 - Action qualifiers . 95
Table 45a - Action control features . 99
Table 46 - Sequence evolution . 102
Table 47 - Compatible SFC features . 109
Table 48 - SFC minimal compliance requirements . 109
Table 49 - Configuration and resource declaration features . 113
Table 50 - Task features . 117
Table 51a - Examples of instruction fields . 125
Table 51b - Parenthesized expression features for IL language . 126
Table 52 - Instruction List operators . 126
Table 53 - Function Block invocation and Function invocation features for IL language . 128
Table 54 - Standard Function Block input operators for IL language . 130
Table 55 - Operators of the ST language . 132
Table 56 - ST language statements . 133
Table 57 - Representation of lines and blocks . 137
Table 58 - Graphic execution control elements . 139
Table 59 - Power rails . 140
Table 60 - Link elements . 141
a
Table 61 - Contacts . 142
Table 62 - Coils . 143
Table C.1 - Delimiters . 163
Table C.2 - Keywords . 164
Table D.1 - Implementation-dependent parameters . 166
Table E.1 - Error conditions . 168
Table G.1 - Character representations . 209
Table G.2 - Character encodings . 210
Figure 1 - Software model . 16
Figure 2 a) - Data flow connection within a program . 17
Figure 2 b) - Communication via GLOBAL variables . 17
Figure 2 c) - Communication function blocks . 18
Figure 2 d) - Communication via access paths . 18
Figure 3 - Combination of programmable controller language elements . 20
Figure 4 - Examples of function usage . 46
Figure 5 - Use of formal argument names . 49
Figure 6 - Examples of function declarations and usage . 53
Figure 7 - Examples of explicit type conversion with overloaded functions . 55
Figure 8 - Examples of explicit type conversion with typed functions . 55
Figure 9 - Function block instantiation examples . 68
Figure 10 - Examples of function block declarations . 71
Figure 11 a) - Graphical use of a function block name as an input variable . 74
Figure 11 b) - Graphical use of a function block name as an in-out variable . 75
Figure 11 c) - Graphical use of a function block name as an external variable . 76
Figure 12 - Declaration and usage of in-out variables in function blocks . 77
Figure 14 - ACTION_CONTROL function block - External interface (Not visible to the user) . 96
Figure 15 a) - ACTION_CONTROL function block body with “final scan” logic . 97
Figure 15 b) - ACTION_CONTROL function block body without “final scan” logic . 98
Figure 16 a) - Action control example - SFC representation . 99
Figure 16 b) - Action control example - functional equivalent . 100
Figure 17
...














Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.
Loading comments...