Definition of variable types
Beside the user defined variable types also the elementary data types (BOOLEAN, ..., REAL64) and the character strings of type STRING can be used.
Variable type | Size |
|
BOOLEAN, UNS08, SGN08 | 1 Byte | |
UNS16, SGN16 | 2 Byte | |
UNS32, SGN32 | 4 Byte | |
REAL64 | 8 Byte | |
STRING | 128 Byte From CNC version V2.10.1025.00 onwards string variables can contain up to 128 characters including the end mark. For downgrade compatibility reasons for the use of string variables with more than 20 characters the parameter use_extended_string_var must be set to 1. Depending on the parameter use_extended_string_var string variables are limited on the following length (including the end mark): use_extended_string_var = 0: 21 Byte (Default) use_extended_string_var = 1: 128 Byte |
| |
If there is a later change on 128 byte size string variables (use_extended_string_var = 1) within an existing configuration, in the memory and in the PLC the addresses of the external variables have to be adapted (index, byte offset), to avoid the overwriting of following variables! |
The definition of the variable types is done in the same configuration list as the definition of the external variables.
Comments can be whole-lined or can be added at the end of a line. In the case of whole-lined comments, at the beginning of the line the comment character ‘#’ must be added followed by a space character.
If at the end of a line a comment is to be added, then in front of the comment, at least one space character must be there. If, however, in the line a string is defined, then the comment character ‘(‘ must precede the comment.
Blank lines are also possible.
Definition of variable types:
Designator | Value range | Default | Significance |
use_extended_string_var | [0; 1] | 0 | This parameter enables the increasing of the number of characters of string variables from 21 to 128 characters (each including the end mark). If the addresses of the V.E. variables are predefined in 24 byte block (see) for the STRING variables of 128 byte size it has to take into account, that they allocate several 24 byte blocks in the memory layout and that the index has to be incremented accordingly (see variable arrays). |
struct[i] .* | i:= [0; 29] | Data sets for the definition of the variable types. The key word ‘struct’ replaces the common token ‘type’ used in older CNC-versions. However, due to downward compatibility the token ‘type’ is still supported. | |
struct[i]. name | ASCII-String |
| The variable type is identified by the name. The name consists of maximum 20 characters. Upper case letters and lower-case letters are differentiated. |
struct[i]. element[j] .* | j:= [0; 49] | Data sets for the definition of the elements of the variable type. | |
struct[i]. element[j].name | ASCII-String |
| The structure element is identified by the name. The name consists of maximum 20 characters. Upper case letters and lower case letters are differentiated. |
struct[i]. element[j].type | ASCII-String [BOOLEAN, | UNS32 | The type indicates the data type of the structure element. Besides elementary data types (SGN08, ..., REAL64), here also the data type STRING or an user defined data type can be defined. |
struct[i]. element[j].
| [TRUE, FALSE] | Is inherited from variable instantiation (see) | Normally all structure elements inherit the synchronization type for the write/ read access from the variable instantiation (see). This parameter enables the individual definition of the synchronization type of the structure element. |
struct[i]. element[j]. access_rights | [READ_WRITE, READ_ONLY, WRITE_ONLY] | Is inherited from variable instantiation (see) | Normally all structure elements inherit the access rights from the variable instantiation. This parameter enables the individual definition of the access right of the structure element. |
struct[i]. element[j]. array_elements | [0; MAX_UNS16] | 0 | If the variable is not structured as an array, the array size must be specified as 0. Otherwise, the total size of the array is defined at this point. |