Flexible NC programming
1.1 Variables
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
27
Example 2: Program-global and program-local user variables (PUD/LUD)
Program code Comment
PROC MAIN ; Main program
DEF INT VAR1 ; PUD definition
...
SUB2 ; Subprogram call
...
M30
Program code Comment
PROC SUB2 ; Subprogram SUB2
DEF INT VAR2 ; LUD DEFINITION
...
IF (VAR1==1) ; Read PUD
VAR1=VAR1+1 ; Read and write PUD
VAR2=1 ; Write LUD
ENDIF
SUB3 ; Subprogram call
...
M17
Program code Comment
PROC SUB3 ; Subprogram SUB3
...
IF (VAR1==1) ; Read PUD
VAR1=VAR1+1 ; Read and write PUD
VAR2=1 ; Error: LUD from SUB2 not known
ENDIF
...
M17