Skip to main content
CNC.wikiCNC.wiki

G50.2 and G51.2 Polygon Turning: Synchronized Lathe Machining

Learn how to program G50.2 and G51.2 polygon turning on Fanuc, Siemens, and Mitsubishi CNC controls. Master spindle synchronization parameters, alarms, and G-code examples.

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

CNC CARE Co-founder

Introduction

A catastrophic tool failure or severe workpiece scrap event on a high-production CNC turning center often traces back to spindle synchronization discrepancies. In standard operations, a lathe turret indexes a static tool against a rotating part. However, when machining non-round features, operators frequently face the risk of tool breakage if the live tool spindle is engaged while still locked by a physical spindle clamp. In these instances, Fanuc's diagnostic data DGN 471 monitors the spindle clamp status via its PCL and QCL bits. If the clamp remains secured, the active electronic synchronization fails immediately, generating a spindle speed alarm that abruptly halts the machine. Programmers must understand these dynamics to avoid thermal motor overload or mechanical damage.

While standard synchronized cycles like G84 / G74 rigid tapping bind spindle rotation with linear Z-axis feeds, and multi-axis interpolations like G12.1 polar coordinate interpolation or G07.1 cylindrical interpolation link linear axes with rotary C-axes, polygon turning introduces a unique spindle-to-spindle electronic gearbox. This technique synchronizes the rotation of the workpiece spindle with a live rotary tool at an exact mathematical speed ratio, allowing the machine to shear flat edges, squares, or hexagons on a spinning part without requiring a time-consuming C-axis stop and end-mill approach. Achieving this synchronization safely requires strict syntax discipline, appropriate parameter configuration, and proactive diagnostic monitoring to prevent costly mechanical collisions.

Technical Summary

SpecificationTechnical Value / Description
Command CodesG50.2 (Cancel) and G51.2 (Activate) / Legacy G250 and G251
Modal GroupGroup 20 (Modal)
Supported BrandsFanuc, Siemens, Mitsubishi
Critical ParametersFanuc Parameter 7610 (Tool rotation axis), Siemens variables $C_P / $C_Q / $C_R, Mitsubishi Parameter #1501 (polyax)
Primary ConstraintWorkpiece spindle and tool spindle speeds must remain within mechanical limits; synchronization fails if active spindle clamps are not fully released.

Quick Read

  • Syntactical Isolation: Always program G51.2 and G50.2 in their own dedicated blocks to avoid formatting conflicts and immediate program abortion.
  • Dwell Implementation: Program a mandatory dwell time (such as G04 X2. on Siemens or G04 X1.5 on Mitsubishi) immediately after G51.2 to give drive systems enough time to lock in synchronization.
  • Rotary Axis Mapping: Confirm that Fanuc Parameter 7610 or Mitsubishi Parameter #1501 is set to the correct controlled axis number before activating the cycle to prevent immediate PS0314 alarms.
  • Clamp Diagnostics: Monitor spindle clamp statuses (such as PCL and QCL bits via DGN 471 on Fanuc) to verify that physical clamps are fully released before starting synchronization.
  • Speed Calculations: Ensure the programmed P:Q ratio does not force the live tool spindle to exceed its maximum mechanical RPM limits, which triggers speed alarms and halts production.
  • Stroke Monitoring: Check axis stroke limits prior to cutting; if a linear axis hits its stroke limit, it will stop while the rotary spindle and tool axis continue to rotate, creating a hazard.
  • Explicit Cancellation: Always execute G50.2 to unlink spindle coupling before commanding regular turret moves, gear changes, or finishing operations.

Basic Concepts

The G51.2 polygon machining cycle allows the workpiece spindle and the rotary tool axis to rotate synchronously at a strictly commanded ratio, enabling the rapid generation of polygonal profiles. This provides a highly efficient method for machining geometric features such as square-head bolts, bolt heads, and hexagon nuts without requiring a C-axis interpolation mill routine.

When activated, the leading spindle holding the workpiece and the following spindle holding the rotary cutting tool are electronically synchronized at a specific transformation ratio, which is defined by the P and Q parameters. By feeding the tool into the spinning workpiece while this exact speed ratio is maintained, the machine shears flat surfaces onto the cylindrical part.

The speed ratio is controlled by the P and Q parameters, which mathematically define the polygon's geometry based on the ratio of workpiece corners to tool cutting teeth. A relative phase angle difference can also be introduced using the R parameter to specify the exact angular offset in degrees, ensuring the machined flats align perfectly with existing features on the part.

Command Structure

To establish the synchronized electronic coupling, the G51.2 command must be programmed with the appropriate speed ratio and axis addresses. The workpiece spindle acts as the master reference, and the live tool spindle acts as the synchronized follower. This modal command remains active, locking both spindles together, until a cancellation block is parsed.

To deactivate the synchronized coupling and return the spindles to their independent operation, the G50.2 cancellation command must be executed. This command releases the electronic gearbox, allowing standard independent feedrate and speed commands to control each axis again.

Command Syntax

Fanuc Dialect:

G51.2 P_ Q_ R_ ; (Activation)
G50.2 ; (Cancellation)

Siemens Dialect (in ISO Dialect Mode):

G51.2 P_ Q_ R_ ; (Activation)
G50.2 ; (Deactivation)

Mitsubishi Dialect:

Tool Spindle Synchronization IB (Spindle-Spindle Polygon):

G51.2 H_ D_ P_ Q_ R_ ;

Tool Spindle Synchronization IC (Spindle-NC Axis Polygon):

G51.2 P_ Q_ ;

Cancellation Format:

G50.2 ;

Command Parameter Details

Parameter AddressControl BrandFunctional DescriptionAllowed Data Range
PFanuc, Siemens, MitsubishiSpecifies the rotation ratio component of the following spindle or workpiece corners.Fanuc: 1 to 999; Siemens: Numeric; Mitsubishi: 1 to 200 (or -1 to -200)
QFanuc, Siemens, MitsubishiSpecifies the rotation ratio component of the leading spindle or tool axis speed ratio (sign dictates direction).Fanuc: -999 to -1, 1 to 999; Siemens: Numeric; Mitsubishi: 1 to 200 (or -1 to -200)
RFanuc, Siemens, MitsubishiDesignates the relative phase angle difference or angular offset in degrees.Fanuc: 0.0 to 360.0; Siemens: Degrees; Mitsubishi: Phase shift amount
HMitsubishi (IB Mode)Designates the reference workpiece spindle selection.Axis select index
DMitsubishi (IB Mode)Designates the synchronized rotary tool spindle selection.Axis select index

Brand Applications

Fanuc

In Fanuc lathe systems (T-series), the polygon turning cycle operates as a Group 20 modal function. Control axis mapping is managed through parameter 7610, which identifies the physical rotary tool axis engaged in the machining operation.

The cycle is activated with G51.2 P_ Q_ R_ ; and canceled with G50.2 ;, or alternate legacy codes G251 and G250 depending on parameter configuration.

System Parameter / Alarm / VersionTechnical Specification & DescriptionValue Range / Action
Parameter 7610Control axis number of tool rotation axis.1 to maximum controlled axes
Parameter 7605Polygon turning type selection. Sets two-spindle or standard polygon turning.0 (two spindles), 1 (standard)
Parameter 7603#0 (RPL)Controls cycle behavior upon a machine reset.0 (release mode on reset), 1 (retain modal state)
Alarm PS0314ILLEGAL SETTING OF POLYGONAL AXIS. Triggered when parameter 7610 is set to 0.Assign correct controlled axis number to parameter 7610.
Alarm PS5018POLYGON SPINDLE SPEED ERROR. Spindle speed limits exceeded or clamps engaged.Adjust speed or ratio to fit mechanical limits. Release clamps.
Alarm PS0218NOT FOUND P/Q COMMAND. Address P or Q is missing in the block.Specify integer ranges (1 to 999) for P and Q.
Alarm PS0219COMMAND G51.2/G50.2 INDEPENDENTLY. Command programmed with motion.Isolate G51.2 or G50.2 in its own dedicated block.
T-Series vs M-SeriesApplication constraints based on machine control type.Exclusive to T-series lathes; M-series uses G50/G51 for scaling.

