Mastering G67 Custom Macro Modal Call Cancel on CNC Controls
Learn to program the G67 custom macro modal cancel. Compare Fanuc Parameter 3402, Siemens MD 18800, and Mitsubishi parameters to prevent hard collisions.
Failing to program the G67 custom macro modal call cancel command immediately after completing a coordinate sequence leaves the look-ahead motion kernel in an active modal macro execution state. When a modal call (G66 or G66.1) remains active, subsequent travel coordinates—such as retracting to the tool change position or home—will automatically trigger the macro cycle at those clearance coordinates. The tool indexing turret will plunge directly into physical obstacles, causing a sudden hard collision that shatters the cutting tool, damages the axis ball screws, throws high-current overload alarm codes, and generates a ruined scrap part. For programmers accustomed to executing simple custom calls like the G65 custom macro call, modal cycles activated via the G66 custom macro modal call require special cancellation protocols. In applications utilizing high-speed contouring such as G64 cutting continuous path mode, modal macro states must be properly deactivated to avoid unwanted preprocessor stops or motion path deviations.
Technical Summary
| Technical Attribute | Specification Details |
|---|---|
| Command Code | G67 (Custom Macro Modal Call Cancel) |
| Modal Group | Group 12 (Fanuc System A), Group 14 (Fanuc B/C, Siemens ISO Dialect, Mitsubishi) |
| Supported Brands | Fanuc, Siemens, Mitsubishi |
| Critical Parameters | Fanuc Parameter No. 3402 Bit 6 (CLR), Siemens MD 18800, Mitsubishi Parameter #1151 |
| Main Constraint | Must be programmed as a standalone preparatory block. It does not accept coordinate parameters or transfer argument values. |
Quick Read
- Program a standalone G67 command block immediately after completing any coordinate pattern cycle to release the look-ahead motion kernel.
- Verify that Parameter No. 3402 Bit 6 is set to 1 on Fanuc systems to initialize Group 12/14 G-codes to G67 during resets or power-on.
- Switch the Siemens SINUMERIK bilingual interpreter to ISO Dialect mode via G291 to compile G67 blocks.
- Cancel all active modal macro calls prior to executing sub part system controls (G122/G144) to prevent Program Error P652.
- Set Mitsubishi Parameter #1151 rstinit to 1 to ensure the G-code modal group initializes to G67 cancel state upon NC reset.
- Avoid executing G67 commands when no G66 modal call is active to prevent immediate program error halts.
Basic Concepts of Modal Macro Call Cancellation
The primary function of the G67 custom macro modal call cancel command is to release the look-ahead motion kernel from a modal macro execution state, restoring standard block-by-block path execution. When a modal call (G66 or G66.1) is active, the control automatically triggers the designated macro program after every travel block (Modal A) or every single block (Modal B) to execute repeating geometries like bolt-hole arrays or grid patterns. Once the specific coordinate sequence is complete, the programmer must command G67 to cancel the modal state.
Setup operators and programmers must maintain absolute vigilance regarding coordinate values, single-block stops, and active G-code modal states. During manual interventions, such as stopping the machine via single block or feed hold to check tolerances, or if an emergency stop occurs, the modal G-code status is managed by parameters like #1151 rstinit. If a reset is pressed, the control may retain the G66 modal state if #1151 is set to 0. Resuming operation under these uncancelled conditions without issuing a manual G67 cancel can execute a false macro pass, causing the tool to dig into the part and creating a scrap part. Operators must inspect the HMI display modal status screen to confirm that G67 is active (modal call is canceled) before running manual positioning sequences.
Command Structure and Programming Syntax
The syntax for custom macro modal call cancellation is strictly non-argumentative. To prevent block syntax error codes such as Fanuc Alarm PS0033, G67 must be programmed as an independent block. It does not accept coordinates, repeat counts, or local variable arguments, functioning solely as a modal state cancel switch. When the motion kernel parses a G67 block, it terminates subprogram loops and restores standard coordinate interpretation.
Group mapping for the cancellation command is dependent on the G-code system structure. G67 belongs to Group 12 under G-code System A (predominantly lathe systems) and Group 14 under G-code Systems B/C (machining center lists). Modifying default reset states via system parameters enables operators to establish G67 as a safe system startup default, preventing active macro call carryover across program starts.
G67 ;
| Brand | Parameter Reference | Function Description | Value / State Range |
|---|---|---|---|
| Fanuc | Parameter No. 3402 Bit 6 (CLR) | Determines G-code clear state initialization. When set to 1, Group 12/14 defaults to G67. | 0 (not cleared) or 1 (cleared to G67) |
| Fanuc | Parameter #1151 rstinit | Dictates if G67 modal state is initialized or retained during resets. | Binary (0 or 1) |
| Siemens | MD 18800 $MN_MM_EXTERN_LANGUAGE | Must be set to 1 to activate external CNC compiler required for ISO Dialect mode. | 0 (disabled) or 1 (enabled) |
| Siemens | MD 20150 $MC_GCODE_RESET_VALUES | Configures default G-code group states upon power-up or channel reset. | G-code list |
| Mitsubishi | Parameter #1151 rstinit | Configures G67 modal initialization states during NC resets. | 0 (retains) or 1 (initializes to G67) |
| Mitsubishi | Parameter #1296 ext32/bit5 | Enables macro statements batching for continuous axis movement. | 0 or 1 |
Brand-Specific CNC Applications
Fanuc
On Fanuc systems, G67 is assigned to G-code Group 12 or 14. Programmers use Parameter No. 3402 Bit 6 to default the system to G67, and Parameter #1151 rstinit to control reset behavior.
; Fanuc: G67 ; Deactivate macro modal call
| Category | System Item | Description |
|---|---|---|
| Parameters | Parameter No. 3402 Bit 6 (CLR), Parameter #1151 rstinit | Initializes Group 12/14 to G67 on power-on or reset; controls modal retain states. |
| Alarms | Program Error (P232), Alarm PS0033 | P232 triggers if G67 is commanded with no active G66; PS0033 triggers if G67 is not programmed in its own block. |
| Versions | System A, B, and C | G67 is Group 12 in System A (turning) and Group 14 in Systems B/C (milling). |
Warning: Commanding G67 when no modal macro call is active triggers an immediate Program Error (P232) that halts the machine.
Siemens
Siemens SINUMERIK controls compile G67 only in ISO Dialect mode. Programmers activate this compile mode via MD 18800, and configure defaults via MD 20150.
; Siemens: G291 ; Switch to ISO Dialect mode
G67 ; Cancel active macro modal call
G290 ; Switch back to native Siemens mode
| Category | System Item | Description |
|---|---|---|
| Parameters | MD 18800 $MN_MM_EXTERN_LANGUAGE, MD 20150 $MC_GCODE_RESET_VALUES | Enables external ISO dialect language; sets default reset G-code values. |
| Alarms | Alarm 61800, Alarm 12722 | Alarm 61800 triggers if G291 compiler is disabled; Alarm 12722 triggers if concurrent subroutine calls are parsed in a single line. |
| Versions | SINUMERIK 840D sl vs. 802D sl | 840D sl supports widescreen display layouts and active collision checks, while 802D sl has locked machine parameter data. |
Warning: Attempting to toggle to ISO Dialect mode G291 when MD 18800 is set to 0 will cause Alarm 61800 and disable translation.
Mitsubishi
Mitsubishi controls group G67 under Group 14. Programmers check Parameter #1151 rstinit and Parameter #1296 ext32/bit5 to adjust execution.
; Mitsubishi: G67 ; Cancel Group 14 modal macro call
| Category | System Item | Description |
|---|---|---|
| Parameters | Parameter #1151 rstinit, Parameter #1296 ext32/bit5 | Configures Group 14 modal reset initialization; switches macro calls between statements and executables. |
| Alarms | Program Error, Program Error (P728) | Program Error triggers if G67 is commanded without an active G66; P728 triggers if Group 14 commands occur inside machining interruption programs. |
| Versions | M80V Type B Series, Legacy M2/M0 Format | M80V Type B series restricts advanced G-codes during active modal macro calls; M2/M0 format supports legacy sub calls. |
Warning: Commanding G67 inside a machining interruption/retraction program will trigger Program Error (P728) and stop axis recovery.
Cross-Brand Comparison and Parameter Mapping
| Comparative Topic | Fanuc | Siemens | Mitsubishi |
|---|---|---|---|
| Modal G-Code Group | Group 12 (System A) / Group 14 (Systems B/C) | Group 12 (System A) / Group 14 (Systems B/C in G291) | Group 14 (Group 14 or 19 in milling) |
| Compiler Environment | Single continuous interpreter | Bilingual toggled compiler (G290 native, G291 ISO Dialect mode) | Single compiler, format swappable with G188/G189 |
| Variable Structure | Local variables #1 to #33 | Structured system variables prefixed with $C_ (discards hashes) | Local variables #1 to #33 |
| Program Number Format | Standard P (program number) and L (repetition) | Machine data MD 18800 and $MC_EXTERN_FUNCTION_MASK configuration | Parameter #8129 and #1241 validate L/P as arguments |
| Retraction / Rollback | No handwheel rollback recovery | Zero offsets and modals are deselected during native frame rollback | Manual arbitrary reverse run (G127) tracks modals using modal storage block |
Technical Analysis of Compiler and Variable Handling
The internal logic of macro cancellation reveals fundamental differences in how Fanuc, Siemens, and Mitsubishi handle local registers and compilers. Fanuc and Mitsubishi controls use a flat variable mapping structure (variables #1 through #33) to pass G66/G65 transfer parameters. Siemens, conversely, discards this flat registry in its native mode, adopting a structured format using $C_ system variables (such as $C_A through $C_Z and $C_I[0..9]), which enforces an object-oriented macro environment.
Interpreter execution also varies across brands. Siemens requires a bilingual compiler toggle using G291 to compile ISO-style G66/G67 blocks, whereas Fanuc parses macro calls natively within a single continuous interpreter flow. Mitsubishi utilizes a dynamic Program Format Switch (G188/G189) that switches modal macro call structures dynamically between turning (lathe format) and milling (machining center format) systems.
Coordinate recovery is another differentiator. Mitsubishi supports manual arbitrary reverse run (G127), which uses a modal information storage block to track active macro modal positions and offsets during handwheel rollback. Fanuc has no equivalent handwheel rollback tracking, and Siemens completely deselects active zero offsets and modals during native frame rollback.
Part Program Examples and Verification Guides
Fanuc Programming Example
G90 G54 G00 X0 Y0 Z10.0 ; Absolute coordinates
G66 P1234 A10.0 B20.0 ; Activate modal macro call to program O1234
X50.0 Y50.0 ; Travel block 1, triggers subprogram O1234
X100.0 Y100.0 ; Travel block 2, triggers subprogram O1234
G67 ; Cancel the modal macro call
G00 X0 Y0 ; Return home without triggering the macro
Dry Run Procedure: Prior to machining, load the subprogram O1234 and main program. Activate dry run and single-block mode on the operator control panel. Step through the program and verify on the position display screen that the subprogram triggers precisely at the coordinate endpoints of the movement blocks. Confirm that the G67 command block executes before the return home move, verifying that the tool does not execute a false macro pass that would drive the turret into workholding clamps.
Siemens Programming Example
G291 ; Switch to ISO Dialect Mode
G90 G54 G00 X0 Y0 Z10.0 ; Absolute coordinates
G66 P0100 A10.0 B20.0 ; Activate modal macro call to program O0100
X50.0 Y50.0 ; Travel block, triggers subprogram O0100
X100.0 Y100.0 ; Travel block, triggers subprogram O0100
G67 ; Cancel the modal macro call
G00 X0 Y0 ; Return home safely
G290 ; Switch back to native Siemens mode
Dry Run Procedure: Verify that MD 18800 is active. Set the dry run speed override to a low value. Run the program in single block mode. Monitor the G-group display on the SINUMERIK screen to ensure the modal G66 is cleared to G67 during the cancel block. Verify that the axis returns to G54 X0 Y0 without executing the SPF0100 subprogram at the clearance boundary.
Mitsubishi Programming Example
G90 G54 G00 X0 Y0 Z10.0 ; Absolute coordinates
G66 P1000 A10.0 B20.0 ; Activate modal macro call to program O1000
X50.0 Y50.0 ; Travel block, triggers subprogram O1000
X100.0 Y100.0 ; Travel block, triggers subprogram O1000
G67 ; Cancel modal macro call in Group 14
G00 X0 Y0 ; Return home safely
Dry Run Procedure: Verify that parameter #1241 set13/bit5 is enabled. Run the program in dry run mode. If the tool path deviates, use the manual arbitrary reverse run (G127) handwheel to back the axis up. Verify that active coordinates are tracked correctly in the modal information storage block. Verify that G67 cancels Group 14 modals before home retraction.
Troubleshooting and Error Analysis
| Brand | Alarm Code | Trigger Condition | Operator Symptom | Root Cause / Fix |
|---|---|---|---|---|
| Fanuc | Program Error (P232) | Commanding G67 when no corresponding G66 or G66.1 modal macro call is active. | The NC console flashes a program error message and halts automatic cycle execution. | Ensure G66 or G66.1 is active before commanding G67; remove redundant cancel blocks. |
| Fanuc | Alarm PS0033 | G67 is not programmed in an independent block (e.g. programmed on same line as coordinate movements). | System halts immediately with Alarm PS0033 (Block Syntax Error) on the display. | Program G67 in its own standalone block without any other coordinate or M-code commands. |
| Siemens | Alarm 61800 | G291 interpreter switch or G67 command is issued when MD 18800 is disabled. | The SINUMERIK screen displays "External CNC language option missing" and halts processing. | Set machine data MD 18800 $MN_MM_EXTERN_LANGUAGE to 1 to enable bilingual compiling. |
| Mitsubishi | Program Error (P728) | Commanding G66, G66.1 or G67 inside a machining interruption/retraction program. | The display flashes a program error code and halts the axis retraction sequence. | Do not program Group 14 G-codes inside retraction or machining interruption routines. |
Best Practices and Application Notes
Catastrophic hard collisions, shattered tool bodies, and expensive machine spindle damage are the direct consequences of failing to verify G67 cancel modal status during manual interventions or NC resets. If the machine is stopped via single block or emergency stop, the active macro modal state remains stored in memory if Parameter No. 1151 rstinit is set to 0. Prior to resuming the automatic cycle or moving the axes manually, operators must inspect the HMI screen to confirm that G67 is displayed in the active modal table, verifying that the control has successfully deactivated the G66/G66.1 loop.
Related Command Network
- G65 (Simple Custom Macro Call): Executes a subprogram once for a single block and does not require G67 to cancel it.
- G66 (Custom Macro Modal Call A): Activates the modal macro call state which G67 is designed to deactivate.
- G64 (Continuous Path Mode): Enables continuous path blending between movement blocks, which can be interrupted by uncancelled macro preprocessor stops.
- G61 (Exact Stop Mode): Forces exact coordinate check stops between modal macro iterations to ensure high geometric precision.
Conclusion
Strict adherence to G67 programming discipline, combined with correct parameter configuration, forms the primary defense against unexpected motion paths. Restricting G67 to standalone blocks, verifying HMI modal lists during setup, and enabling power-on default parameters ensure that CNC machining centers transition safely between macro cycles and standard path moves.
Frequently Asked Questions
Why does the CNC control trigger a program error when G67 is commanded?
A program error occurs if the G67 cancel command is parsed when no corresponding G66 or G66.1 modal macro call is active. Programmers can resolve this by inspecting the G-code sequence to ensure that G67 is only called after a modal macro has been initiated, and removing any redundant cancel blocks.
How does Parameter No. 3402 Bit 6 affect G67 initialization?
This parameter determines whether G-code Group 12/14 is initialized to G67 upon control power-on or system reset. When set to 1, the control automatically clears any active modal macro calls during reset or start-up, providing a fail-safe state that prevents accidental tool movements.
Can G67 be programmed on the same block as a motion command?
No, programming G67 in the same block as a motion command or coordinate values triggers syntax alarms like Alarm PS0033. To prevent tool trajectory errors and immediate program stops, G67 must always be programmed in its own standalone block.
Still not resolved?
Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

- CNC CARE Co-Founder (May 2025 - Present)
- Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
- Reis CNC Service Engineer (2003 - 2008)
- Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)
With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.
Related Articles
Other articles on this topic
G71 Metric Dimensioning Guide for Siemens SINUMERIK Controls
Learn how to program G71 and G710 metric dimensioning on Siemens SINUMERIK controls, including parameter MD 10240, alarm codes, and G-code syntax errors.
G69 Balance Cut Cancel: Coordinate Recovery & Crash Prevention
Learn how to program the G69 balance cut cancel command for Fanuc, Siemens, and Mitsubishi turning centers. Cancel dual slide synchronization and prevent crashes.
G70 CNC Finishing Cycle Guide for Fanuc, Siemens, and Mitsubishi
Learn the G70 finishing cycle for CNC turning. Master syntax, parameters, and alarm codes for Fanuc, Siemens CYCLE95, and Mitsubishi controls to avoid crashes.
G69 Coordinate System Rotation Cancel: Modals, Alarms, and Setup
Learn to cancel G68 facing turret mirrors and coordinate rotations using G69 on Fanuc, Siemens, and Mitsubishi CNCs to prevent turret crashes.