
13. Program Support Functions
13.3 Subprogram Control
287
13.3 Subprogram Control; G22, G22
13.3.1 Calling Subprogram with G22 and G22 Commands
Function and purpose
Fixed sequences or repeatedly used parameters can be stored in the memory as subprograms
which can then be called from the main program when required.G22 serves to call subprograms
and G23 serves to return operation from the subprogram to the main program. Furthermore, it is
possible to call other subprograms from particular subprograms and the nesting depth can include
as many as 8 levels.
Main program
L0010;
G22 L1000;
M02;
Subprogram
L1000;
G22 L1200
H20;
G23;
(Level 1)
Subprogram
L1200;
N20;
G22 L2000;
N60;
G23;
Subprogram
L2000;
G22 L2500;
G23 H60;
Subprogram
L3000;
G23;
(Level 2)
(Level 3)
(Level 8)
Nesting depth
The table below shows the functions which can be executed by adding and combining the tape
storing and editing functions, subprogram control functions and fixed cycle functions.
Case 1
Case 2
Case 3
Case 4
1. Tape storing and editing
Yes
Yes
Yes
Yes
2. Subprogram control
No
Yes
Yes
No
3. Fixed cycles
No
No
Yes
Yes
Function
1. Memory mode
2. Tape editing (main memory)
3. Subprogram call
×
×
4. Subprogram variable designation
(Note 2)
×
×
5. Subprogram nesting level call
(Note 3)
×
×
6. Fixed cycles
×
×
7. Subprogram editing for fixed cycle
×
×
(Note 1)
" " denotes a function which can be used and "×" a function which cannot be used.
(Note 2)
Variables cannot be transferred with the G22 command but variable commands in
subprograms can be used provided that the variable command option is available.
(Note 3)
A maximum of 8 nesting levels form the nesting depth.