13. Program Support Functions
13.3 Subprogram Control
288
Command format
Subprogram call
G22 L__ H__ P__ ,D__;
or G22 <File name> H__ P__ ,D__ ;
G22
Subprogram call command
L
A (label O)
Program No. of subprogram to be called (own program if omitted)
L(A) address can be omitted only during memory mode and MDI mode.
(Max. 8 digits)
<File name> File name
A file name can be specified instead of a program No.
In this case, enclose the file name with brackets <>.
(The file name can have up to 32 characters including the extension.)
(Example) G22 <parts-12. RAF>
H
Sequence No. in subprogram to be called (head block if omitted)
(Max. 5 digits)
L
Number of subprogram repetitions
(When omitted, this is interpreted at P1, and is not executed when P0.)
(Between 1 and 9999 times according to 4-digit value.)
For instance, G22 L1 P3 ; is equivalent to the following:
G22 L1 ;
G22 L1 ;
G22 L1 ;
,D
Subprogram device No. (0 to 4).
The subprogram in the memory can be used when ,D is omitted.
The device No. is set with the machining parameters.
Return to main program from subprogram
G22 H__ ;
G22
Subprogram return command
H
Sequence No. of return destination (returned to block that follows the calling
block)
Creating and entering subprograms
Subprograms have the same format as machining programs for normal memory mode except that
the subprogram completion instruction G22 (L_ P_ ) ; is entered as an independent block at the last
block.
L
ΔΔΔΔΔΔΔΔ
;
Program No. as subprogram No.
................................ ;
................................ ;
:
Main body of subprogram
:
:
................................ ;
G23 ;
Subprogram return command
% (EOR)
Entry completion code
(1) The above program is entered by editing operations at the setting and display unit. For further
details, refer to the section on program editing in the Instruction Manual.