Basically, the following naming conventions have to be observed:
Identifiers can be composed of letters, digits, and underscores. Upper and lower case can be mixed.
Naming conventions: EcoStruxure Machine Expert - Safety allows to use DIN qualifiers in IEC 61131 variable names.
Rules for using DIN qualifiers
According to the IEC 61131 standard, variable names can consist of letters, digits, and underscores. The identifier has to begin with a letter or an underscore. The use of any other character causes the compiler error "Illegal identifier".
This naming convention has been expanded in EcoStruxure Machine Expert - Safety in a way that IEC 61131 variable names may also contain DIN qualifiers:
The characters - + < > can be used at any position in the name and as last character. However, they cannot be used as first character of a variable name.
The DIN qualifiers / * # and the numbers 0 to 9 can be used at any position in the variable name.
Rules for using DIN qualifiers in IEC 61131 variable names
Variable names must at least contain one alphabetical character.
Variables must not have the name of an IEC 61131 data type, such as BOOL, INT, WORD, REAL, etc.
Variable names must not be defined as they are for literal values. Literals are used in the code by first specifying the literal data type, followed by a hash sign: <literal_prefix>#<value>. For example, SAFEINT#5 and WORD#32767 are literals. Therefore, a variable declaration such as safeint#MyVar would be invalid.
Literal prefixes are not case-sensitive and include the following keywords:
BOOL, REAL, LREAL, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, BYTE, WORD, DWORD, LWORD, TIME, T, DATE, D, TIME_OF_DAY, TOD, DATE_AND_TIME, DT, STRING, TIMEDATE48, WEIGHT, ANALOG, UNIFRACT, BIFRACT200, FIXED, BOOLEAN2, BCD4, ENUM4, SAFEBOOL, SAFEBYTE, SAFEDWORD, SAFEINT, SAFEDINT, SAFETIME, SAFEWORD
Multiple underscores or blanks are not allowed.
For identifiers different lengths are allowed.
Identifier for... |
Number of characters |
Projects, bitmaps, archive files |
24 characters |
FB POUs |
50 characters |
Variables, instance names |
30 characters |