Warning: An emergency stop overrides parameter memory. An E-stop will forcibly release the polygon turning mode regardless of how parameter 7603#0 (RPL) is configured to handle standard resets.

Siemens

In Siemens controls, polygon turning is implemented via modal G-codes from G-Group 20. The system dynamically reads variables to execute synchronization through background cycle translations.

The cycle is activated using G51.2 P_ Q_ R_ ; and deactivated with G50.2 ;.

System Parameter / Alarm / VersionTechnical Specification & DescriptionValue Range / Action
$C_PSystem variable capturing the P parameter speed ratio.Numeric
$C_QSystem variable capturing the Q parameter speed ratio.Numeric
$C_RSystem variable capturing the R parameter angular offset.Numeric
Alarm 12060Same G group programmed repeatedly. Triggered if G50.2 and G51.2 are in the same block.Program G-codes in separate blocks.
Alarm 12470G function is unknown. Invalid G code programmed or unsupported hardware.Verify option licensing and hardware configuration.
Alarm 12140Functionality not implemented. Synchronous spindle coupling required is not licensed.Obtain license for synchronous spindle coupling.
SINUMERIK 802D slHardware line exclusion.Multi-edge turning is completely disabled on this control series.

Warning: Failing to program a sufficient dwell time using G04 immediately after activating G51.2 creates a severe danger of collision, potentially destroying the cutting tool or damaging the workpiece secured in the spindle chuck.

Mitsubishi

Mitsubishi controls support deep spindle-tool synchronization, offering two operational modes based on parameter settings to accommodate various lathe designs.

Activation uses G51.2 H_ D_ P_ Q_ R_ ; for Spindle-Spindle (IB) mode or G51.2 P_ Q_ ; for Spindle-NC Axis (IC) mode, cancelled with G50.2 ;.

System Parameter / Alarm / VersionTechnical Specification & DescriptionValue Range / Action
Parameter #1501 polyaxDesignates the control axis number of the rotary tool axis.0 (Spindle-Spindle IB), non-zero axis index (Spindle-NC Axis IC)
Parameter #8213Enabling parameter for polygon machining.0 or 1
Parameter #3106 zrn_typ/bit4Controls zero-return requirement before polygon machining starts.0 (must zero-return before cycle start), 1 (no zero-return required)
Alarm P32Program Error. Movement commanded to active tool spindle axis.Avoid commanding axis travel on the active tool spindle axis.
Alarm P33Program Error. Travel commanded with G50.2 or G51.2 with non-group 0 G-codes.Isolate G51.2/G50.2 and separate travel from cancellation.
Alarm P39Program Error. G51.2/G50.2 commanded without Tool Spindle Synchronization IC active.Ensure synchronization option is enabled.
Alarm M01 1033Operation Error. Cutting feed starts before spindle synchronization is locked.Allow dwell/wait time after G51.2 before active feed.
G-Code List 6 / 7Control system configuration options.Cycles are exclusively available under list 6 or list 7.

Warning: If a linear axis (other than the rotary tool axis) reaches its stroke end during active cutting, that linear axis will stop, but the rotary tool axis and spindle rotation will dangerously continue to spin.

Brand Comparison

Comparison TopicFanucSiemensMitsubishi
Macro / Translation ArchitectureDirect macro decoding mapping to parameters; native register-level diagnostics.Shell cycle translation; captures P/Q/R parameters to $C_P, $C_Q, and $C_R variables, executing CYCLE3512 which calls native COUPDEF/COUPON commands.Dual configuration: Spindle-Spindle (IB) vs Spindle-NC Axis (IC) decided dynamically by parameter #1501.
Spindle HierarchyDynamic assignment through builders or dual-spindle parameters.Strict unchangeable hierarchy: first spindle in the channel is always leading; second spindle is always following.Explicit definition via H (Workpiece spindle) and D (Rotary tool spindle) in IB mode.
Diagnostic Spindle ClampingMonitors PCL and QCL clamp bits via DGN 471. Triggers Alarm PS5018 if commanded while clamped.Relies on NC logic; collision risk with spindle chuck if G04 dwell is omitted before synchronization.Ratio-clamp protection drops workpiece spindle RPM if tool axis speed exceeds rapid limit.
System Support & OptionsT-Series exclusive. Scaling function uses G50/G51 in M-Series. G50.2/G51.2 standard or legacy G250/G251.Disabled completely on SINUMERIK 802D sl controllers. Uses ISO Dialect mode switch (G291).Available under G-code list 6 or 7. Supports gear changes during spindle rotation.

