Programming instructions

9-10
Commands for Controlling Processes and Programs NC Programming 17VRS
DOK-MTC200-NC**PRO*V17-ANW1-EN-P
Subroutine Organization
A subroutine consist of the:
Beginning of the subroutine
NC blocks in the subroutine
Return from the subroutine (end)
.LABEL
Start of subroutine
NC blocks
NC blocks in subroutine
RTS
Return from subroutine
Fig. 9-4: Subroutine structure
In terms of syntax, the "jump label” begins with a decimal point followed
by at least one and no more than six legal characters. The syntax is NOT
case sensitive. The "
" sign following the decimal point is reserved for
INDRAMAT canned NC cycles.
Subroutine Nesting
A subroutine can be called from an NC program as well as from a differ-
ent subroutine. This is referred to as "subroutine nesting."
The CNC allows 10 subroutine nesting levels. This means that subrou-
tines can be nested no more than 9 levels deep.
Program Call Levels:
1 2345678910
NC Program
BSR .UP1
Call
9 Nesting Levels
.SR1 .SR2 .SR3 .SR4 .SR5 .SR6 .SR7 .SR8 .SR9
RTS RTS RTS RTS RTS RTS RTS RTS RTS
BSR .UP2 BSR .UP3 BSR .UP4 BSR .UP5 BSR .UP6 BSR .UP7 BSR .UP8 BSR .UP9
Fig. 9-5: Subroutine nesting
Jump to NC Subroutine
‘JSR’
The "JSR" command jumps to the NC program number set in the com-
mand parameter and continues program execution in this new NC pro-
gram in the first NC block. In contrast to the "JMP" command, the called
NC program returns to the NC program from which is was called after the
"RTS" command has executed. This allows entire NC programs to be
used as subroutines.
JSR <program number[1..99]>
JSR 15
JSR <variable>
JSR @25
The jump can go to any desired NC program in the active NC program
package. The reverse vectors are not changed by a jump to a different
NC program.
Syntax