8 Basic CNC Programming
8.4 NC Codes
121
Spindle and
Axis Motor
Group
M03
Spindle Motor On
Activated concurrently with motion specified in the program block; remains in effect
until superseded by M05.
M05
Spindle Motor Off
Activated after the motion specified in the program block; remains in effect until
superseded by M03.
M38
Drive Motors Standby
Typically used to turn the drive motors to standby (low power) before a pause (G05);
activated after the motion specified in the program block. M38 is useful when the
machine is left unattended for a long time, such as the interval before reloading a part.
Tool Change
Group
M06
10.3 Writing an NC Program for Multiple Tools, pg. 147)
I/O Group
M25
Sets the output specified by the H command to On.
Used for robot synchronization. Use the H code to specify an output (see
lnput Selection Number, pg. 116).
See
12 Automation lntegration, pg. 166
M26
Sets the output specified by the H command to Off.
Used for robot synchronization. Use the H code to specify an output (see
lnput Selection Number, pg. 116).
See
12 Automation lntegration, pg. 166
Program
Management
Group
M20
Chain to Next Program
This code is used to chain several NC files together. It is placed at the end of a part
program and is followed on the next line by the file name of another program to be
executed when all motion stops.
Below is an example of a part program chain to another program:
N37 Z.2 N38 M20
PROGRAM2.NC; Chain to PROGRAM TWO
If the two programs you are chaining are not in the same directory on your computer,
you must specify the full path name for the next program file. If the software cannot
locate the specified file, you will be prompted to find it.
M22
Output current position or other information to file. See
Current Position to File, pg. 122.
M47
Rewind
Restarts the currently running program; takes effect after all motion comes to a stop.
Typically used with an L code to repeat a program a set number of times.