Technical Analysis

The underlying translation architecture represents a major technical divergence between these brands. Fanuc directly decodes the G51.2 macro and maps it to parameters with native register-level diagnostics. Siemens, on the other hand, captures the P, Q, and R parameters into system variables ($C_P, $C_Q, and $C_R) and routes them through a shell cycle translation to its native CYCLE3512, which executes the COUPDEF and COUPON spindle-coupling commands. Mitsubishi utilizes a dual configuration determined dynamically by parameter #1501, switching between Spindle-Spindle (IB) mode and Spindle-NC Axis (IC) mode.

Spindle hierarchy control also differs. Siemens applies a strict, unchangeable spindle hierarchy where the first spindle in the channel is always the leading axis and the second is the following axis. Mitsubishi allows explicit spindle definition via the H and D arguments in its IB syntax, while Fanuc relies on machine-tool builder configuration or dual-spindle parameters.

Spindle clamping and collision prevention represent another area of difference. Fanuc actively monitors the spindle clamps via diagnostic bits PCL and QCL in DGN 471, triggering an alarm if synchronization is commanded on a clamped axis. Siemens relies on the programmer to manually implement a G04 dwell to prevent collisions. Mitsubishi incorporates an advanced ratio-clamp protection that automatically drops the workpiece spindle RPM if the tool axis feedrate exceeds its rapid limit, preventing synchronization loss during active cuts.

Program Examples

Fanuc Program Example

O1001 (FANUC POLYGON TURNING EXAMPLE) ;
G97 S1000 M03 ;          (Start spindle at 1000 RPM)
G00 X50.0 Z5.0 ;         (Rapid to starting position)
G51.2 P1 Q2 R0.0 ;       (Activate polygon turning with 1:2 ratio, workpiece 1000 RPM, tool 2000 RPM)
G01 Z-20.0 F0.1 ;        (Feed across part to machine flats)
G00 X60.0 ;              (Retract X axis)
G50.2 ;                  (Cancel polygon turning mode)
G28 U0 W0 ;              (Return to reference position)
M30 ;                    (End of program)

Dry Run: Before executing this program on a live workpiece, remove the stock from the chuck and clear all tools from the turret. Set the dry run switch to active and verify that parameter 7610 contains the correct controlled axis number. Execute the code block-by-block using single block mode. When G51.2 is read, visually confirm that the workpiece spindle and the rotary tool turret axis lock into their 1:2 speed ratio. Ensure that the active spindle clamps are fully released (PCL/QCL bits in DGN 471) to avoid an immediate PS5018 or PS0314 alarm.

Siemens Program Example

; SIEMENS POLYGON TURNING EXAMPLE
G90 G97 S1200 M03 ;      (Start master spindle at 1200 RPM)
G00 X45.0 Z2.0 ;         (Rapid to safe start position)
G51.2 P1 Q2 R0.0 ;       (Activate spindle coupling, following spindle to leading spindle ratio 1:2)
G04 F2.0 ;               (Mandatory 2-second dwell to allow spindle synchronization to fully lock)
G01 Z-15.0 F0.15 ;       (Perform cutting feed to machine polygonal flats)
G00 X55.0 ;              (Retract tool from the workpiece)
G50.2 ;                  (Deactivate spindle coupling)
M30 ;                    (End of program)

Dry Run: Perform this test without raw material loaded in the spindle chuck and with the turret retracted to a safe clearance zone. Verify that option licensing for synchronous spindle coupling is active to prevent alarm 12140. Switch the controller to ISO Dialect mode via G291. Run the program in single block mode. Confirm that the mandatory G04 dwell occurs immediately after G51.2, allowing the tool spindle to achieve full synchronization with the master spindle before any axial motion occurs. Monitor the tool axis rotation to ensure no unexpected velocity alarms are triggered.

