Flexible NC programming
1.24 Subprogram technique
Sequence
3.
4.
5.
1.24.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
PROC CONTOUR (REAL X, REAL Y)
N20 X1=X Y1=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
N10 DEF REAL WIDTH
N20 WIDTH=20.0
N30 CONTOUR(5.5, WIDTH)
...
N100 M30
158
Directory
/_N_CUS_DIR /
/_N_CMA_DIR /
/_N_CST_DIR /
Description
User cycles
Manufacturer cycles
Standard cycles
Comment
; Formal parameters: X and Y, both REAL type
; Traversing of axis X1 to position X and axis
Y1 to position Y
Comment
; Variable definition
; Variable assignment
; Subprogram call with actual parameters: 5.5
and WIDTH
Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Job Planning