O01000 (M98 SUB) (Sub Program Number)
G01 G91 Z-0.1
G90 X2.
G91 Z-0.1
G90 X0
M99
M99 Sub-Program Return or Loop
This code is used to return to the main program from a subroutine or macro,
the format is M99 Pnnnn (Pnnnn is the line in the main program to return to).
It will cause the main program to loop back to the beginning without stopping
when used in the main program.
Programming Notes - Fanuc behavior is simulated by using the following
code:
calling program: Haas Fanuc
O0001 O0001
... ...
N50 M98 P2 N50 M98 P2
N51 M99 P100 ...
... N100 (continue here)
N100 (continue here) ...
... M30
M30
subroutine: O0002 O0002
M99 M99 P100
M99 With Macros - If the machine is equipped with the optional macros, use
a global variable and specify a block to jump to by adding #nnn=dddd in the
subroutine and then using M99 P#nnn after the subroutine call.
M104 Extend Probe Arm / M105 Retract Probe Arm
Used in a program to extend or retract the probe arm.
M109 Interactive User Input
This M code allows a G-code program to place a short prompt (message) on
the screen. A macro variable in the range 500 through 599 must be specied
by a P code. The program can check for any character that can be entered
from the keyboard by comparing with the decimal equivalent of the ASCII char-
acter (G47, Text Engraving, has a list of ASCII characters).
The following sample program will ask the user a Yes or No question, then wait
for either a “Y” or an “N” to be entered. All other characters will be ignored.
N1 #501= 0. (Clear the variable)
N5 M109 P501 (Sleep 1 min?)
IF [ #501 EQ 0. ] GOTO5 (Wait for a key)
IF [ #501 EQ 89. ] GOTO10 (Y)
IF [ #501 EQ 78. ] GOTO20 (N)
GOTO1 (Keep checking)