Mitsubishi Program Example

; MITSUBISHI POLYGON TURNING EXAMPLE
G97 S1000 M03 ;          (Start workpiece spindle at 1000 RPM)
G00 X40.0 Z5.0 ;         (Position turret close to workpiece)
G51.2 P1 Q2 ;            (Activate Tool Spindle Synchronization IC, Spindle-NC Axis mode, 1:2 ratio)
G04 X1.5 ;               (Dwell to ensure spindle synchronization lock before feed)
G01 Z-25.0 F0.12 ;       (Feed along Z axis to machine the hexagon profile)
G00 X50.0 ;              (Retract turret in X axis)
G50.2 ;                  (Cancel polygon turning mode, unlinking spindle and NC tool axis)
M30 ;                    (End of program)

Dry Run: Conduct the simulation on a completely empty chuck with the turret parked at a safe reference point. Check that parameter #1501 contains a non-zero axis index to enable Spindle-NC Axis (IC) mode. Run the program in single block mode. Verify that the tool spindle accelerates and locks synchronization with the spindle. Confirm that the cutting feed does not start before synchronization is fully established, preventing an M01 1033 interlock operation error. Ensure that the G50.2 cancellation block does not contain any linear travel axis commands to avoid triggering a P33 alarm.

Error Analysis

BrandAlarm CodeTrigger ConditionOperator SymptomRoot Cause / Fix
FanucAlarm PS0314Parameter 7610 is set to 0 when G51.2 is executed.Cycle halts immediately upon reading the G51.2 block.No rotary axis has been properly assigned for the cycle. Fix: Assign the correct controlled axis number to parameter 7610.
FanucAlarm PS5018Spindle speed limit exceeded or cycle commanded while spindle clamp is locked.Machine spindle halts during synchronization or cutting, displaying speed error.Workpiece or tool spindle speed exceeds maximum limit, or clamps are active (monitored via DGN 471 PCL/QCL bits). Fix: Adjust spindle speed or change P/Q ratio; verify clamps are fully released before cycle activation.
FanucAlarm PS0218Missing or invalid P or Q address in G51.2 block.Cycle aborts immediately at the G51.2 block.Address P or Q is missing or falls outside the allowed range. Fix: Specify P and Q commands within valid integer ranges (1 to 999).
SiemensAlarm 12060G50.2 and G51.2 specified in the exact same NC block.The control throws a G-group conflict error and halts program execution.Conflicting modal codes from G-Group 20 programmed in the same block. Fix: Program the G-codes in separate blocks.
SiemensAlarm 12140G51.2 called without synchronous spindle coupling license.Execution stops with functionality not implemented alarm.Synchronous spindle coupling feature required for polygon turning is not licensed or active. Fix: Obtain and activate synchronous coupling license.
MitsubishiAlarm P32Movement command issued to the rotary tool axis in polygon mode.Turret motion stops abruptly, and program throws Program Error.Movement command issued to the designated NC axis set as the rotary tool axis. Fix: Avoid commanding axis travel on the active tool spindle axis.
MitsubishiAlarm P33Axis travel commanded in the same block as G50.2 cancel command.Automatic operation pauses, throwing a formatting error.Format violation. Fix: Isolate G51.2 and G50.2 blocks and separate travel from cancellation.
MitsubishiAlarm M01 1033Cutting feed starts before spindle synchronization is locked.Spindle interlock activates, halting feed motion and throwing Operation Error.Spindle synchronization is not fully established. Fix: Allow dwell/wait time after G51.2 (using G04) before active feed.

Application Note

