Variables and calculation of variables
Under variables, on the one hand an internal data of the decoder with a fixed name assignment is to be understood, and on the other hand there are self-defined variables, whose designation is essentially freely selectable. Excepting external variables (V.E...) their validity and use is limited exclusively to the NC channel.
General syntax is:
V. <NAME_1>. <NAME_2>. <NAME_3>.{<NAME_n>.}V. indicates the accessing of the variables
<NAME_1>. the global data designation:
"A." represents axis-specific variables,
"SPDL." represents spindle-specific variables,
"G." represents inter-axis, globally valid variables,
"E." represents external variables,
"P." represents self-defined, non-inter-program, non-global variables,
"L." represents self-defined, non-inter-program, local variables,
"S." represents self-defined, inter-program, global variables.
<NAME_2>. specifies the data name
<NAME_3>. e.g. the index, if several data of the same kind are to be distinguishable.
![]() | Programming of the axis identification |
The last identification code represents the axis-code of axis-specific and a few of the group-specific variables. Thereby the designations
".X" or "[0]",
".Y" or "[1]",
".Z" or "[2]"
are to be optionally used, if in the channel parameters [1]-27 the name "X" is assigned to the axis with the index 0, the name "Y" to the axis with the index 1 and the name "Z" to the axis with index 2.
Example: Absolute coordinate of the X-axis:
V.A.ABS.X or V.A.ABS[0]
Similar for spindle specific variables the spindle names or the corresponding indices according to the channel parameter data set are to be used.
".S" or "[0]",
".S2" or "[1]",
Example: Logical axis number of the S-spindle:
V.SPDL.LOG_AX_NR.S or V.SPDL.LOG_AX_NR[0]
Programming example
Both lines bring about a linear interpolation in X-direction around the value of the variables V.A.BZP.Y (coordinate preset in Y-direction).
N10 G92 X0 Y40 Z0 (Position preset)
N20 G91 G01 F1000 XV.A.BZP.Y
N30 XV.A.BZP[1] (here: Axis index 1 == Y )
N40 M30 The content can be read from all variables and to a few of them also a value can be assigned. The access type is firmly given for each variable, however generally only a reading access is allowed. Because for most of the variables a writing access is not practical.
Programming example
Here, the 2. zero offset vector for the axis with the index 1 is assigned with the value 100:
N10 V.G.NP[2].V[1] = 100The EXIST-function (see chapter 2.6.1.3) checks, if a variable generally is available.
Programming examples
By the EXIST-request on an axis specific variable it is checked, if in NC-channel a special axis generally is available.
..
N10 G90 Y0
N20 $IF EXIST[V.A.LOG_AX_NR.X] == TRUE
N30 X-10 (X-axis is in channel, move to position 10)
N40 $ELSE
N50 #CALL AX [X,1,0] (X-axis is not in channel, first request axis)
N60 $ENDIF
...
M30 In a first step before the access on an external variable it is checked, weather the access generally is possible:
...
N10 G90 Y0
N20 $IF EXIST[V.E.POS_1] == TRUE
N30 XV.E.POS_1 (Move X-axis on position POS_1)
N40 $ELSE
N50 #MSG ["V.E.POS_1 not available!"] (Create message and stop)
N55 M0
N60 $ENDIF
...
M30 