Yaskawa J50M Instructions User Manual
Page 26

2.8.7
SUBROUTINE PROGRAM (M98, M99)
With this function , call of subroutine programs
which have been numbered and stored in advance
is made and executed as many times as desired.
The following M codes are used for this function.
M code
Meaning
M98
Call of subroutine program
M99
Subroutine program end
Call of subroutine program
M98
.
. ;
With this command, call of the subroutine pro-
gram with the number specified after P is made
and is executed number of times specified after
L .
When no L code is programmed, the sub-
routine is executed once.
Subroutine programs can be nested up to 4
times.
EXAMPLE
Call of subroutine program and execution of it
are made in the
shown below.
Main program
0100 ;
GOO . . . . ;
P200 L3 ; –
NO03
;
NO04 M98 P200 ; —
. . . . ;
. Special use of M99
M99 P.. . ;
Format of subroutine program
Subroutine programs are written in the
in g format, and are stored in the part program
memory in advance.
Automatic return command from
gram
With this command,
the main program does not
return to the block following the M 98 block after
executing the subroutine program , but returns
to the block with a sequence No. specified by
the P code.
Notes :
If the program number specified by the P code
is not found, this
is
regarded as an error “041.
While a subroutine program is repeated L times,
the number of remaining repetitions may be
o
;
. . .
—
. . . . . . . . . . . . . . .;
. . . . . . . . . . . . . . .;
. . . . . . . . . . . . . . .;
;
—
Program No.
M99 ;
At the end of subroutine programs, M99 is
written in a block of its own.
When M99 is
commanded in the subroutine program which
has been called by M98, the execution
the
main program is automatically restarted at the
block immediately following the M98 block.
Subroutine
program end.
subroutine
Subroutine program
0200 ;
;
NO02
. ;
N050 M99 ;
displayed.
For details , refer to
D I S P L A Y
A N D
w R I T I N G
O P E R A T I O N
.
This function is usable when subroutine pro-
grams are stored in the part program memory.
The main program can either be commanded
from NC tape or the part program memory.
When the nesting of subroutine programs is
attempted more than 4 times, an error state is
caused.
Commanding
in main
the execution of the program to the head of the
main program and control endless operation.
18