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 has to 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

Table 2-1: Size of the default variable types

CAUTION

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 like 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,
SGN08, UNS08, SGN16, UNS16, SGN32; UNS32, REAL64, STRING or user defined]

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 instanciation (see)

Normally all structure elements inherit the synchronisation type for the write/ read access from the variable instanciation (see). This parameter enables the individual definition of the synchronisation type of the structure element.

struct[i]. element[j].

access_rights

[READ_WRITE, READ_ONLY, WRITE_ONLY]

Is inherited from variable instanciation (see)

Normally all structure elements inherit the access rights from the variable instanciation. 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.