G25 and G26 on CNC: Spindle Speed Fluctuation Detection (and Better Alternatives)
In CNC machining, precise control over spindle speed is essential. You might encounter information suggesting that G25
and G26
are standard G-codes for setting spindle speed limits or managing spindle speed fluctuation detection. This is generally incorrect for modern, mainstream CNC controls from Fanuc, Siemens, Haas, and others. G25
and G26
are not universally defined G-codes with consistent meanings across all CNC systems.
This article clarifies the confusion surrounding G25
and G26
, explains a possible (but increasingly rare) historical use of these codes on some older Fanuc controls, and, most importantly, presents the correct and recommended ways to manage spindle speed and monitor its stability on your CNC lathe or machining center.
Crucial Note: Before using any G-code, especially less common ones like G25 and G26, always consult the programming manuals for your specific CNC control system and machine tool. Never assume a G-code’s function without verification.
1. G25 and G26: Non-Standard and Often Misunderstood
The most important point to understand is: Do not expect G25
or G26
to have a consistent, predictable function across different CNC machines. They are not reliable commands for:
- Setting Spindle Speed Limits (Minimum or Maximum): This is primarily done through machine parameters, and on lathes, often in conjunction with
G96
(Constant Surface Speed) andG92
(orG50
on older Fanucs, orLIMS
on Siemens). - General Position Checking or Probing: Use
G31
(skip function) or dedicated probing cycles. - Mirroring or Scaling: Use the control-specific commands for these functions (e.g.,
G50.1
/G51.1
andG51
on Fanuc,MIRROR
/AMIRROR
andSCALE
/ASCALE
on Siemens).
2. Possible Function on Some Older Fanuc Controls: Spindle Speed Fluctuation Detection
Based on further research, and correcting my previous error, I can confirm that on some older Fanuc controls (and potentially some compatible systems), G25
and G26
might have been used for:
G25
: Spindle Speed Fluctuation Detection OFF (detection disabled). This would disable the monitoring, allowing the machine to operate even if there are significant discrepancies between commanded and actual spindle speed.G26
: Spindle Speed Fluctuation Detection ON (detection enabled). This would activate a function that monitors the difference between the commanded spindle speed (S
word) and the actual spindle speed. If the difference exceeds a limit (set by a parameter), the machine would generate an alarm.
Extremely Important Caveats:
- Non-Standard on Modern Controls: This is not a standard or widely used feature on modern Fanuc controls. Modern systems typically have spindle speed monitoring always active and controlled by parameters. You are unlikely to need (or be able to use)
G25
andG26
for this purpose on a newer machine. - Control-Specific: The exact behavior, syntax, and associated parameters would be highly dependent on the specific Fanuc control series and the machine tool builder’s implementation.
- Limited and Specific Use Cases: Disabling spindle speed fluctuation detection (
G26
) is generally extremely dangerous and not recommended and should only be done in very specific circumstances, with a full understanding of the risks and consequences. Possible (but rare and often inadvisable) justifications might include:- Very Low Spindle Speeds: At extremely low RPMs, the control’s monitoring system might be overly sensitive and generate false alarms.
- Specialized Operations: Some very unusual machining operations might require disabling the check (but this would be extremely rare and require expert knowledge).
- Testing (with extreme caution): Only in very controlled testing environments, and with appropriate safety precautions.
- Threading, Tapping and Rigid Tapping: These cycles may require disabling fluctuation detection.
- Parameter-Dependent: The allowable fluctuation (the threshold that triggers the alarm) is set by a parameter, not directly within the
G25
orG26
command.
Conceptual Example (Hypothetical - Do Not Use Without Verification):
<; (Assume a very old Fanuc control where G25/G26 have this function) ; … (Setup, tool selection, etc.) … G25 ; Disable spindle speed fluctuation detection (e.g., for a low-speed operation) ; … (Machining operations where precise speed control is less critical)… G26 ; Enable spindle speed fluctuation detection ; … (Machining operations where precise spindle speed is critical) … G25 ; Re-enable spindle speed fluctuation detection ; …
Again, this is a hypothetical example for older Fanuc systems. Do not use this code without verifying that G25
and G26
have this specific function on your machine, understanding the correct syntax and parameters, and being fully aware of the risks. Disabling safety features like spindle speed monitoring can lead to tool breakage, workpiece damage, machine damage, and injury.
3. The Correct Ways to Manage Spindle Speed
Since G25
and G26
are unreliable for general spindle speed control, here are the standard and recommended methods:
3.1. Setting Maximum and Minimum Spindle Speed Limits
- Machine Parameters (The Primary Method): The most reliable way to set maximum and minimum spindle speed limits is through machine parameters. These are typically set by the machine tool builder. Consult your machine’s parameter manual for the specific parameter numbers.
G92
(orG50
on Older Fanuc Lathes): On CNC lathes, theG92
command (orG50
on some older Fanuc controls) can be used to set the maximum spindle speed. This is often used in conjunction withG96
(Constant Surface Speed).
G96 S200 ; Constant Surface Speed (200 m/min)
G92 S3000 ; Set maximum spindle speed to 3000 RPM
LIMS
(Siemens): On newer Siemens controls, theLIMS
command can be used to set a maximum spindle speed that applies even inG96
mode.
3.2. Constant Surface Speed (G96 - Lathes) and Constant Spindle Speed (G97)
G96
(Constant Surface Speed - CSS): This command (primarily used on lathes) automatically adjusts the spindle speed (RPM) based on the current X-axis diameter to maintain a constant cutting speed (surface speed) at the tool tip.- Crucially, when using
G96
, you must also set a maximum spindle speed (usingG92
,G50
,LIMS
, or parameters) to prevent the spindle from overspeeding.
- Crucially, when using
G97
(Constant Spindle Speed): This command sets a constant spindle speed (RPM). This is used on both lathes and mills. The spindle speed will remain at the programmedS
value until anotherS
command is given.
4. Control-Specific Information
- Fanuc: As mentioned,
G25
andG26
might relate to spindle speed fluctuation detection on/off on some older Fanuc controls, but this is not standard on modern systems. Use parameters andG92
/G50
(lathes) for speed limits. - Siemens: Siemens controls do not typically use
G25
orG26
for spindle speed control or monitoring. Use parameters,G92
/LIMS
, and other Siemens-specific commands. - Haas: Haas controls do not typically use
G25
orG26
for the functions described in the original articles. Use settings and parameters for spindle speed limits. - Mazak, Mitsubishi: Refer to documentation.
- Other Controls: Always consult your documentation.
5. Programming Examples (Using Correct Methods)
Example 1: Setting Maximum Spindle Speed with G92 (Lathe):
G96 S200 ; Constant Surface Speed (200 m/min)
G92 S3000 ; Set maximum spindle speed to 3000 RPM
; ... machining operations ...
Example 2: Setting Maximum and Minimum Spindle Speeds via Parameters (Conceptual): You would not typically do this within a part program. You would access the machine’s parameter settings through the control panel.
- Fanuc (Conceptual - Do Not Use Without Verification):
- Find the parameter for maximum spindle speed (e.g., might be in the 3700 or 4000 range).
- Find the parameter for minimum spindle speed (e.g., might be in the 4600 range).
- Set these parameters to the desired values.
6. Troubleshooting
- Spindle Speed Not as Expected:
- Check
G96
/G97
usage (lathes). - Check
G92
(or equivalent) command (lathes). - Check machine parameters for maximum/minimum spindle speed.
- Ensure you’re using the correct units (RPM or surface speed).
- Check
- Spindle Speed Fluctuation Alarms:
- This usually indicates a problem with the spindle drive, encoder, belts, or excessive load – not a programming error with
G25
orG26
(on modern controls).
- This usually indicates a problem with the spindle drive, encoder, belts, or excessive load – not a programming error with
7. CAM Software
CAM software typically handles spindle speed limits automatically. You define the limits for your machine and/or tools, and the CAM system generates code that respects those limits (often using G92
on lathes, or by simply limiting the S
values).
8. Frequently Asked Questions (FAQ)
- Q: What are G25 and G26 used for on most CNC machines?
- A: On most modern controls,
G25
andG26
have no standard, documented function related to general spindle speed control. Some older Fanuc controls might have used them for spindle speed fluctuation detection on/off, but this is not common.
- A: On most modern controls,
- Q: How do I set spindle speed limits?
- A: Use machine parameters (the most reliable method). On lathes, you can also often use
G92
(orLIMS
on Siemens) to set a maximum spindle speed, especially withG96
.
- A: Use machine parameters (the most reliable method). On lathes, you can also often use
- Q: Where can I find more information?
- A: In the programming manual.
9. Conclusion
The G25
and G26
commands are not standard G-codes for setting spindle speed limits or controlling spindle speed fluctuation on modern CNC lathes and machining centers. While some older Fanuc controls might have used G25
to enable and G26
to disable spindle speed fluctuation detection, this is not a common or recommended practice. The correct way to manage spindle speed is through machine parameters, and on lathes, often in conjunction with G96
(Constant Surface Speed) and G92
(or LIMS
on Siemens). Always consult your machine’s and control system’s programming manuals to determine the correct procedures and parameters for your specific equipment, and rely on CAM software for complex machining tasks. Do not use non-standard G-codes without thorough verification.