Siemens SINUMERIK 840D sl Programming Manual page 92

Job planning
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Subroutines, Macros
2.3 Subroutines with parameter transfer (PROC, VAR)
Example: creating a drilling pattern using a transferred variable-length position table
%_N_DRILLING_PATTERN_SPF
PROC DRILLING_PATTERN(VAR REAL ARRAY[,2],->
-> INT NUMBER)
DEF INT COUNTER
STEP: G1 X=ARRAY[COUNTER,0]->
-> Y=ARRAY[COUNTER,1] F100
Z=IC(-5)
Z=IC(5)
COUNT=COUNT+1
IF COUNT<NUMBER GOTOB STEP
RET
Interruption of continuous-path mode
To prevent continuous-path mode from being interrupted:
Make sure the subroutine does not have the SAVE attribute. For further information about
the SAVE mechanism, refer to the section, Subroutine with SAVE Mechanism.
RET must be programmed in a separate NC block.
PROC CONTOUR
N10...
...
N100 M17
Parameter transfer between main program and subroutine
If you are working with parameters in the main program, you can use the values calculated
or assigned in the subroutine as well. For this purpose the values of the current parameters
of the main program are passed to the formal parameters of the subroutine when the
subroutine is called and then processed in subroutine execution.
Array definition
The following applies to the definition of the formal parameters: With two-dimensional arrays
the number of arrays in the first dimension does not need to be specified, but the comma
must be written.
Example:
VAR REAL ARRAY[,5]
With certain array dimensions it is possible to process subroutines with arrays of variable
length. However, when defining the variables you must define how many elements it is to
contain. The explanations of the array definition are contained in "Flexible NC Programming"
in the array definition section with the same name.
2-8
Subroutine
;Parameter delivery
;Machining sequence
;Subroutine end
Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
Job planning

Advertisement

Table of Contents
loading

Table of Contents