2
12.98 Subprograms, Macros
2.4 Callin
sub
ro
rams
2
840D
NCU 571
840D
NCU 572
NCU 573
FM-NC 810D 840Di
ï›™
Siemens AG 2000. All rights reserved
SINUMERIK 840D/840Di/810D/FM-NC Programming Guide Advanced (PGA)
−
04.00 Edition
2-99
2.4 Calling subprograms
Subprogram call without parameter transfer
In the main program you call the subprogram either
with address L and the subprogram number or by
specifying the program name.
Example:
N10 L47
or
N10 SPIGOT_2
Main program
N10 L47
or
N10 journal_2
Subprogram
Subprogram with parameter transfer,
declaration with EXTERN
Subprograms with parameter transfer must be listed
with EXTERN in the main program before they are
called, e.g. at the beginning of the program.
The name of the subprogram and the variable types
are declared in the sequence in which they are
transferred.
You only have to specify EXTERN if the subprogram
is in the workpiece or in the global subprogram
directory.
You do not have to declare cycles as EXTERN.
EXTERN statement
EXTERN NAME(TYP1, TYP2, TYP3, …)
oder
EXTERN NAME(VAR TYP1, VAR TYP2, …)
Example:
N10 EXTERN BORDER(REAL, REAL, REAL)
…
N40 BORDER(15.3,20.2,5)
N10 Declaration of the subprogram, N40
Subprogram call with parameter transfer.
Main program
N10 EXTERN
BORDER(REAL,REAL,REAL)
.
.
N40 BORDER(15.3,20.2,5)