Skip to main content
CNC.wikiCNC.wiki

G31 Skip Function and CNC Probe Programming: Fanuc, Siemens, Mitsubishi

Master G31 skip function and probe programming on Fanuc, Siemens, and Mitsubishi CNCs. Prevent crashes, resolve alarms, and configure servo lag parameters.

Hakan Gündoğdu
Hakan Gündoğdu

CNC CARE Co-founder

Introduction: Collision Risks and Failure Scenarios in Probing Cycles

Executing an automated probe measurement cycle while tool radius compensation remains active, or traversing a touch probe toward a workpiece while the machine lock or Z-axis cancel switch is mistakenly enabled, introduces an immediate risk of a catastrophic high-speed collision. When the CNC controller executes a G31 skip block under these conditions, it may ignore the probe's electrical trigger or throw an abrupt PS0035 or P608 alarm, stopping all coordinate travel instantly. If the safety signal is bypassed or delayed, the delicate stylus travels past its physical overtravel limit, driving the touch probe violently into a chuck, a vise jaw, or a workpiece clamp. This sudden mechanical impact bends the live-tool spindle shaft, shatters the sapphire stylus tip, and damages expensive drive components—ruining the inspection hardware, stopping the production line, and producing a completely scrapped workpiece.

Technical Summary of G31 Skip Function

FeatureSpecification
Command CodeG31
Modal GroupNon-modal (One-shot) Group 00 G-code
Compatible BrandsFanuc, Siemens, Mitsubishi
Critical ParametersFanuc: 6200#7 (SKF), 6201#0 (SEA), 6201#1 (SEB), 6281 · Siemens: $MN_EXTERN_MEAS_G31_P_SIGNAL, MD13231 $MN_MEAS_PROBE_OFFSET · Mitsubishi: #2102 skip_tL, #2103 skip_t1, #1174 skip_F
Main ConstraintProbing with active tool radius compensation (G41/G42) is strictly prohibited (must cancel with G40); servo lag / coasting distance must be accounted for mathematically; and machine lock / coordinate cancel switches must be disabled.

