Printed from Kezuriba (kezuriba.net/en/nc/m19/)
M19
Machining center, LatheSpindle orientation (oriented spindle stop)
Format and notes
M19
- Stops the spindle at a fixed angle. Used for the shift in fine boring (G76) and back boring (G87), and for tool changes
- The number assignment depends on the machine builder. Haas allows the angle to be specified with P/R
- Difference from M05: M05 only stops rotation and does not define the stopping angle. M19 switches the spindle to position control and stops it at a set angle. The M19 stop angle is set by a machine parameter (machine data M19_SPOS in the Siemens ISO dialect)
- In the Siemens native-mode manual, M19 does not move to the next block until the position is reached, and position control continues until the next M3, M4, M5 or M41–M45
- Tool change: Haas M06 automatically stops the spindle and coolant, moves Z to the change position and orients the spindle, so you do not need to write M19 before the change
- Fine boring (G76) and back boring (G87) orient the spindle inside the cycle and shift by Q away from the cutting edge before moving. The shift direction is set by a machine parameter (Haas Setting 27, GUD in the Siemens ISO dialect), so mount the tool so that the cutting edge points the opposite way. If the direction is wrong, the edge hits the hole wall during the move that is supposed to clear it
- Write Q of G76 and G87 as a positive value (a negative sign is ignored). Q is a modal value and is also used for the depth of cut per pass in G73 and G83, so when you change cycles, check that the previous value is not left over (Siemens ISO dialect)
- Optional on lathes depending on the machine. Haas says spindle orientation on a lathe is affected by the weight, diameter and length of the workpiece and chuck
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.
| Source | Machine | Item | Detail |
|---|---|---|---|
| Haas | Lathe | Notes | Optional on lathes. The sub-spindle uses M119 |
| Siemens (native) | — | Format | SPOS=angle (degrees) can also stop the spindle at a set angle. M19 stops at the angle set in machine data |
| Haas | Machining center | Notes | Specifying 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.
- Haas Automation, Inc. — Mill Operator's Manual – 18 Mill M-Codes (online version) haascnc.com
- Haas Automation, Inc. — Lathe Operator's Manual – 17 Lathe M-Codes (online version) haascnc.com
- 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
- Siemens AG — SINUMERIK 840D sl/840D/840Di sl/810D Fundamentals, Programming Manual, Edition 08/2005 (6FC5398-1BP10-0BA0) cache.industry.siemens.com
- Haas Automation, Inc. — G-code, M-code, and Setting (per-code explanation pages) haascnc.com