M19

Machining center, Lathe

Spindle orientation (oriented spindle stop)

Format and notes

M19

Example

T05 M06 ; (TOOL CHANGE ORIENTS BY ITSELF ON HAAS)
M19 ; (ORIENT SPINDLE)
M00 ; (STOP: CHECK THE BORING BAR EDGE)
S800 M03 ; (M03 ENDS THE ORIENTATION)
G90 G54 G00 X0 Y0 ;
G43 H05 Z10. ;
G98 G76 Z-20. R2. Q0.2 F60 ; (ORIENT AT BOTTOM, SHIFT 0.2)
G80 ;

An example that orients the spindle with M19 before fine boring, and while stopped at M00 checks that the boring bar's cutting edge faces the direction opposite to the clearance direction. G76 orients the spindle itself at the hole bottom, shifts by Q0.2 away from the cutting edge, then retracts. The shift direction is set by a machine parameter (Haas Setting 27). The values are for illustration and are not recommended values.

Most M codes are assigned by the machine builder (the Siemens ISO dialect manual leaves M00–M89 to the machine tool maker). The same number can mean different things on different machines, so always check your machine’s manual.

Differences between controls and machines

The same code can be written or assigned differently depending on the CNC control and the machine builder. Always check your machine’s manual.

SourceMachineItemDetail
HaasLatheNotesOptional on lathes. The sub-spindle uses M119
Siemens (native)—FormatSPOS=angle (degrees) can also stop the spindle at a set angle. M19 stops at the angle set in machine data
HaasMachining centerNotesSpecifying the angle with P or R is optional. Without the option, the spindle stops only at the 0° position. Negative values are ignored and it stops at 0°

Frequently asked questions about M19

What is M19 (Spindle orientation (oriented spindle stop)) used for and how is it formatted in a CNC program?
M19 commands "Spindle orientation (oriented spindle stop)" on Machining center, Lathe. The standard program format is "M19". Stops the spindle at a fixed angle. Used for the shift in fine boring (G76) and back boring (G87), and for tool changes
Is M19 a modal code or a one-shot (non-modal) code?
Whether M19 acts modally or as a single-block command depends on the CNC control and the machine builder’s PLC ladder implementation. Check your machine’s active modal status screen and programming manual before running in auto mode.
Does M19 work differently on machining centers (mills) versus CNC lathes?
M19 is primarily used on Machining center, Lathe. Depending on the machine type and the lathe G-code system (System A, B, or C), this code may be unavailable or assigned to a different function, so verify against your machine tool manual.
Are there differences in M19 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
Yes. Control builders such as FANUC, Mitsubishi Electric (M80/M800), Okuma (OSP), Haas, Mazak, Siemens (SINUMERIK ISO dialect), and Heidenhain can differ in argument letters, decimal-point rules, and optional parameters for M19. Review the control comparison table above and verify the exact syntax in your machine’s programming manual before proving out the program.

Sources

The meaning of this code agrees in two or more sources from different publishers. Explanations are written in our own words.

  1. Haas Automation, Inc. — Mill Operator's Manual – 18 Mill M-Codes (online version) haascnc.com
  2. Haas Automation, Inc. — Lathe Operator's Manual – 17 Lathe M-Codes (online version) haascnc.com
  3. Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0) cache.industry.siemens.com
  4. Siemens AG — SINUMERIK 840D sl/840D/840Di sl/810D Fundamentals, Programming Manual, Edition 08/2005 (6FC5398-1BP10-0BA0) cache.industry.siemens.com
  5. Haas Automation, Inc. — G-code, M-code, and Setting (per-code explanation pages) haascnc.com