Advanced & Hidden G/M Codes, CNC Alarms and Troubleshooting FAQ
(Fanuc, Haas, Siemens, Heidenhain, Mazak, Okuma, Mitsubishi, Fagor)
CNC machines are more powerful than most programmers realize. Beneath the surface of standard codes lies a world of hidden, undocumented G/M codes, machine-specific alarm messages, and rare-use instructions that can make or break your precision.
In this detailed guide, we’ll uncover:
- ✅ Hidden G/M codes for major CNC brands
- ⚠️ Common machine alarms and their solutions
- 🔁 Misunderstood functions & how to use them correctly
- ❓ Most-asked CNC G-code troubleshooting questions
🔐 1. Hidden or Rare G/M Codes by Brand
⚠️ Use at your own risk. Always verify with OEM manuals or service engineers before enabling undocumented features.
🔸 Fanuc (All Series)
| Code | Function | Notes |
|---|---|---|
| G10.6 | Dynamic Tool Length Offset Setting | Not available in all controls |
| M198 | Call Subprogram from External Device | Rare in small shops |
| G66.1 | Modal Custom Macro Call | Used for probing loops |
| G53.5 | Rapid Return Without Canceling | Fanuc 30i/31i only |
| G65.1 | Sub-Macro with Variable Parameters | Like G65 but optimized |
🔸 Haas
| Code | Function | Notes |
|---|---|---|
| G187 | Control Tolerance Mode | Affects speed vs accuracy |
| M130 | Display Custom Message on Screen | Good for operator notes |
| M97 | Local Subprogram Call | With line number, no file needed |
| G146 | Rigid Tapping Dwell Control | Only in advanced firmware |
| M119 | Lock Doors for Auto Operation | For safety-critical tasks |
🔸 Siemens
| Code | Function | Notes |
|---|---|---|
| G150 | Dynamic Rotation with CYCLE800 | Only with ShopMill enabled |
| M17X | User-Defined M Codes | Requires PLC setup |
| G801 | Frame Change in Tool Frame | Often used in robot integration |
| G910 | Dynamic 5-Axis Smoothing | Hidden under TRAORI config |
🔸 Heidenhain
| Code | Function | Notes |
|---|---|---|
| M140 | Activate PLC-Controlled Coolant | Not in TNC320 |
| Q parameter macros | Like Fanuc macros | Q1 to Q99 available |
| TOOL DEF w/ ID | Parametric Tool Definition | ID-based tool management |
🔸 Mazak (Mazatrol + EIA)
| Code | Function | Notes |
|---|---|---|
| G35 | Tapping Cycle with RPM Sync | Rarely documented |
| M800/M801 | Sub-Spindle Activation/Deactivation | Integrex/Multi-task only |
| G54.4 | Tool Center Point Control (TCP) | Not default enabled |
⚠️ 2. CNC Alarm Codes & Solutions
These alarms are frequent pain points and often misunderstood:
🟥 Fanuc
| Alarm Code | Meaning | Solution |
|---|---|---|
| 086 | Spindle Malfunction | Check VFD or spindle encoder |
| 300–399 | Servo System Alarms | Axis drive overheating, motor fault |
| 500+ | Custom Macro Alarms | G65 with undefined variables |
| PS 1050 | Tool Offset Out of Range | Check G43 Hxx match |
🟥 Haas
| Alarm Code | Meaning | Solution |
|---|---|---|
| 117 | Spindle Orientation Fault | Encoder or orientation sensor |
| 108 | Servo Error (Axis) | Check motor coupler, feedback |
| 552 | Probe Unexpected Trigger | Adjust trigger tolerance |
| 997 | Macro Variable Out of Range | Check variables in G65/66 |
🟥 Siemens
| Alarm Code | Meaning | Solution |
|---|---|---|
| 210010 | PLC Alarm, Buffer Overflow | Check background tasks/macro |
| 251011 | Tool Length Error in TRAORI | Tool table mismatch |
| 310042 | Drive Not Ready | Axis power or servo drive fault |
❗ 3. G-Code & M-Code Issues: How to Fix Them
🔸 Problem: G43 causes offset error
- Cause: Tool offset not defined in offset table
- Fix: Ensure matching Hxx value (e.g., G43 H1 = Tool #1 data set)
🔸 Problem: G65 runs, but nothing happens
- Cause: Macro variables not passed correctly
- Fix: Use correct variable syntax: G65 P9010 A1 B2 C3 (A, B, C used in O9010)
🔸 Problem: Program skips M06 tool change
- Cause: Automatic tool changer not configured or in manual mode
- Fix: Set machine to AUTO or reset ATC position
🔸 Problem: G28 crashes into part
- Cause: Incorrect retract path (G28 = rapid home)
- Fix: Use safe Z height or replace with G53 Z0
❓ 4. Most Frequently Asked CNC G-code Questions
🟩 Q1: What’s the difference between G90 and G91?
- G90: Absolute positioning
- G91: Incremental positioning
⚠️ Switching between them mid-program without comment is dangerous.
🟩 Q2: What is G54 vs G92?
- G54–G59: Work coordinate systems
- G92: Temporary offset (resets after power cycle)
Use G92 cautiously, can cause ghost offsets.
🟩 Q3: Can you use multiple G-codes on one line?
- ✅ Yes:
G90 G0 X0 Y0 Z0 - ⚠️ But only one code from each group. (e.g., only one motion code: G0 or G1)
🟩 Q4: What’s the safest way to home all axes?
G28 Z0
G28 X0 Y0
Home Z first to avoid dragging the tool through your part!
🟩 Q5: How can I disable coolant during an emergency stop?
- Use M09 before expected tool break or probe contact
- Consider adding M00 safety pause before dry runs
🟩 Q6: How do I run a subprogram with parameters?
G65 P1000 A25 B15
Where O1000 includes:
#1 = #1 + #2
G1 X#1 F100
🔧 Bonus: Macro Debug Checklist
- ✅ Use
#100–#199for user variables - ✅ Verify that tool offsets exist before
G43 - ✅ Print values to screen using
#3006 = 1 ("VALUE: " + #101) - ✅ Always test with dry run and single block
✅ Conclusion
Hidden codes and uncommon alarms are not just for advanced users — they’re essential for every CNC programmer looking to maximize machine potential. Whether you’re writing macros, debugging offsets, or integrating multi-axis tools, understanding these elements will save hours of downtime.
Use this guide as your go-to reference, and document brand-specific behavior for future setups.
📎 Coming Up Next
“Fanuc Custom Macros Explained: Variables, Conditionals & Loops with Real Examples”
Learn how to build intelligent G-code that can think, react, and even self-correct — perfect for complex setups and automation.
Leave a comment