Quick Read: Probing Constraints and Best Practices

  • Always deactivate all tool radius and tool nose compensation modal states using G40 before commanding G31 to prevent immediate PS0035 (Fanuc) or P608 (Mitsubishi) alarms.
  • Account mathematically for servo system positional deviation and lag, utilizing Fanuc's automatic SEA (6201#0) and SEB (6201#1) parameters to prevent logged coordinates from shifting out of tolerance.
  • Ensure the machine lock and Z-axis cancel switches are fully disabled during probing cycles, otherwise the controller will ignore the physical skip signal and plunge the probe directly into the fixture.
  • Program an explicit feedrate (F) value or set a non-zero default feedrate parameter (like Fanuc 6281 or Mitsubishi #1174) to avoid triggering a P603 alarm when the feedrate is omitted.
  • Verify that physical touch probe contacts are clear and cables are undamaged before starting the cycle to avoid triggering a Siemens 21700 stuck-probe alarm.
  • Perform a manual retract move (G00 or G01) to a safe coordinate position immediately after any program RESET or emergency interruption to override the bypassed collision monitoring on Siemens controls.

Basic Concepts of the G31 Skip Function

The practical programming effect of the G31 skip function is the ability to create highly intelligent, self-correcting machining cycles through automated workpiece measurement. When the controller executes a G31 block, it moves the axis exactly like a standard G01 linear feed. However, the moment an external skip signal (such as a physical touch probe contacting the workpiece) is received, the CNC immediately halts the remaining axis movement, clears the rest of the block's travel distance, and permanently records the exact absolute machine coordinates at the moment of contact into dedicated system variables. Programmers then use custom macros to read these stored coordinate variables, allowing the machine to dynamically adjust tool offsets, establish part zero, or verify part geometry before proceeding to the next cut without human intervention.

When utilizing the skip function, programmers and operators must be exceptionally vigilant regarding the physical dynamics of the servo system and the modal state of the controller. Because the CNC records the current position the instant the skip signal is received, the raw stored value inherently contains a slight delay incurred by the servo system's positional deviation. A common failure cause is neglecting to set built-in parameter compensations to mathematically account for this lag. If this delay is ignored, the machine logs an inaccurate contact point. When this flawed data is fed into an offset macro, it pushes the tooling out of tolerance, resulting in a scrapped part. Worse, an inaccurate workpiece offset calculation can cause the machine to plunge too deeply on a subsequent pass, driving the turret or the spindle violently into the chuck, a vise jaw, or a workpiece clamp, resulting in a catastrophic hard collision.

To protect the machine, the control's internal safety logic aggressively monitors the G-code environment. Before initiating any automated probing cycle, operators must ensure that all coordinate transformations such as G12.1 polar coordinate interpolation or G07.1 cylindrical interpolation are completely canceled. These kinematic transformations modify the coordinate interpretation in the background, and executing a G31 measurement move while they are active will trigger system alarms or cause unpredictable path deviations. Similarly, any complex machining macros called via G65 macro call commands must explicitly verify that tool radius compensation (G41/G42) has been fully deactivated using a G40 block before invoking the skip command, ensuring the probe stylus is never subjected to destructive lateral compensation moves.

Command Structure and Syntax across CNC Brands

The G31 command is programmed as a non-modal, one-shot instruction. This means it only remains active in the specific program block in which it is written. In its simplest form, the command is written with axis target coordinates and a feedrate. The CNC begins a linear coordinate interpolation toward the designated target point at the programmed feedrate, while continuously monitoring the external electrical skip signal channel. If the target coordinate is reached without receiving a trigger signal, the program will simply proceed to the next block.

If the probe makes physical contact with the workpiece or fixture during the move, the external sensor sends a voltage transition to the CNC's high-speed input terminal. The controller's kernel instantly captures the exact axis position, cancels the remaining coordinate travel distance (referred to as deleting the distance-to-go), and skips directly to the next block of G-code. This rapid response prevents excessive pressure on the touch probe tip. The captured coordinate data is immediately stored in system variables, where it can be read by custom measurement macros.

Command Syntax Formats:

  • Fanuc System Format: G31 IP_ F_ [P_] ; (Where IP represents the target coordinate axes, F is the feedrate, and optional P selects the skip signal input)
  • Siemens System Format: G31 X... Y... Z... F... [P...] ; (Where X, Y, Z are target coordinate endpoints, F is feedrate, and optional P selects the probe input)
  • Mitsubishi System Format: G31 Xx1 Yy1 Zz1 αα1 [Rr1] [Ff1] ; (Where X, Y, Z, α represent coordinate axes, optional R controls acceleration profile, and F is the skip feedrate)
Address / ParameterCNC SystemDescriptionAllowable Range
IP / X, Y, Z, αFanuc, Siemens, MitsubishiTarget coordinate coordinates for the linear probing move.Real numbers
FFanuc, Siemens, MitsubishiThe probing feedrate in mm/min. Must be non-zero.Real numbers
PFanucSpecifies the skip signal input (P1..P4 or P1..P8).Value range 1 to 8
PSiemensSelection of probe input (P1..P4).Value range 1 to 4
RMitsubishiAcceleration profile command. R0 for step-stop, R1 for smooth deceleration.0 or 1
PMitsubishiSkip signal combination (used with D1 logical AND).Value range 1 to 255
DMitsubishiSkip signal method. D1 for Multiple Skip, D0/omit for standard.0 or 1

Brand-Specific Applications and Configurations

Fanuc Applications

In Fanuc systems, G31 is highly configurable through system parameters. The high-speed skip signal is mapped directly to hardware inputs and is managed by Parameter 6200#6 to dictate the trigger edge.

A typical Fanuc skip block is written as G31 Z-50.0 F120; or utilizing the multi-stage input G31 X100.0 F80 P3; to monitor a specific probe channel. The controller automatically terminates the travel block when the corresponding probe closes or opens, depending on the SRE bit configuration.

CategoryFeature / IdentifierTechnical Specifications
ParameterParameter 6200#7 (SKF)Disables (0) or enables (1) dry run, override, and automatic acceleration/deceleration.
ParameterParameter 6201#0 (SEA)Enables (1) automatic Type A servo lag compensation.
ParameterParameter 6201#1 (SEB)Enables (1) automatic Type B servo lag compensation.
ParameterParameter 6281Sets the default skip feedrate (0.0 to 999000.0 mm/min) when active. Only active if SFP is 1.
ParameterParameter 6207#1 (SFP)Enables (1) usage of feedrate set in parameter 6281.
ParameterParameter 6200#6 (SRE)Sets trigger edge: rising edge (0) or falling edge (1).
Alarm CodeAlarm PS0035Probing with active Group 07 tool radius compensation (G41/G42), or unspecified torque limit skip.
Alarm CodeAlarm PS0369G31 format error (torque skip with no axis, 2+ axes, or Q out of 1-254 range).
Alarm CodeAlarm PS0370Multi-step skip P value outside 1-8, or option not present.
Alarm CodeAlarm 211G31 high-speed skip commanded in per-revolution feed mode (G99).
VersionsSeries 15 vs Series 16i/18i/21iM-series supports G31.8 EGB skip for synchronizing axis skipping. Multi-probe option maps P1-P8 via parameters 6270 to 6273.

Warning: Operating the CNC in per-revolution feed mode (G99) while executing a high-speed G31 cycle will instantly trigger an Alarm 211. Always program a G98 block to switch to feed-per-minute mode before executing probe movements, protecting the delicate physical probe stylus from high-speed collision.

Siemens Applications

Siemens controls execute G31 using direct kinematic measurements that map to the NCK kernel. These digital inputs are mapped using system parameters like MD13231 to set probe switching offsets.

A typical Siemens measurement block is written as G31 G91 Z-30.0 F100 P2; where the P parameter selects probe input 2. If a physical switch occurs, the NCK immediately calculates the remaining coordinate travel and skips to the next block.

CategoryFeature / IdentifierTechnical Specifications
Parameter$MN_EXTERN_MEAS_G31_P_SIGNAL[0..3]Maps P1..P4 probe inputs to digital probe hardware signals.
ParameterMD13231 $MN_MEAS_PROBE_OFFSETMoves MEAS switching position (must be less than the total measuring distance).
Alarm CodeAlarm 21700Probe signal already active (probe deflected or stuck at start of block).
Alarm CodeAlarm 61301Probe not switching (measuring distance traversed without probe trigger).
Alarm CodeAlarm 61302Probe collision (unexpected switching signal during intermediate approach positioning).
Alarm CodeAlarm 14060Block skip level programmed is less than 1 or greater than 9.
VersionsSINUMERIK 828D/808D vs 840DMulti-probe function G31 P1..4 is not available on 828D/808D models. Standard G31 is available.

Warning: If the measuring stylus unexpectedly contacts an obstacle during intermediate approach positioning, the NCK instantly triggers Alarm 61302. Operators must verify the target zone is clear and use a safe approach distance to prevent physical damage to the expensive probe.

Mitsubishi Applications

Mitsubishi CNC systems handle G31 skip commands by integrating the R address to configure the deceleration profile. The response is governed by parameters like #2102 and #2103 to handle acceleration delay.

A standard Mitsubishi skip block is written as G31 X-150. R1 F50; which enables soft deceleration upon signal trigger, or G31 D1 P3 Z20. F20; to execute an AND multiple skip logic on designated sensors.

CategoryFeature / IdentifierTechnical Specifications
ParameterParameter #2102 (skip_tL)Linear skip time constant for variable speed skip deceleration (0 to 4000 ms).
ParameterParameter #2103 (skip_t1)Primary delay skip time constant for soft acceleration/deceleration (0 to 4000 ms).
ParameterParameter #1174 (skip_F)Default G31 skip feedrate when F is omitted from the G-code block (1 to 999999 mm/min).
ParameterParameter #1366 (skipExTyp)Multi-system simultaneous G31 operation command (0 or 1).
Alarm CodeAlarm P601Skip specification is disabled inside system options.
Alarm CodeAlarm P603Skip speed is 0 (omitted and #1174 is set to 0).
Alarm CodeAlarm P608G31 skip command issued during active tool radius or tool nose radius compensation.
Alarm CodeAlarm M01 0029High-accuracy skip coordinate retrieval error (drive unit communication failure).
VersionsM-System vs L-SystemM-System uses X, Y, Z, α axis commands. L-System uses X, Z, U, W axis commands with diameter/radius support. Speed Change Skip (G31 Fn) requires options.

Warning: Issuing a Multiple Skip command (D1) that forces the probe to travel beyond its physical overtravel limit before all designated sensors trigger will break the stylus. Programmers must check the overtravel clearances carefully to avoid crushing the probe.

Technical Comparison of Brand Architectures

TopicFanucSiemensMitsubishi
Probe InputsUp to 8 simultaneous inputs via G31 P1-P8.Up to 4 digital inputs via G31 P1-P4.Up to 8 inputs mapped via D1 and P1-P255 combinations.
Deceleration ControlAutomated background servo compensation (Type A/B via SEA/SEB parameters).Relies on PLC/NC native cycle mappings (MEAS/MEAW).Programmatic deceleration selection via R0 (step-stop) and R1 (soft ramp-down).
Torque Limit ProbingG31 P98/P99 torque limit skip command.Handled via custom cycles or MEAW with torque thresholds.G160 torque limitation skip command.
Block Skip Levels9 block skip levels.Treating / and /1 as completely independent skip levels.Level 1 standard block skip.
Unique CyclesContinuous high-speed skip (G31.9), EGB skip (G31.8).Channel-specific high-speed MEAS/MEAW cycles.Speed Change Skip (G31 Fn) for multi-feedrate moves.

Technical Analysis of Kinematic Control and Compensation

The fundamental distinction in G31 skip function implementation among Fanuc, Siemens, and Mitsubishi lies in their kinematic control, parameterization, and hardware mapping architectures. Fanuc distinguishes its system by offering built-in mathematical servo delay and acceleration compensations (Type A and Type B via parameters SEA and SEB), which automatically subtract servo lag from the recorded coordinate. It also allows programmers to completely lock out operator interference (feedrate override and dry run) during the probing block using the SKF parameter (6200#7) to guarantee perfect repeatability. Siemens, conversely, relies on direct integration with its Numerical Control Kernel (NCK) where G31 signals are mapped through digital probe machine data (such as `$MN_EXTERN_MEAS_G31_P_SIGNAL`), automatically routing ISO dialect probe calls to the native Siemens `MEAS` command behind the scenes. Siemens also uniquely treats the standard slash (/) and numbered slashes (/1 to /9) as completely independent skip levels that must be activated separately, providing more granular block-skipping control.

Mitsubishi isolates its architecture from both Fanuc and Siemens by introducing programmatic deceleration control directly within the G31 block via the R-address. Programmers can select `R0` for an instantaneous step-stop or `R1` for a smooth ramp-down using acceleration time constants defined in parameters #2102 and #2103, protecting the machine from mechanical shock. Furthermore, Mitsubishi's `D1` address enables a hardware-level logical AND Multiple Skip operation using the P-address to combine up to 8 sensor inputs, eliminating the latency of PLC ladder logic. Lastly, Mitsubishi offers the unique 'Speed Change Skip' (G31 Fn) which allows the tool to transition between feedrates upon signal trigger rather than stopping completely, an option not natively matched in standard Fanuc or Siemens G31 syntax.

Program Examples and Dry Run Walkthroughs

Fanuc Programming Example

; Fanuc Probe Measurement Cycle
G90 G98;                 ; Select absolute coordinate system and feed-per-minute mode
G31 Z-25.0 F100. P2;     ; Probe Z-axis toward -25.0 at 100 mm/min, monitoring probe input P2
G04 X2.0;                ; Dwell for 2 seconds to stabilize coordinate reading

dry run: The CNC controller processes G90 G98 in the first block, selecting absolute coordinate positioning and switching to feed-per-minute mode to satisfy G31 feed requirements. In the second block, the tool initiates a linear interpolation along the Z-axis toward Z-25.0 at a feedrate of 100 mm/min while actively monitoring the P2 probe signal input. The moment the touch probe contacts the workpiece, an external electrical trigger is received, causing the CNC to instantly halt Z-axis motion, delete the remaining distance-to-go, and save the absolute machine coordinate into system variables. In the third block, the control executes a 2.0-second dwell (G04) to allow the physical system to stabilize before the custom macro reads the logged coordinates.

Siemens Programming Example

; Siemens Measurement with Delete Distance-to-Go
G90 G94;                 ; Absolute coordinates and feedrate in mm/min
G31 Z-30.0 F120 P1;      ; Measure Z-axis toward Z-30.0 at 120 mm/min using probe input P1
G00 Z10.0;               ; Rapid retract to safe clearance plane (Z10.0)

dry run: The Siemens controller reads the absolute mode and feedrate-per-minute mode (G90 G94) in the first block. In the second block, the non-modal G31 instruction is executed, initiating a linear measuring path along the Z-axis toward Z-30.0 at a feedrate of 120 mm/min, while monitoring digital probe input P1. Upon physical contact, the probe triggers, causing the NCK kernel to immediately interrupt the linear interpolation, clear the remaining distance-to-go, and record the exact touch coordinates. The third block is then immediately processed, causing the Z-axis to retract rapidly (G00) to the safe clearance coordinate of Z10.0.

Mitsubishi Programming Example

; Mitsubishi Decelerated Multiple Skip Cycle
G19 C0 Z0;               ; Select coordinate plane immediately adjacent to skip block
G31 D1 P3 Z-50. R1 F80;  ; Multiple skip AND logic on P3, Z-axis probe to -50.0, decelerated stop, 80 mm/min
G00 Z20.0;               ; Rapid retract to safe coordinate position

dry run: The Mitsubishi control processes the G19 block in the first line to establish the C-Z interpolation plane directly adjacent to the skip cycle. In the second block, G31 is executed with logical AND Multiple Skip (D1) monitoring the combined sensor pattern P3. The Z-axis feeds toward Z-50.0 at a feedrate of 80 mm/min. When the specific sensor combination triggers, the control reads the R1 address, which applies a smooth deceleration ramp using parameter-defined time constants (#2102 and #2103) instead of an abrupt stop, protecting the probe. The Z-axis then halts, records the exact machine coordinates, and skips to the third block to rapidly retract (G00) the Z-axis to the safe clearance plane at Z20.0.

Error and Alarm Resolution Matrix

BrandAlarm CodeTrigger ConditionOperator SymptomRoot Cause / Fix
FanucPS0035G31 commanded with active Group 07 tool radius compensation (G41/G42), or torque limit skip limit not specified.CNC halts immediately upon reading G31, displaying PS0035 on the CRT screen.Cancel compensation with G40 before G31; check PMC torque windows.
FanucPS0369Torque skip commanded with no axis, 2+ axes, or Q out of 1-254 range.Axis motion halts immediately with PS0369 format error.Program exactly one axis; set Q between 1 and 254.
Siemens21700G31 activated while the measuring probe signal is already active.Program halts and displays Alarm 21700 on the interface.Check physical probe state (ensure it is not deflected or stuck); check wiring.
Siemens61301Measuring distance completely traversed without probe switching.CNC displays Alarm 61301 ("Probe not switching").Check measuring input; check tool length offset or workpiece position.
MitsubishiP608G31 skip command issued during active tool radius/nose compensation.Control stops execution and throws P608 alarm.Program G40 to deselect compensation before G31.
MitsubishiM01 0029Control failed to retrieve skip coordinate from drive unit.Machining cycle halts and shows M01 0029 error.Check drive wiring, high-accuracy parameters, and encoder communication.

Application Note on Servo Lag and Collision Prevention

A catastrophic hard collision resulting in a bent live-tool spindle shaft, a shattered sapphire stylus, or a cracked vise jaw is the direct consequence of initiating a G31 skip cycle while tool radius compensation remains active or the Z-axis cancel switch is turned ON. When the operator launches a probing sequence under these flawed conditions, the control ignores the physical skip signal, causing the slide to continue feeding at high velocity. The stylus is forced past its physical overtravel limit, driving the probe body into the solid chuck or clamp fixtures and destroying the inspection instrumentation. To prevent this mechanical failure, programmers must enforce a strict pre-activation protocol: program a G40 block to fully cancel all cutter offsets, verify that all system lock or cancel switches are disabled, and ensure the correct coordinate plane is active. This strict procedural discipline guarantees high-precision coordinate capture and protects expensive live tooling from structural damage.

Related Command Network

  • G40 / G41 / G42 (Tool Radius Compensation): Must be completely deactivated using G40 before executing G31 to prevent immediate system alarms and toolpath lockouts.
  • G36 / G37 (Automatic Tool Length Measurement): Shares background probe coordination and high-speed input logic to automate tool geometry adjustments.
  • G04 (Dwell): Integrates identical multi-stage skip signals using a Q-address (Q1-Q8) to prematurely cancel the remaining dwell time when a physical contact is made.
  • G160 (Torque Limitation Skip): Extends G31's skip behavior by monitoring servo motor torque thresholds rather than external electrical touch signals to halt motion.

Strategic Conclusion

Achieving flawless, self-correcting machining cycles relies on absolute modal state discipline and rigorous parameter alignment across the CNC system. By enforcing standard G40 deactivation, verifying physical probe clearance, and utilizing precise servo-lag parameters like SEA and SEB, machine shops can implement automated, on-machine inspections that completely eliminate operator error. This systematic approach ensures maximum tool life, protects delicate inspection probes, and guarantees that every machined component is produced within tight tolerance boundaries.

Frequently Asked Questions

Why does commanding G31 while tool radius compensation is active trigger an immediate alarm across all CNC brands?

Active cutter compensation (G41/G42) forces the controller to continuously calculate lateral coordinate offsets based on vector math, which directly conflicts with G31's requirement to perform a perfectly straight linear interpolation with absolute coordinate recording. Attempting to execute both simultaneously would result in unpredictable path deviations and potential probe crashes, which is why Fanuc throws a PS0035 alarm, Siemens halts execution, and Mitsubishi displays a P608 error. Practical Action: Always program a G40 block to fully cancel tool radius compensation on a standalone line immediately preceding any G31 probe command.

How do Fanuc parameters SEA and SEB protect machining tolerance during probe measurement?

Because the CNC records the current axis coordinates the exact millisecond the skip signal triggers, the raw logged values inherently contain a small error caused by the servo system's deceleration delay and positional deviation. Fanuc's built-in parameters 6201#0 (SEA) and 6201#1 (SEB) solve this by enabling automatic mathematical compensation that subtracts this servo lag in the background, preventing inaccurate contact logging that would otherwise lead to scrapped workpieces. Practical Action: Work with your machine tool builder to configure SEA and SEB to match your specific feedrates and axis acceleration curves, guaranteeing measurement repeatability.

What is the mechanical difference between Mitsubishi's R0 and R1 deceleration options in G31?

Commanding R0 triggers an instantaneous step-stop upon probe contact, which can cause severe mechanical vibration and physical shock to the axis guide rails at high feedrates, whereas commanding R1 utilizes parameters #2102 and #2103 to apply a smooth deceleration ramp that gently slows the axis to a stop. Selecting R1 prevents mechanical wear and extends probe lifetime, but the programmer must calculate the additional coasting distance to ensure the stylus does not exceed its physical overtravel limit. Practical Action: Use G31 with R1 for high-speed probe approaches, and always ensure your travel blocks have sufficient overtravel clearance to prevent crushing the delicate stylus against solid workpiece surfaces.

Still not resolved?

Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

Ask AI Assistant
Hakan Gündoğdu
Hakan Gündoğdu
  • CNC CARE Co-Founder (May 2025 - Present)
  • Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
  • Reis CNC Service Engineer (2003 - 2005)
  • Ö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