Variables and calculation of variables

A complete list of additional functions is contained in the overview of commands in the Appendix under Variable programming (V.).

Here, variables mean on the one hand an internal datum of the decoder with fixed name assignment; on the other hand they refer to self-defined variables whose designation is essentially freely selectable. With the exception of external variables (V.E...), their validity and utilisation are limited exclusively to a particular NC channel.

The general syntax is:

V.<NAME_1>.<NAME_2>.<NAME_3>.{<NAME_n>.}

V.

indicates access to the variables

<NAME_1>.

Defines the global data designation:

 

"A."

represents axis-specific variables

"SPDL."

"SPDL_PROG."

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

<NAME_2>.

specifies the data name

<NAME_3>.

e.g. the index if a distinction must be made between several identical data.

Notice

notice

Programming axis identification

The last identification code represents the axis code of axis-specific and several group-specific variables. Here, the designations

                                             ".X" or "[0]"

                                             ".Y" or "[1]"

                                             ".Z" or "[2]"

must be selectively used if the name "X" is assigned to the axis with the index 0, the name "Y" is assigned to the axis with the index 1 and the name "Z" is assigned to the axis with index 2 in the channel parameter list.

Example

example

Absolute value of the Xaxis:

V.A.ABS.X or V.A.ABS[0]

Analogous to spindle-specific variables, the spindle names or the corresponding indices must be used as listed in the channel parameter synchronisation mode.

                                             ".S" or "[0]"

                                             ".S2" or "[1]” etc.

Example

example

Logical axis number of the Sspindle:

Logical axis number of the Sspindle:

                    V.SPDL.LOG_AX_NR.S or V.SPDL.LOG_AX_NR[0]

Programing Example

prg_example

The lines N20/N30 cause a linear interpolation in X direction by the value of the variables V.A.BZP.Y, i.e. the reference point offset in Y direction.

N10 G92 X0 Y40 Z0

(Reference point offset)

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 by all variables and a value can also be assigned to several of them. 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.

Programing Example

prg_example

Here, the 2nd zero offset vector for the axis with the index 1 is assigned the value 100:

N10 V.G.NP[2].V[1] = 100

...

The EXIST function (see Section Arithmetic expressions <expr>) checks whether a variable exists at all.

Programing Example

prg_example

The EXIST request for an axis-specific variable checks whether a specific axis is found at all in the NC channel.

N10 G90 Y0

N20 $IF EXIST[V.A.LOG_AX_NR.X] == TRUE

N30 X-10

(X axis exists in channel, move to position –10)

N40 $ELSE

N50 #CALL AX [X,1,0]

(X axis does not exists in channel, first request axis)

N60 $ENDIF

...

M30

Before access to an external variable, a check is made whether access is possible at all:

N10 G90 Y0

N20 $IF EXIST[V.E.POS_1] == TRUE

N30 XV.E.POS_1

(Move X axis to position POS_1)

N40 $ELSE

N50 #MSG ["V.E.POS_1 not found!"]

(Output message and stop)

N55 M0

N60 $ENDIF

...

M30