Siemens sinumerik 840d Programming Manual page 96

Hide thumbs Also See for sinumerik 840d:
Table of Contents

Advertisement

Subprograms, Macros
2
2.3 Subprograms with parameter transfer
840D
840D
NCU 571
NCU 572
NCU 573
Example:
N10 DEF REAL LENGTH,WIDTH
N20 LENGTH=12 WIDTH=10
N30 BORDER (LENGTH,WIDTH)
The values assigned in N20 in the main program are
passed in N30 when the subprogram is called.
Parameters are passed in the sequence stated.
The parameter names do not have to be identical in
the main programs and subprogram.
Two ways of parameter transfer
Values are only passed (call-by-value)
If the parameters passed are changed as the
subprogram runs this does not have any effect on
the main program. The parameters remain
unchanged in it (see Fig.)
Parameter transfer with data exchange
(call-by-reference)
Any change to the parameters in the subprogram
also causes the parameter to change in the main
program (see Fig.).
2-96
FM-NC
810D
840Di
Main program
Value assignment
LENGTH=12
WIDTH=10
Old values
apply
Main progam
Value assignment
LENGTH=12
WIDTH=10
New values
apply
SINUMERIK 840D/840Di/810D/FM-NC Programming Guide Advanced (PGA) − 04.00 Edition
12.98
2
Subprogram
LENGTH, WIDTH
New
value assignment
LENGTH=20
WIDTH=15
New values
apply
Subprogram
LENGTH, WIDTH
New
value assignment
LENGTH=20
WIDTH=15
New values
apply
LENGTH, WIDTH
 Siemens AG 2000. All rights reserved

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik fm-ncSinumerik 840diSinumerik 810d

Table of Contents