Section 4 System Programming 61
The subroutine definition begins with the letter "O" followed immediately by the subroutine name with no spaces. The subroutine must end with the M99 command as shown. M99 causes program execution to jump back to the main program, continuing with the line immediately following the M98 line (G01 X0 Y0 above).
The main program must end with M02, the "End of Program" command. M02 is not required in a
You may use as many subroutines as you like, but each must have a unique name within the program file. If necessary, you can "nest" subroutines, meaning one subroutine may call another subroutine, which in turn may call another subroutine, and so on.
MXX – Miscellaneous Device Control
Using the Output Lines Setup dialog box you can define up to 16 M codes to turn on or off different devices through the output lines. M Codes can also be used for digital control of devices by turning on or off a group of output lines to be used as digital input into the control lines of the device. See “Output Lines Settings” in the Initial Setup section for details on how to set up the M codes.
Popular M codes include:
M03 Spindle On
M05 Spindle Off
M07 Mist Coolant On
M08 Flood Coolant On
M09 Coolant Off
F Feedrate Command
The F command is used to designate a feedrate. The feedrate set with the F command is modal (stays in effect until another F command occurs). Specify the feedrate in inches/minute for English units and millimeters/minute for Metric units.
Example:
G01 X4.0 Y3.0 Z1.0 F7.0 Moves the tool to Program Coordinate X=4.0, Y=3.0, Z=1.0 at a feedrate of 7.0 in/min
Program Comments
You can add comments to your program by enclosing them in parentheses. LC ignores anything enclosed in parentheses as shown below.
Example: