System information

SECTION SIX - PARAMETRIC PROGRAMMING
GOTO statement
The statement N### defines a label. GOTO’s/GOSUB’s can branch or transfer control to blocks
containing these labels. A GOTO statement transfers progam execution to the block prefixed by
the block label referenced in the GOTO statement.
GOTO 30 (The next block executed is block N30.)
Note: If there is more than one N30 program, it will transfer to the first N30.
CALL statement
A CALL statement transfers control to any program residing in the CNC's memory. Upon
completion of the called program or an M2, M99, or M30, control is returned to the main
program at the block immediately following the CALL statement.
The CALL format is as follows.
CALL XXXX
LXXX
Program Loop Count
Number (optional)
If the L is omitted, the called program will be executed once. The call statement is the same as an
M98.
Note: It is not necessary for the sub-program to be called in a separate program. You can call to
an O#### in the same file. This eliminates the need to use the extract programs parameter.
Example:
X1 Y1
Call 2 (call to O0002)
M2 (the M2 here is optional)
O0002 (O#### in the same file has precedence over a separate O#### file.)
X2 Y2
M99 (the M99 here is optional)
GOSUB and RETURN
A GOSUB transfers program execution to the block number specified in the GOSUB statement.
Execution will continue until a block containing a RETURN statement is encountered. The
RETURN will transfer control back to the block immediately following the GOSUB statement.
To use a GOSUB statement, the called block number must be part of the same program.
Generally the subroutines are at the end of the main program.
328