IEC 61131-3
Industrial standard for programmable logic controllers
IEC 61131-3 is the third part (of 10) of the international standard IEC 61131 for programmable logic controllers. It was first published in December 1993[1] by the IEC; the current (third) edition was published in February 2013.[2]
Part 3 of IEC 61131 deals with basic software architecture and programming languages of the control program within PLC. It defines three graphical and two textual programming language standards:
- Ladder diagram (LD), graphical
- Function block diagram (FBD), graphical
- Structured text (ST), textual
- Instruction list (IL), textual (deprecated in 3rd edition of the standard[3])
- Sequential function chart (SFC), has elements to organize programs for sequential and parallel control processing, graphical.
Data types
- Elementary Data Type
- Bit Strings – groups of on/off values
- BOOL - 1 bit (0,1)
- BYTE – 8 bit (1 byte)
- WORD – 16 bit (2 byte)
- DWORD – 32 bit (4 byte)
- LWORD – 64 bit (8 byte)
- INTEGER – whole numbers (Considering byte size 8 bits)
- SINT – signed short integer (1 byte)
- INT – signed integer (2 byte)
- DINT – signed double integer (4 byte)
- LINT – signed long integer (8 byte)
- USINT – Unsigned short integer (1 byte)
- UINT – Unsigned integer (2 byte)
- UDINT – Unsigned double integer (4 byte)
- ULINT – Unsigned long integer (8 byte)
- REAL – floating point IEC 60559 (same as IEEE 754-2008)
- REAL – (4 byte)
- LREAL – (8 byte)
- Bit Strings – groups of on/off values
Unit | Description |
---|---|
d | Day |
h | Hour |
m | Minute |
s | Second |
ms | Millisecond |
us | Microsecond |
ns | Nanosecond |
- Duration [4]
- TIME – (implementer specific). Literals in the form of T#5m90s15ms
- LTIME – (8 byte). Literals extend to nanoseconds in the form of T#5m90s15ms542us15ns
- Date
- DATE – calendar date (implementer specific)
- LDATE – calendar date (8 byte, nanoseconds since 1970-01-01, restricted to multiple of one day)
- Time of day
- TIME_OF_DAY / TOD – clock time (implementer specific)
- LTIME_OF_DAY / LTOD – clock time (8 byte)
- Date and time of Day
- DATE_AND_TIME / DT – time and date (implementer specific)
- LDATE_AND_TIME / LDT – time and date (8 byte, nanoseconds since 1970-01-01)
- Character / Character string
- CHAR – Single-byte character (1 byte, limited to characters 0 to 255 of ISO/IEC 10646)
- WCHAR – Double-byte character (2 byte, limited to characters 0 to 65535 of ISO/IEC 10646)
- STRING – Variable-length single-byte character string. Literals specified with single quote, 'This is a STRING Literal'
- WSTRING – Variable-length double-byte character string. Literals specified with a double quote, "This is a WSTRING Literal"
- Duration [4]
Escape sequence | Produces |
---|---|
$$ | $ |
$' | ' |
$L | linefeed |
$N | newline |
$P | page (form feed) |
$R | return |
$T | tab |
$xx | hex value |
- Generic Data Types – Only available for the input / output/ in-out variables of system-defined Program Organization Units (POUs, see below)
- ANY
- ANY_DERIVED
- ANY_ELEMENTARY
- ANY_MAGNITUDE
- ANY_NUM
- ANY_REAL: LREAL, REAL
- ANY_INT
- ANY_UNSIGNED: ULINT, UDINT, UINT, USINT
- ANY_SIGNED: LINT, DINT, INT, SINT
- ANY_DURATION: TIME, LTIME
- ANY_NUM
- ANY_BIT: LWORD, DWORD, WORD, BYTE, BOOL
- ANY_CHARS
- ANY_STRING: STRING, WSTRING
- ANY_CHAR: CHAR, WCHAR
- ANY_DATE: DATE_AND_TIME (DT), DATE_AND_TIME(LDT), DATE, TIME_OF_DAY (TOD), LTIME_OF_DAY(LTOD)
- ANY_MAGNITUDE
- ANY
- User-defined Data Types
- Enumerated data type
- Enumerated data type with named value
- Subrange data type – puts limits on value i.e., INT(4 .. 20) for current
- Array data type – multiple values stored in the same variable.
- Structured data type – composite of several variables and types.
- Directly derived data type – type derived from one of the above types to give new name and initial value as a type.
- References – a kind of strongly typed pointer. Arithmetic operation of the value of this type is prohibited.
Variables
Variable attributes: RETAIN, CONSTANT, AT
- Global
- Direct (local)
- I/O Mapping – Input, Output, I/O
- External
- Temporary
Configuration
- Resource – Like a CPU
- Tasks – Can be multiple per CPU.
- Programs – Can be executed once, on a timer, on an event.
Program organization unit (POU)
- Functions
- Standard: ADD, SQRT, SIN, COS, GT, MIN, MAX, AND, OR, etc.
- Custom
- Function Blocks
- Standard:
- Custom – Libraries of functions can be supplied by a vendor or third party.
- Programs
Configuration, resources, tasks
- Configuration – processing resources, memory for IO, execution rates, number of tasks.
Object oriented programming (OOP)
- The 3rd revision of the standard describes how to implement OOP within the application programming
References
- ^ Stevic, Tom (5 May 2017). "A very short history of PLC programming platforms". Control Design. Retrieved 11 September 2021.
- ^ "IEC 61131-3:2013". International Electrotechnical Commission (IEC). Retrieved 11 September 2021.
- ^ PLCopen: The third edition of IEC 61131-3
- ^ "Time Duration Literals (IEC 61131-3)".
External links
- PLCopen
- IEC 61131-3:2013 Programmable controllers - Part 3: Programming languages
- CODESYS important implementation independent of device manufacturers, includes object oriented programming (OOP) as an option
- de:STEP 7 implementation for Siemens devices, only
- v
- t
- e
- 60027
- 60034
- 60038
- 60062
- 60063
- 60068
- 60112
- 60228
- 60269
- 60297
- 60309
- 60320
- 60364
- 60446
- 60559
- 60601
- 60870
- 60906-1
- 60908
- 60929
- 60958
- 61030
- 61131
- 61131-3
- 61131-9
- 61158
- 61162
- 61334
- 61355
- 61360
- 61400
- 61499
- 61508
- 61511
- 61784
- 61850
- 61851
- 61883
- 61960
- 61968
- 61970
- 62014-4
- 62026
- 62056
- 62061
- 62196
- 62262
- 62264
- 62304
- 62325
- 62351
- 62365
- 62366
- 62379
- 62386
- 62455
- 62680
- 62682
- 62700
- 63110
- 63119
- 63382
- 646
- 1989
- 2022
- 4909
- 5218
- 6429
- 6523
- 7810
- 7811
- 7812
- 7813
- 7816
- 7942
- 8613
- 8632
- 8652
- 8859
- 9126
- 9293
- 9496
- 9529
- 9592
- 9593
- 9899
- 9945
- 9995
- 10021
- 10116
- 10165
- 10179
- 10279
- 10646
- 10967
- 11172
- 11179
- 11404
- 11544
- 11801
- 12207
- 13250
- 13346
- 13522-5
- 13568
- 13816
- 13818
- 14443
- 14496
- 14651
- 14882
- 15288
- 15291
- 15408
- 15444
- 15445
- 15504
- 15511
- 15693
- 15897
- 15938
- 16262
- 16485
- 17024
- 17025
- 18004
- 18014
- 18181
- 19752
- 19757
- 19770
- 19788
- 20000
- 20802
- 21000
- 21827
- 22275
- 22537
- 23000
- 23003
- 23008
- 23270
- 23360
- 24707
- 24727
- 24744
- 24752
- 26300
- 27000
- 27000-series
- 27002
- 27040
- 29110
- 29119
- 33001
- 38500
- 39075
- 42010
- 80000
- 81346