Requesting variables and constants – HEIDENHAIN SW 548328-05 DIN Programming User Manual
Page 401

HEIDENHAIN MANUALplus 620, CNC PILOT 620/640
401
4.32 Conditional bloc
k r
u
n
Requesting variables and constants
With the DEF, NDEF, and DVDEF elements you can inquire whether a
valid value was assigned to a variable or a constant. For example, an
undefined variable can return the value 0, just like a variable that has
been assigned the value 0. You can prevent undesired program jumps
by examining the variables.
Programming:
Select "Extras > DINplus word...". The Control opens the "Insert DIN
PLUS word" selection list.
Select the IF command
Enter the required inquiry element (DEF, NDEF or DVDEF)
Enter the name of a variable or a constant
Inquiry elements of variables and constants:
DEF: A value is assigned to a variable or constant
NDEF: No value is assigned to a variable or constant
DVDEF: Inquiry of an internal constant
Example: Requesting variable in subprogram
N.. IF DEF(__la)
N.. THEN
N.. PRINT(„Value:“,#__la)
N.. ELSE
N.. PRINT(„#__la is not defined“)
N.. ENDIF
. . .
Example: Requesting variable in subprogram
N.. IF NDEF(__lb)
N.. THEN
N.. PRINT(„#__lb is not defined“)
N.. ELSE
N.. PRINT(„Value:“,#__lb)
N.. ENDIF
. . .
Example: Requesting constants
N.. IF DVDEF(__n97_s)
N.. THEN
N.. PRINT(„__n97_s is defined“,#__n97_s)
N.. ELSE
N.. PRINT(„#__n97_s is not defined“)
N.. ENDIF
. . .
Enter the variable name without the character "#", e.g. IF
NDEF(__la)
.