300 Programming: Subprograms and Program Section Repeats
8.4 Any desired program as subprogram
8.4 Any desired program as
subprogram
Procedure
1 The TNC executes the part program up to the block in which
another program is called with CALL PGM
2 Then the other program is run from beginning to end
3 The TNC then resumes the first (calling) part program with the
block after the program call
Programming notes
No labels are needed to call any program as a subprogram
The called program must not contain the miscellaneous functions M2
or M30. If you have defined subprograms with labels in the called
program, you can then replace M2 or M30 with the FN 9: IF +0 EQU
+0 GOTO LBL 99 jump function in order to jump to the end of a
program In this case enter LBL 99 in the called program before the
END PGM block.
The called program must not contain a CALL PGM call into the calling
program, otherwise an infinite loop will result.
0 BEGIN PGM A
CALL PGM B
END PGM A
0 BEGIN PGM B
END PGM B
1
3
2
S
R
If you want to program variable program calls in
connection with string parameters, use the SEL PGM (see
"Defining a program call" on page 460)