FANUC PS0204 Alarm: Illegal Axis Operation in Rigid Tapping

FANUC PS0204 means that an illegal axis movement was commanded in the rigid-tapping sequence. The standard FANUC alarm description states that an axis movement was specified between the rigid-mode M-code block—commonly M29 Sxxxx—and the G84 or G74 tapping-cycle block. Correct the program so that all required positioning is completed before the rigid-mode command and no separate axis-movement block interrupts the sequence.

On controls that use M29, the normal structure is:

G00 X50.0 Y30.0 Z5.0
M29 S500
G84 Z-20.0 R2.0 F1.25

PS0204 is primarily a program-sequence alarm. It does not, by itself, indicate a defective spindle amplifier, servo amplifier, motor, encoder, or feedback cable.

Item Meaning
CNC display PS0204 / ILLEGAL AXIS OPERATION
Main cause An axis movement was commanded in an illegal position in the rigid-tapping sequence
Common location Between the rigid M-code block and G84/G74
First action Review the executed program blocks and move the positioning command before M29
Usually not indicated A spindle, servo, encoder, cable, or amplifier hardware failure

For the preceding command-position alarm, see the FANUC PS0203 Rigid Tapping Command Error guide. For the broader list, see FANUC CNC Alarm Codes 0201–0400.

Safety Warning Before Retesting Rigid Tapping

Rigid tapping synchronizes spindle rotation and tapping-axis movement. An incorrect program, spindle speed, feedrate, thread lead, clearance, or restart position can break the tap, damage the workpiece, or cause unexpected motion.

Record the original program and the alarm block before making changes. Confirm the tool position, hole location, R point, tapping depth, feed mode, S value, F value, and thread lead. Test the corrected program only under the machine builder's approved procedure and with qualified personnel present.

Do not restart directly from the G84 or G74 block unless the required modal state, spindle selection, rigid-mode command, tool position, and machine-builder restart conditions have been safely re-established.

What Does FANUC PS0204 Mean?

FANUC alarm lists for Series 16i/18i/21i and newer Series 500i-A controls describe PS0204 as an axis movement specified between the rigid M-code block and the G84 or G74 block. The official action is to correct the program.

In the common M29 method, the CNC first receives the rigid-mode request and tapping spindle speed. The next tapping-cycle command then establishes the synchronized spindle and tapping-axis operation. A separate movement inserted between those commands breaks the required sequence and can produce PS0204.

The word axis includes more than the tapping axis. Depending on the program and control, an intervening X-, Y-, Z-, rotary-axis, or additional-axis movement can be relevant. The movement may be written with an explicit motion G code, such as G00 or G01, or it may inherit a modal motion code from an earlier block.

PS0204 does not mean that all axis addresses are prohibited in the G84/G74 block. The tapping-cycle block normally contains legitimate hole-position, depth, R-point, and cycle data. The key issue is a separate axis movement placed after the rigid-mode block but before the tapping-cycle block.

1. Record the Alarm Block and the Executed Sequence

Before editing the program, record the PS0204 screen and inspect several blocks before the alarm. Identify:

  • The complete FANUC CNC series and model

  • Whether the control is an M series or T series

  • The active path and selected spindle

  • The rigid-mode M code used by the machine

  • The S command associated with rigid tapping

  • The tapping-cycle G code

  • Every axis address between the rigid M-code block and the cycle block

  • The active modal motion G code

  • Whether a macro, subprogram, CAM post processor, or optional block is involved

  • Whether the alarm began after a program edit, post-processor update, parameter restore, CNC replacement, or machine modification

Read the sequence the CNC actually executes. The visible G84 line may be correct while a called macro, subprogram, or generated positioning block inserts motion after M29.

2. Position All Axes Before the Rigid-Mode Command

The clearest correction is to complete positioning before M29 or the machine's approved rigid-mode M code.

Incorrect:

M29 S500
G00 Z5.0
G84 Z-20.0 R2.0 F1.25

The Z-axis positioning block interrupts the rigid-tapping sequence.

