2
Subprograms, Macros 12.98
2.3 Sub
ro
rams with
arameter transfer
2
840D
NCU 571
840D
NCU 572
NCU 573
FM-NC 810D 840Di
ï›™
Siemens AG 2000. All rights reserved
2-98
SINUMERIK 840D/840Di/810D/FM-NC Programming Guide Advanced (PGA)
−
04.00 Edition
Array definition
The following applies to the definition of the formal
parameters:
With two-dimensional arrays the number of fields 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
subprograms with arrays of variable length. However,
when defining the variables you must define how many
elements it is to contain.
See the Programming Guide "Advanced" for an
explanation of array definition.
Programming example
Programming with variable array dimensions
%_N_DRILLING_PLATE_MPF
Main program
DEF REAL TABLE[100,2]
Define position table
EXTERN DRILLING_PATTERN
(VAR REAL[,2],INT)
TABLE[0.0]=-17.5
Define positions
…
TABLE[99.1]=45
DRILLING_PATTERN(TABLE,100)
Subprogram call
M30
Creating a drilling pattern using the position table of variable dimension passed
%_N_DRILLING_PATTERN_SPF
Subprogram
PROC DRILLING_PATTERN(VAR REAL
ARRAY[,2],->
-> INT NUMBER)
Parameters passed
DEF INT COUNT
STEP: G1 X=ARRAY[COUNT,0]->
-> Y=ARRAY[COUNT,1] F100
Machining sequence
Z=IC(-5)
Z=IC(5)
COUNT=COUNT+1
IF COUNT<NUMBER GOTOB STEP
RET
End of subprogram