Data Types: IEC 61131-3 Is The Third Part (Of 10) of The Open
Data Types: IEC 61131-3 Is The Third Part (Of 10) of The Open
IEC 61131-3 is the third part (of 10) of the open 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:
Contents
• 1Data types
• 2Variables
• 3Configuration
• 4Program organization unit (POU)
• 5Configuration, resources, tasks
• 6Object oriented programming (OOP)
• 7References
• 8External links
Data types[edit]
• Elementary Data Type
o 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)
o 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)
o REAL – floating point IEC 60559 (same as IEEE 754-2008)
▪ REAL – (4 byte)
▪ LREAL – (8 byte)
Duration literals
Unit Description
d Day
h Hour
m Minute
s Second
ms Millisecond
us Microsecond
ns Nanosecond
•
o Duration [4]
▪ TIME – (4 byte). Literals in the form of
T#5m90s15ms
▪ LTIME – (8 byte). Literals extend to nanoseconds in
the form of T#5m90s15ms542us15ns
o Date
▪ DATE – calendar date (Size is not specified)
▪ LDATE – calendar date (Size is not specified)
o Time of day
▪ TIME_OF_DAY / TOD – clock time(Size is not
specified)
▪ LTIME_OF_DAY / LTOD – clock time (8 byte)
o Date and time of Day
▪ DATE_AND_TIME / DT – time and date(Size is not
specified)
▪ LDATE_AND_TIME / LDT – time and date(8 byte)
o Character / Character string
▪ CHAR – Single-byte character (1 byte)
▪ WCHAR – Double-byte character (2 byte)
▪ 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"
STRING escape sequences
$$ $
$' '
$L linefeed
$N newline
$R return
$T tab
• Generic Data Types – Only available for the input / output/ in-out
variables of system-defined Program Organization Units (POUs, see
below)
o ANY
▪ ANY_DERIVED
▪ ANY_ELEMENTARY
▪ ANY_MAGNITUDE
▪ ANY_NUM
▪ ANY_REAL:
LREAL, REAL
▪ ANY_INT
▪ ANY_UN
SIGNED:
ULINT,
UDINT,
UINT,
USINT
▪ ANY_SIG
NED:
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
o Enumerated data type
o Enumerated data type with named value
o Subrange data type – puts limits on value i.e., INT(4 .. 20) for
current
o Array data type – multiple values stored in the same variable.
o Structured data type – composite of several variables and
types.
o Directly derived data type – type derived from one of the
above types to give new name and initial value as a type.
o References – a kind of strongly typed pointer. Arithmetic
operation of the value of this type is prohibited.
Variables[edit]
Variable attributes: RETAIN, CONSTANT, AT
• Global
• Direct (local)
• I/O Mapping – Input, Output, I/O
• External
• Temporary
Configuration[edit]
• 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)[edit]
• Functions
o Standard: ADD, SQRT, SIN, COS, GT, MIN, MAX, AND, OR,
etc.
o Custom
• Function Blocks
o Standard:
o Custom – Libraries of functions can be supplied by a vendor
or third party.
• Programs
References[edit]
1. ^ Stevic, Tom (5 May 2017). "A very short history of PLC programming platforms".
Control Design. Retrieved 11 September 2021.
2. ^ "IEC 61131-3:2013". International Electrotechnical Commission (IEC). Retrieved 11
September 2021.
3. ^ PLCopen: The third edition of IEC 61131-3
4. ^ "Time Duration Literals (IEC 61131-3)".