Flexible NC programming
1.25 Subprogram technique
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
153
1.25.1.5 Formal and actual parameters
Formal and actual parameters occur in conjunction with the definition and calling of
subprograms with parameter transfer.
Formal parameter
When a subprogram is defined, the parameters to be transferred to it (known as the formal
parameters) have to be defined with type and parameter name.
The formal parameters define, therefore, the interface of the subprogram.
Example:
Program code Comment
PROC CONTOUR (REAL X, REAL Y) ; Formal parameters: X and Y, both REAL type
N20 X1=X Y1=Y ; Traversing of axis X1 to position X and axis
Y1 to position Y
...
N100 RET
Actual parameters
When a subprogram is called, absolute values or variables (known as actual parameters)
have to be transferred to it.
As such, the actual parameters assign up-to-date values to the interface of the subprogram
when the latter is called.
Example:
Program code Comment
N10 DEF REAL WIDTH ; Variable definition
N20 WIDTH=20.0 ; Variable assignment
N30 CONTOUR(5.5, WIDTH) ; Subprogram call with actual parameters: 5.5
and WIDTH
...
N100 M30