Uncontrolled spindle acceleration combined with unresolved physical clamps represents the highest mechanical risk when deploying G51.2 polygon turning cycles. In Fanuc systems, commanding a synchronization ratio while the first spindle (the master axis) or the second spindle (the slave axis) remains secured by a physical clamp will trigger a severe Alarm PS5018. Fanuc's internal diagnostic monitoring relies on DGN 471 to check the PCL and QCL clamp bits. If they remain active, the synchronization fail-safe halts operation to prevent motor damage or belt slippage. Programmers must also evaluate live-tool RPM dynamics. Programming a highly aggressive Q-value ratio on a turning center with limited live-tooling RPM capabilities will drive the slave spindle past its physical velocity boundaries, generating an immediate speed error. To maintain the structural and geometric integrity of the polygon, Mitsubishi systems incorporate ratio-clamp protection which dynamically drops the workpiece spindle speed to keep the programmed P:Q ratio constant. On the other hand, Siemens controllers route the P, Q, and R parameters into system variables ($C_P, $C_Q, and $C_R) which are translated via CYCLE3512 into native COUPDEF and COUPON drive commands. If an emergency stop occurs, the electronic gearbox is severed instantly, overriding the reset parameter memory of parameter 7603#0 (RPL). Therefore, safe operation demands that physical stroke limits, active clamp states, and programmed feedrates are meticulously cross-checked prior to cutting.

Related Command Network

  • G28 (Reference Position Return): Used on Fanuc systems to return the tool rotary axis to its home position, with homing sequences governed by parameter 7600#7 (PLZ).
  • COUPDEF & COUPON (Siemens Spindle Coupling): The native Siemens Sinumerik synchronous spindle coupling commands executed internally by hidden translation shell CYCLE3512 when G51.2 is programmed.
  • G291 (Siemens ISO Dialect Mode): Used on Siemens controls to enable decoding of ISO dialect G50.2/G51.2 command structures instead of native Siemens commands.
  • G114.1 (Mitsubishi Spindle Synchronization I): A closely related Mitsubishi command that establishes basic spindle-to-spindle electronic synchronization.
  • G92 (Spindle Clamp Speed Setting): Sets workpiece spindle speed clamping limits, which must be calibrated to ensure the synchronized ratio does not drive the live tool axis past its mechanical velocity boundaries.

Conclusion

Polygon turning via G51.2 and G50.2 provides a powerful cycle-time advantage on the shop floor, turning multi-axis lathes into high-speed production units that form squares and hexagons in seconds. However, achieving this efficiency requires total clarity on your control's parameter settings and diagnostic registers. By proactively checking parameter 7610 on Fanuc or parameter #1501 on Mitsubishi, ensuring physical spindle clamps are released, and always programming a post-coupling dwell time, you will eliminate the threat of sudden diagnostic alarms, tool breakages, or severe chuck collisions. Treat these synchronized cycles as highly structured electronic gearboxes: establish clean setup habits, verify spindle speeds, and isolate your synchronization codes to guarantee flawless part geometry and consistent machine uptime.

FAQ

Can polygon turning be executed on standard CNC machining centers?

No. G51.2/G50.2 multi-edge turning is an exclusive feature of lathe systems (T-series on Fanuc and Mitsubishi controls). On Fanuc M-series (machining centers), G50 and G51 are dedicated to the Scaling function, and attempting to call polygon synchronization will result in programming errors or unexpected geometric scaling. For standard machining centers, multi-axis interpolation or rotational profiling is used instead. On the shop floor, always verify your control architecture before transfering G51.2 blocks to ensure compatibility.

What should I do if my Siemens control throws Alarm 12140 when calling G51.2?

Alarm 12140 (Functionality not implemented) indicates that the synchronous spindle coupling option required for polygon turning is either not licensed or deactivated on your SINUMERIK control. This cycle is not standard on all entry-level platforms and is entirely disabled on certain lines such as the 802D sl. To resolve this, contact your machine tool builder or Siemens representative to purchase and activate the software license options for spindle coupling. In the meantime, you must reprogram the operation using traditional C-axis end-mill interpolation routines.

Why does my Mitsubishi control halt with an M01 1033 error immediately after synchronization starts?

The M01 1033 Operation Error is triggered when the control receives a cutting feed command before the workpiece spindle and the rotary tool axis have fully achieved their synchronized rotational ratio. Issuing cutting travel immediately after G51.2 causes a cutting interlock failure to protect the tool and workpiece. To prevent this, always program a dwell command (such as G04 X1.5) directly after the G51.2 activation block to give the drive servo motors time to lock.

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