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 by the IEC; the current (fourth) edition was published in May 2025.
Part 3 of IEC 61131 deals with basic software architecture and programming languages of the control program within PLC. The current edition defines three graphical and one textual programming language standards:
Previous editions also included:
- Instruction list (IL), textual. Deprecated in the third edition (2013) and removed in the fourth edition (2025).
Data types
Elementary Data Types (basic)
- 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)
Elementary Data Types (Date and Time)
- Duration
- 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)
Elementary Data Types (Character / Character string)
- Existing
- 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"
- New in version 4 of the standard
- UCHAR â Single character encoded according to UTF-8
- USTRING - Variable-length character string in which each character is encoded according to UTF-8
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_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)
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
External links
- PLCopen
- https://webstore.iec.ch/en/publication/68533 IEC 61131-3:2025 Programmable controllers â Part 3: Programming languages
- CODESYS â an implementation independent of device manufacturers, includes object oriented programming (OOP) as an option
- implementation for Siemens devices, only