Flexible NC programming
1.25 Subprogram technique
Job planning
160 Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
Syntax
PROC <program name> (VAR <parameter type> <parameter name>, etc.)
PROC <program name> (VAR <array type> <array name>, [<m>,<n>,<o>],
etc.)
Significance
PROC: Definition operation at the beginning of a program
VAR: Keyword for parameter transfer via reference
<program name>: Name of the program
<parameter type>: Data type of the parameter (e.g. REAL, INT, BOOL)
<parameter name>: Name of the parameter
<array type>: Data type of the array elements (e.g. REAL, INT, BOOL)
<array name>: Name of the array
Array size
Currently, up to 3-dimensional arrays are possible:
<m>: Array size for 1st dimension
<n>: Array size for 2nd dimension
[<m>,<n>,<o>]:
<o>: Array size for 3rd dimension
NOTICE
The program name specified after the
PROC keyword must match the program name
assigned on the user interface.
Note
With arrays of an undefined array length, subprograms can process arrays of variable length
as formal parameter. When defining a two-dimensional array as a formal parameter, for
example, the length of the 1st dimension is not specified. However, the comma must be
written.
Example:
PROC <program name> (VAR REAL ARRAY[,5])
Example
Definition of a subprogram with 2 parameters as reference to REAL type:
Program code Comment
PROC SUB_PROG(VAR REAL LENGTH, VAR REAL WIDTH) ; Parameter 1: Reference to type: REAL,
name: LENGTH
Parameter 2: Reference to type: REAL,
name: WIDTH
...
N100 RET