Additional functions
14.6 Function call ISVAR and read machine data array index
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
679
Example: Function call ISVAR
Program code Comments
DEF INT VAR1
DEF BOOL IS_VAR=FALSE ; Transfer parameter is a general variable
N10 IS_VAR=ISVAR("VAR1") ; IS_VAR is in this case, TRUE
DEF REAL VARARRAY[10,10]
DEF BOOL IS_VAR=FALSE ; Various syntax versions
N20 IS_VAR=ISVAR("VARARRAY[,]") ; IS_VAR is TRUE with a two-dimensional array
N30 IS_VAR=ISVAR("VARARRAY") ; IS_VAR is TRUE, variable exists
N40 IS_VAR=ISVAR("VARARRAY[8,11]") ; IS_VAR is FALSE, array index is not permitted
N50 IS_VAR=ISVAR("VARARRAY[8,8") ; IS_VAR is FALSE, syntax error for missing "]"
N60 IS_VAR=ISVAR("VARARRAY[,8]") ; IS_VAR is TRUE, array index is permitted
N70 IS_VAR=ISVAR("VARARRAY[8,]") ; IS_VAR is TRUE
DEF BOOL IS_VAR=FALSE ; Transfer parameter is a machine data
N100 IS_VAR=ISVAR("$MC_GCODE_RESET_VALUES[1]" ; IS_VAR is TRUE
DEF BOOL IS_VAR=FALSE ; Transfer parameter is a system variable
N10 IS_VAR=ISVAR("$P_EP") ; IS_VAR is in this case TRUE
N10 IS_VAR=ISVAR("$P_EP[X]") ; IS_VAR is in this case TRUE
Example: Read machine data array with and without index.
The first element will be read for
R1=$MC_EXTERN_GCODE_RESET_VALUES
as previous, this corresponds to
R1=$MC_EXTERN_GCODE_RESET_VALUES[0]
or the first element will be read
R1=$MA_POSTCTRL_GAIN[X1]
The corresponds to as before
R1=$MA_POSTCTRL_GAIN[0, X1]
The first element in synchronized actions is also read for
WHEN TRUE DO $R1 = $MC_EXTERN_GCODE_RESET_VALUES
The corresponds to as before
WHEN TRUE DO $R1 = $MC_EXTERN_GCODE_RESET_VALUES[0]
and would previously not be read with alarm 12400.
The alarm 12400 will still be issued for
R1=$MA_POSTCTRL_GAIN