External variables (V.E) (#INIT V.E.)
The command "V.E. ...." writes to external addresses in the NC program and/or reads from external addresses. This is permitted by direct memory-linked communication between the NC channel and external users, typically the PLC.
Access from the NC channel can be executed synchronously by the interpolator or asynchronously by the decoder.
Notice
Reading a synchronous V.E. variable causes the NC channel to be flushed.
This is not permitted when TRC, polynomial contouring or HSC mode are active.
For more information on configuration and parameterisation, see the descriptions of external variables in the documentation [8].
Programing Example
External variables (V.E)
N100 $IF V.E.EXT1 >= 100 (corr. to the value of V.E.EXT1)
(branched to)
(various cases)
N110 G01 X100 Y100 F1000
N120 $ELSE
N130 G01 X100 YV.E.EXT1 F1000 (linear interpolation in Y direction)
(with the value of V.E.EXT1)
N140 $ENDIF
N150 N150 = V.A.ABS.X (The external variable is assigned)
(absolute X coordinates)
N160 G01 X (linear interpolation in X direction)
(the value of V.E.EXT2)
After controller start-up, the configured V.E. variables are initialised with zero.
Then V.E. variables can be re-initialised in the NC program using the #INIT command. The command can be followed by one or several V.E. variables which are initialised completely. Besides individual V.E. variables, complete V.E. arrays, V.E. structures and subelements of V.E. structures can also be initialised.
Syntax: |
#INIT V.E.<name> {, V.E.<name>} |
Attention
Access rights:
If a variable only has read access rights, it cannot be initialised with the #INIT command. The same applies to V.E. structures if they contain at least one subelement that can only be read.
Attention
Synchronous V.E. variables:
As soon as a V.E. structure contains one synchronous variable, the entire initialization operation with #INIT is synchronous, i.e. it is only executed in the interpolator context. Therefore, possible asynchronous subelements are also affected by this operation because they may not yet be reinitialised by a subsequent read access.
To achieve complete synchronism in these cases, users should therefore manually program a #FLUSH WAIT command before the #INIT command.
Tip:
When the #INIT command is used, it is recommended to create V.E. structure variables so that all elements are completely synchronous or completely asynchronous.
Programing Example
Initialisation of single V.E. variables:
Nxx #INIT V.E.EXT1, V.E.EXT2, V.E.EXT3
Initialisation of a V.E. array variable:
Nxx #INIT V.E.ARRAY1
Initialisation of specific V.E. array variables:
Nxx #INIT V.E.ARRAY1[5], V.E.ARRAY1[8], V.E.ARRAY1[20]
Initialisation of a V.E. structure variable:
Nxx #INIT V.E.STRUCT1
Initialisation of specific elements of a V.E. structure variable:
Nxx #INIT V.E.STRUCT1.NBR_POINTS, V.E.STRUCT1.POINTS
Combined initialisation of V.E. variables:
Nxx #INIT V.E.EXT2, V.E.ARRAY1[5], V.E.STRUCT1.POINTS
...