Corrected:

G00 Z5.0
M29 S500
G84 Z-20.0 R2.0 F1.25

The same principle applies to hole positioning:

Incorrect:

M29 S500
G00 X50.0 Y30.0
G84 Z-20.0 R2.0 F1.25

Corrected:

G00 X50.0 Y30.0
M29 S500
G84 Z-20.0 R2.0 F1.25

The numerical values are examples only. Use the positions, speed, feed, depth, clearance, and thread lead approved for the actual machine and tool.

3. Make the M29 and G84/G74 Sequence Consecutive

When the machine requires a separate rigid-mode M code, the most readable program structure is to place the approved M29 Sxxxx block immediately before the tapping-cycle block:

M29 S500
G84 Z-20.0 R2.0 F1.25

Do not insert an independent rapid-traverse, linear-interpolation, reference-return, incremental-move, or rotary-axis positioning block between them.

Commands to inspect include:

  • G00 or G01 with an axis address

  • G02 or G03 movement on an applicable plane

  • G28, G30, or another position-return command

  • An axis-movement block programmed in G91 incremental mode

  • An axis-movement block programmed in G90 absolute mode

  • Rotary-axis positioning

  • A coordinate-only block that inherits a modal motion command

  • A macro or subprogram that calculates and commands an axis position

The alarm is related to actual commanded motion, not merely the visual presence of a G code. A block such as Z5.0 may still command movement if G00 or G01 remains modal from an earlier block.

4. Check for Axis Motion Hidden by Modal Programming

A program does not need to repeat G00 or G01 in every movement block. For example:

G00 Z20.0
M29 S500
Z5.0
G84 Z-20.0 R2.0 F1.25

The Z5.0 block can inherit G00 and command rapid movement even though G00 is not written again. Move that positioning command before M29:

G00 Z20.0
Z5.0
M29 S500
G84 Z-20.0 R2.0 F1.25

Also check whether an axis value is generated through a macro expression:

