FANUC codes
FANUCProgram/G-codeIntermediate5-30 minutes

331

Fanuc 331 - Illegal command in peck drilling

ILLEGAL COMMAND IN PECK DRILLING

Fanuc PS program alarm 331: ILLEGAL COMMAND IN PECK DRILLING. This alarm is triggered by an illegal or incorrectly formatted command in the part program, or a programming condition that the Fanuc control cannot execute.

Root Cause Summary

Alarm 331 occurs when the control detects an improper command or parameter within a canned cycle peck drilling operation (G73, G83, or G87). This typically results from missing required parameters, conflicting modal commands, or illegal G-code combinations that violate the peck drilling cycle execution rules.

Safety

  • Verify corrected program or parameters before resuming machining

Causes and Fixes

  1. 1

    Locate the alarm line number in the program and identify the G83 or G73 block causing the alarm.

  2. 2

    Verify Q value (peck increment) is present and is a positive non-zero value. Check that R-plane is above the Z-depth value.

  3. 3

    Confirm all required addresses are present: X, Y (or one axis for single-axis drilling), Z (final depth), R (retract/reference plane), Q (peck depth), and F (feedrate).

  4. 4

    Correct the missing or invalid parameters, ensure R > Z in negative Z drilling (R-plane must be above final depth), then reset alarm and test cycle.

Service Recommended confidence

Seeing Multiple Alarms?

Seeing another alarm with this one? Enter the code.

Get machine-aware diagnosis

AxisMD logs alarms against your actual machines, tracks patterns, and gives AI context your manual doesn't have.

Start free

Was this guide helpful?

Always verify with your machine manual or a certified technician before performing service procedures.