218
M CODES
96-8000
June 1999
M96 Jump If No Input
P Block to branch to when conditional test succeeds
Q Discrete input to test, 0..31
This code is used to test a discrete input for 0 status. When this block is executed and the input signal
specified by Q is 0, a branch to the block specified by P is performed. A Pnnnn code is required and must
match a line number within the same program. The Q value must be in the range of 0 to 31. These correspond
to the discrete inputs found on the diagnostic display page with the upper left being input 0 and the lower right
being 31. Q is not required within the M96 block. The last specified Q will be used. This command stops the
lookahead queue until the test is made at runtime. Since the lookahead queue is exhausted, M96 cannot be
executed when cutter compensation is invoked. M96 cannot be executed from a main DNC program. If you
wish to use M96 in DNC, it must be in a resident subroutine called from the DNC program.
The following is an M96 example:
N05 M96 P5 Q8 (TEST INPUT DOOR S, UNTIL CLOSED);
N10 (START OF SOME PROGRAM LOOP);
.
. (PROGRAM THAT MACHINES PART);
.
N85 M21 (EXECUTE AN EXTERNAL USER FUNCTION)
N90 M96 P10 Q27 (LOOP TO N10 IF SPARE INPUT IS 0);
N95 M30 (IF SPARE INPUT IS 1 THEN END PROGRAM);
M97 Local Sub-Program Call
This code is used to call a subroutine referenced by a line N number within the same program. A Pnnnn code
is required and must match a line number within the same program. This is useful for simple subroutines within
a program and does not require the complication of a separate program. The subroutine must still be ended
with an M99. An L count on the M97 block will repeat the subroutine call that number of times.
M98 Sub Program Call
This code is used to call a subroutine. The Pnnnn code is the number of the program being called. The Pnnnn
code must be in the same block. The program by the same number must already be loaded into memory and it
must contain an M99 to return to the main program. An L count can be put on the line containing the M98 and
will cause the subroutine to be called L times before continuing to the next block.
M99 Sub Program Return Or Loop
This code is used to return to the main program from a subroutine or macro. It will also cause the main pro-
gram to loop back to the beginning without stopping if it is used in other than a subprogram without a P code. If
an M99 Pnnnn is used, it will cause a jump to the line containing Nnnnn of the same number.
M99 Pnnnn in the HAAS control varies from that seen in FANUC compatible controls. In FANUC compatible
controls M99 Pnnnn will return to the calling program and resume execution at block N specified in Pnnnn. For
the HAAS control, M99 will NOT return to the calling program, but instead will jump to block N specified in
Pnnnn in the current program.