M29 S500
Z[#100]
G84 Z-20.0 R2.0 F1.25

If Z[#100] commands motion, it is still an intervening axis movement. Evaluate the actual macro value and execution path rather than assuming that a calculated address is harmless.

5. Do Not Remove Valid Axis Data From the Tapping-Cycle Block

The correction is not to delete the normal G84/G74 cycle data. A valid machining-center tapping block may contain X, Y, Z, R, F, P, Q, or other addresses supported by the exact control and option configuration.

For example:

M29 S500
G84 X50.0 Y30.0 Z-20.0 R2.0 F1.25

Here, the positioning and tapping movements belong to the G84 cycle itself. They are not a separate movement block placed between M29 and G84.

Do not remove X/Y hole coordinates, the Z depth, or the R point merely because PS0204 contains the words “illegal axis operation.” First identify whether the alarm is caused by an independent movement before the cycle or by a series-specific rule for M29 placement.

6. Check M-Series and T-Series Cycle Differences

FANUC G-code meanings depend on the control type and enabled options.

Control type in the cited alarm documentation Common rigid-tapping cycle references
M series G84 for tapping and G74 for left-hand/reverse tapping
T series in applicable older alarm lists G84 or G88, depending on the tapping function

Do not copy a machining-center G74 example directly into a lathe program. On many T-series controls, G74 has a different turning-cycle meaning, while rigid tapping may use G84 or G88. Use the operator's manual and machine-builder programming manual for the exact CNC and machine.

The rigid-mode M code can also be machine specific. M29 is common, but an applicable FANUC parameter or machine-builder PMC sequence may assign another M code. Confirm the approved working program and machine documentation before changing the M-code number.

7. Account for FANUC Series Differences Between PS0203 and PS0204

The alarm allocation is not identical in every FANUC generation.

FANUC documentation Condition associated with PS0204
Series 16i/18i/21i operation and maintenance handbook Axis movement between M29 and G84/G74 for M series, or G84/G88 for applicable T series
Series 500i-A maintenance manual Axis movement between the rigid M-code block and G84/G74
Series 0i-D / 0i-F programming manuals on applicable configurations An intervening S command or axis movement may be assigned to PS0203; PS0204 can also be associated with M29 being issued while a tapping cycle is active

This difference is important when comparing two machines. The same program pattern may display PS0203 on one control and PS0204 on another. Diagnose the exact alarm message, CNC series, software, and rigid-tapping method instead of assuming that every FANUC control uses the same alarm allocation.

Some applicable FANUC manuals allow the rigid M code and the initial tapping command to be programmed in the same block under a supported method. Other machine-builder implementations expect a separate M29 S block. Do not rewrite a working command method solely to match a generic online example. For ordinary troubleshooting, use the sequence specified by the exact FANUC and machine-builder manuals.

8. Inspect CAM Output, Macros, and Program Restart

If the visible program appears correct, inspect the entire execution path:

  • A CAM post processor may output hole positioning after M29.

  • A macro may insert a calculated Z, X, Y, or rotary-axis movement.

  • A subprogram may begin with a positioning block before it reaches G84.

  • Optional block delete may skip the intended G84 block or change the sequence.

  • Sequence restart may begin after the required positioning or rigid-mode preparation.

  • A copied program may use the rigid-tapping format of a different FANUC series or machine builder.

Compare the generated program with a verified working program from the same machine. If the alarm began after a CAM-post update, compare the output block by block around every M29/G84 or M29/G74 sequence.

After G80 cancels a rigid-tapping canned cycle, do not assume that an earlier rigid-tapping S value or command state remains valid. Re-establish the complete sequence required by the applicable manual before the next tapping operation.

9. Do Not Start With Hardware Replacement or Parameter Changes

FANUC's PS0204 action is to correct the program. The alarm definition does not instruct the technician to replace the spindle amplifier, servo amplifier, motor, encoder, CNC board, or feedback cable.

It also does not normally require changing spindle tuning, servo tuning, gear ratio, position-coder, or PMC parameters. Parameter and PMC checks are relevant only when the machine's rigid-tapping command method or rigid M-code assignment is genuinely uncertain, particularly after a parameter restore, CNC replacement, or machine-builder modification.

Do not change parameters merely to make an incorrect program run. First confirm the exact control manual, machine-builder documentation, approved parameter backup, and a known-good rigid-tapping program.

Difference Between PS0203 and PS0204

PS0203 and PS0204 are adjacent program alarms, but their traditional descriptions emphasize different parts of the sequence:

Alarm Main FANUC description Primary check
PS0203 The rigid M code or S command is positioned incorrectly Check the M29/S format and command position
PS0204 An illegal axis movement is commanded in the rigid-tapping sequence Remove independent axis motion between the rigid M-code block and G84/G74

On some 0i-D/0i-F configurations, an intervening axis movement can be reported as PS0203 instead. The FANUC PS0203 guide explains this overlap.

Difference Between PS0204, PS0205, and PS0206

Alarm Condition Main action
PS0204 Illegal axis movement or series-specific M29 placement in the rigid-tapping sequence Correct the NC program order
PS0205 The rigid-mode confirmation signal is not on, or the required spindle is not selected Check the applicable PMC sequence and spindle selection
PS0206 A plane change or drilling-axis change is commanded in rigid mode Cancel or reorganize the cycle before changing the plane or drilling axis

Do not investigate the PMC ladder for PS0204 unless another alarm or machine-specific evidence indicates a PMC problem. A normal PS0204 begins with the NC program.

FANUC PS0204 Diagnostic Table

Finding Interpretation Recommended action
G00/G01 movement appears after M29 and before G84/G74 A separate axis movement interrupts the rigid-tapping sequence Move the positioning block before M29
X/Y/Z block appears without a written G00/G01 A modal motion G code may still command movement Check the active modal state and relocate the movement
G28, G30, G91, or rotary-axis move appears between the blocks A return, incremental, or rotary movement interrupts the sequence Complete the movement before entering rigid mode
G84/G74 contains normal X/Y/Z/R cycle data The axis data may be valid as part of the tapping cycle Do not delete valid cycle data; find the independent intervening movement
Program works on another FANUC machine but alarms here The CNC series, M/T G-code system, rigid M code, or alarm allocation differs Use the exact control and machine-builder manuals
Main program appears correct A macro, subprogram, optional block, or CAM post may alter the executed sequence Trace the actual execution path
Alarm began after a CAM-post update Generated command order may have changed Compare the new output with a verified working program
No intervening movement is found on an applicable 0i-D/0i-F control PS0204 may be related to M29 being issued while the tapping cycle is active Check the exact series manual and M29 placement
Technician proposes replacing an encoder or amplifier PS0204 alone does not support a hardware diagnosis Correct and verify the program first

Recommended Troubleshooting Order

  1. Confirm PS0204 / ILLEGAL AXIS OPERATION and record the alarm block.

  2. Identify the exact FANUC series, M/T system, path, spindle, and machine model.

  3. Record the rigid M-code block, tapping-cycle block, and every block between them.

  4. Confirm the approved rigid-mode M code; M29 is common but may be machine specific.

  5. Move all X/Y/Z, rotary-axis, reference-return, and other positioning commands before the rigid M-code block.

  6. Check for modal axis movement even when G00 or G01 is omitted.

  7. Make the approved M29 Sxxxx and G84/G74 sequence consecutive when the machine requires separate blocks.

  8. Do not remove valid axis, depth, R-point, or feed data from the tapping-cycle block.

  9. Check macros, subprograms, optional blocks, program restart, and CAM-post output.

  10. Apply the correct M-series or T-series cycle convention.

  11. If the sequence contains no intervening movement, check the exact series-specific PS0203/PS0204 allocation and M29 placement rule.

  12. Do not replace hardware or change parameters without separate evidence.

  13. Verify S, F, feed mode, thread lead, tool position, depth, and clearance, then perform a controlled test.

Technical References

  • FANUC Series 16i/18i/21i/160i/180i/210i Model B Operation and Maintenance Handbook, B-63527EN, alarm 204 and M-series/T-series rigid-tapping cycle distinction

  • FANUC Series 0i-MODEL D / 0i Mate-MODEL D User's Manual (Machining Center System), B-64304EN-2/01, rigid-tapping command methods, M29 limitations, and parameters 5200/5210

  • FANUC Series 0i-MODEL F Operator's Manual (Lathe System), B-64604EN-1/01, rigid-tapping M29 limitations and PS0203/PS0204 allocation

  • FANUC Series 0i-MODEL F Operator's Manual (Machining Center System), B-64604EN-2/01, rigid-tapping programming and M29 sequence

  • FANUC Series 500i-A Maintenance Manual, B-64805EN/03, PS0204 alarm definition and official corrective direction

  • Beijing FANUC technical guidance for PS0204: illegal axis command

Always use the manual edition that applies to the exact CNC series, machine type, software, options, path/spindle configuration, and machine-builder interface. Alarm allocation and rigid-tapping command methods can differ between systems.

Need Help With FANUC PS0204 Alarm?

REACO CNC provides independent FANUC technical support, program review assistance, drive testing, repair, and parts compatibility checking. Send us the alarm screen, complete CNC and machine models, the program blocks before and including M29/G84/G74, active modal G codes, S and F values, and details of any recent program, parameter, control, or CAM-post changes.

Visit the FANUC Technical Support Center for more FANUC alarm guides, or contact REACO CNC for assistance.

Reference Source: Beijing FANUC. This article is based on FANUC technical documentation. The correct program sequence and test procedure depend on the exact CNC, machine, software, parameters, spindle/path configuration, and machine-builder specification.

Get in touch with REACO CNC

Request Repair Consultation

Have a technical issue or need repair assistance?

Looking for a part quote?

Hours of Operation Mon - Fri: 8 AM to 8 PM(Beijing Time, UTC+8)

Email: sales@reacocnc.com

Hot Selling FANUC Parts

View all