Siemens SINUMERIK 840D sl Programming Manual page 495

Nc programming
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Program code
N30 SUB_PROG(1.0,2.0,3.0)
...
N100 M30
Examples for the subprogram call in N30 with incomplete parameter transfer:
N30 SUB_PROG( ,2.0,3.0)
N30 SUB_PROG(1.0, ,3.0)
N30 SUB_PROG(1.0,2.0)
N30 SUB_PROG( , ,3.0)
N30 SUB_PROG( , , )
NOTICE
Call-by-reference parameter transfer
Parameters transferred using call-by-reference must not be left out of the subprogram call.
NOTICE
AXIS data type
AXIS data type parameters must not be left out of the subprogram call.
Checking the transfer parameters
System variable $P_SUBPAR [ n ] where n = 1, 2, etc., can be used to check whether a
parameter has been transferred explicitly or left out in the subprogram. The index n refers to the
sequence of the formal parameters. Index n = 1 refers to the first formal parameter, index n = 2
to the second formal parameter, and so on.
The following program excerpt shows an example of how a check can be performed based on
the first formal parameter:
Programming
PROC SUB_PROG (REAL X, REAL Y, REAL Z)
N20 IF $P_SUBPAR[1]==TRUE
...
N40 ELSE
...
N60 ENDIF
...
N100 RET
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0
Comment
; Subprogram call with complete parameter transfer:
X=1.0, Y=2.0, Z=3.0
; X=0.0, Y=2.0, Z=3.0
; X=1.0, Y=0.0, Z=3.0
; X=1.0, Y=2.0, Z=0.0
; X=0.0, Y=0.0, Z=3.0
; X=0.0, Y=0.0, Z=0.0
Comment
; Formal parameters: X, Y, and Z
; Check of the first formal parameter
X.
; These actions are taken if the formal
parameter X has been transferred ex-
plicitly.
; These actions are taken if the formal
parameter X has not been transferred.
; General actions
Work preparation
3.2 Subprogram technique
495

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de sl

Table of Contents