Class
The class keyword assigns the variable a property that defines how it is to be used in the pro
-
ject. Some examples:
–
VAR: Local variable for use within the POU
–
VAR_EXTERNAL: An external global variable is declared in the Global Variable List and
can be read and written by all POUs.
–
VAR_CONSTANT: Local variable with constant value for use within the POU.
Identifier
Each variable is given a symbolic address. This individual name (identifier) can be chosen
freely but must always begin with a letter or a single underline character. Spaces and mathe
-
matical operator characters (e.g. +, - ,*) are not permitted.
Examples for identifiers:
–
S02.3
–
Drive_2_ready
–
_Open_Valve
–
Motor_M1_ON
The use of symbolic declarations complies with IEC 61131.3.
Absolute addresses
When global variables are declared they should also be assigned absolute addresses. If you
do not assign the absolute addresses manually, they are assigned automatically. An absolute
address specifies the memory location of the variable in the CPU or an input or output.
Absolute addresses can be assigned using either the IEC syntax (IEC-Adr.) or the MELSEC
syntax (MIT-Addr.). Some examples for absolute addresses:
Input X0F = X0F (MELSEC syntax) = %IX15 (IEC syntax)
Output Y03 = Y03 (MELSEC syntax) = %QX3 (IEC syntax)
Elementary Data Types
The data type defines the characteristics of a variable like value range or number of bits.
4–12 MITSUBISHI ELECTRIC
The IEC 61131-3 Standard An Introduction to Programming
Data type Value range Size
BOOL Boolean 0 (FALSE), 1 (TRUE) 1 Bit
INT Integer -32768 to +32767 16 Bits
DINT Double Integer -2,147,483,648 to 2,147,483,647 32 Bits
WORD Bit string 16 0 to 65535 16 Bits
DWORD Bit string 32 0 to 4.294.967.295
32 Bits
REAL Floating point value 3.4E +/-38 (7 digits)
TIME Time value -T#24d0h31m23s64800ms to T#24d20h31m23s64700ms
STRING Character string Character strings are limited to16 characters