Additional functions
13.3 ISVAR ( ) function call and read machine array index
Job planning
Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
13-9
Example of the ISVAR function call
DEF INT VAR1
DEF BOOL IS_VAR=FALSE
;Transfer parameter is a general variable
N10 IS_VAR=ISVAR("VAR1") ;IS_VAR is TRUE in this case
DEF REAL VARARRAY[10,10]
DEF BOOL IS_VAR=FALSE ;Different syntax variations
N20 IS_VAR=ISVAR("VARARRAY[,]") ;IS_VAR is TRUE with a 2-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 allowed
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 allowed
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 TRUE in this case
N10 IS_VAR=ISVAR("$P_EP[X]") ;IS_VAR is TRUE in this case
Example of reading a machine data array both 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]
as previous, this corresponds to
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
as previous, this corresponds to
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