CNC Lathe | G96 Code | Constant Surface Speed

G96 Code Introduction

On CNC lathes, machining process is different from milling process. Turning tool has no diameter and the diameter of a boring bar has no relationship to the spindle speed. It is the part diameter that is the diameter used for spindle speed calculations. As the part is being machined, its diameter changes constantly. For example, during a facing cut or during roughing operations the diameter changes – see illustration in Figure 12-7. Programming the spindle speed in r/min is not practical – after all, which of the numerous diameters should be selected to calculate the r/min? The solution is to use the surface speed directly, as an block entry in the lathe program.

G96 Code Format

To select surface speed is only a half of the procedure. The other half is to communicate this selection to the control system. Control has to be set to the surface speed mode, not the spindle speed (r/min) mode. Operations as drilling, reaming, tapping, etc., are common on a lathe and they require the direct r/min in the program. To distinguish between the two alternatives in lathe programming, the choice of surface speed or revolutions per minute must be specified. This is done with preparatory commands G96 and G97, prior to the spindle function:

G96 S.. M03 : Surface speed selected (m/min or ft/min)
G97 S.. M03 : Spindle speed (r/min) selected

For milling, this distinction normally does not exist and spindle speed in r/min is always assumed.

By programming the surface speed command G96 for turning and boring, the control enters into a special mode, known as the Constant Surface Speed or CSS. In this mode, actual spindle revolutions will increase and decrease automatically, depending on the actual diameter being cut (current diameter). Automatic Constant Surface Speed feature is built in the control systems available for all CNC lathes. It is a feature that not only saves programming time, it also allows the tool to remove constant amount of material at all times, thus saving the cutting tool from excessive wear and creating a better surface finish.
Figure 12-7 shows a typical example, when a facing cut starts at X6.2 (dia6.2), and faces the part to machine centerline or slightly below. G96 S375 was used and 6000 r/min was the maximum spindle speed of the lathe.

Figure 12-7
Example of a facing cut using constant surface speed mode G96

Although only selected diameters are shown in the illustration, along with their corresponding revolutions per minute, the updating process is always constant. Note the sharp increase in r/min as the tool moves closer to machine centerline. When the tool reaches X0 (0.0), the speed will be at its maximum, within the current gear range. As this speed may be extremely high in some cases, control system allows setting of a certain maximum, described later.

G96 Code Examples

To program a surface speed for a CNC lathe, there are several options. In the following three examples, the most important ones will be examined. Gear change functions (if available) are omitted for all examples.

G96 CNC Program Example – 1

Surface speed is set right after the coordinate setting is read from Geometry offset:

N1 G20
N3 G96 S400 M03

In this common application, the actual spindle speed will be based on the preset diameter of 16 inches, resulting in 95 r/min in block N3. In some cases, this will be too low. Consider another example:

G96 CNC Program Example – 2

On very large CNC lathes, geometry offset setting of the X-axis diameter is quite large, say dia24.0 inches. In the previous example, target diameter of the next tool motion was not important, but in this case it is. For example:

N1 G20
N3 G96 S400 M03
N4 G00 X20.0 T0101 M08

In Example 2, the initial tool position is at X24.0 and the tool motion terminates at X20.0, both values are diameters. This translates to an actual motion of only 2.0 inches. At the X24.0, the spindle will rotate at 64 r/min, at X20.0 it will rotate at 76 r/min. The difference is very small to warrant any special programming. It is different, however, if the starting position is at a large diameter, but a tool moves to a much smaller target diameter.

G96 CNC Program Example – 3

Example 3.1

From the initial position of dia24.0 inches, the tool will move to a rather small diameter of 2.0 inches:

N1 G20
N3 G96 S400 M03
N4 G00 X2.0 T0101 M08

Spindle speed at the start of program (block N3) will be the same as in previous example, at 64 r/min. In the next block (N4), the speed calculated for dia2.0 inch will be 764 r/min, automatically calculated by the control. This rather large change in spindle speeds may have an adverse effect on some CNC lathe work. What may happen is that the cutting tool will reach the dia2.0 inch before the spindle speed fully accelerates to the required 764 r/min. The tool may start removing material at a speed much slower than intended. In order to correct the problem, data in CNC program need to be modified:

Example 3.2

Program modification takes place in block N3. Instead of programming constant surface speed mode, program direct r/min for the target of dia2.0 inches, based on 400 ft/min surface speed. Actual r/min has to be calculated first, then the CSS setting will be programmed in a subsequent block:

N1 G20
N3 G97 S764 M03
N4 G00 X2.0 T0101 M08
N5 G96 S400

In the example, at dia24.0 (X24.0 offset), the actual speed would be only 64 r/min. At dia2.0 (X2.0 in N4), the speed will be 764 r/min. Cutting tool may reach X2.0 position before the spindle speed has accelerated to full 764 r/min, if it is not calculated and programmed earlier – see block N3.

This technique is only useful if the CNC lathe does not support automatic time delay. Many modern lathes have a built-in timer, that forces the cutting tool to wait before actual cutting, until the spindle speed has fully accelerated.

Older CNC lathes used G50 position register command, and the initial position was part of the program. For example, instead of geometry offset set to X24.0 Z5.0, program would contain G50 X24.0 Z5.0. Geometry Offset setting is much more flexible, as it is done at the machine.

Other Details

Maximum Spindle Speed Setting

When CNC lathe operates in the Constant Surface Speed mode, the spindle speed is directly related to the current part diameter. The smaller the work diameter is, the greater the spindle speed will be. So, a natural question is – what will happen if the tool diameter is zero? It may seem impossible to ever program a zero diameter, but there are at least two cases when that is exactly the case.

In the first case, zero diameter is programmed for all centerline operations. All drilling, center drilling, tapping and similar operations are programmed at the zero diameter (X0). These operations are always programmed in the direct r/min mode, using G97 command. In G97 mode, the spindle speed is controlled directly, r/min does not change.
The second case of a zero diameter is when facing off a solid part all the way to the centerline. This is a different situation. For all operations at X0, the cutting diameter does not change, because a direct r/min is programmed. During a face cutting operation, the diameter changes all the time while material removal continues until the tool reaches the spindle centerline. No, don’t reach for the formulas explained earlier. Any calculation with a diameter in the formula being zero, will result in error! Rest assured, there will not be 0 r/min at the spindle centerline – or an error – in G96 mode. Return to Figure 12-7 for illustration.

Whenever the surface speed spindle mode is active and tool reaches spindle centerline at X0, the result will normally be the highest spindle rotation possible, within the active gear range. It is paradoxical, but that is exactly what will happen. Such situation is acceptable when the part is well clamped, does not extend too far from the chuck or fixture, tool is strong and robust, and so on.When a part is mounted in a special fixture, or an eccentric setup is used, when part has a long overhang, or when some other adverse conditions are present, the maximum spindle speed at the centerline may be too high for operating safety!

There is a simple solution to this problem, using a programming feature available for Fanuc and other controls. Surface speed mode can be used with a preset highest limit, specified in revolutions per minute. Program function for maximum spindle r/min setting is normally G50 or G92 on some lathes. This maximum setting is sometimes called maximum spindle speed clamping. Do not confuse this G50/G92 with its other meaning, position register preset. Here is an example of G50 as a speed limiting command:

N1 G20 T0100
N2 G50 S1500 (1500 R/MIN MAX)
N4 G96 S400 M03 (CSS AND 400 FT/MIN)
N5 G00 G41 X5.5 Z0 T0101 M08
N6 G01 X-0.07 F0.012 (BELOW CENTER LINE)
N7 G00 Z0.1
N8 G40 X9.0 Z5.0 T0100
N9 M01

What actually happens in program O1201? Block N1 selects imperial units of measurement and T01. The critical block N2 has a simple meaning:

G50 S1500 means “Do not exceed 1500 r/min in G96 surface speed mode”.

Block N3 selects the spindle gear range; block N4 sets the surface speed mode, using 400 ft/min surface speed. Spindle rotation M03 is called in the same block. In block N5, the tool makes a rapid motion towards dia5.5 and the part front face. During rapid motion, tool nose radius offset and coolant function are activated. Next block N6 is the actual facing cut. At the cutting feedrate of 0.012 in/rev, the tool tip faces off the blank part to the centerline. In reality, the cut end point is programmed on the other side of spindle center line (X-0.07).

Tool nose point radius size must be taken into consideration when programming with the tool nose radius offset (G41/G42) and to the machine centerline.

Block N7 moves the tool tip 0.100 inches away from the face, at a rapid rate. In the remaining two blocks, the tool will rapid to the indexing position with a cancellation of radius offset in N8 and an optional program stop is provided in block N9.

Now, think of what happens in critical blocks N5 and N6. Spindle will rotate at the speed of 278 r/min at the dia5.5. Since the CSS mode is in effect, as the tool tip faces off the part, its diameter is becoming smaller and smaller while the r/min is constantly increasing.
Without the maximum spindle speed limit in block N2, the spindle speed at the centerline will be equivalent to the maximum r/min available within M42 gear range. A typical range may be 4000 r/min or even higher.

With the preset maximum spindle speed limit of 1500 r/min (G50 S1500), the spindle will be constantly increasing its speed, but only until it reaches the 1500 preset r/min, then it will remain at that speed for the rest of cut.

At the control, CNC operator can easily change the maximum limit value, to reflect true setup conditions or to optimize cutting values.

Spindle speed is preset – or clamped – to the maximum r/min setting, by programming the S function together with the G50 preparatory command. If the S function is in a block not containing G50, the control will interpret it as a new spindle speed (CSS or r/min), that will be active from that block on. This error may be very costly!

Use caution when presetting maximum r/min of the spindle!

Maximum spindle speed can be clamped in a separate block or in a block that also includes the current tool coordinate setting.Typically, the combined setting is useful at the beginning of a tool, the separate block setting is useful if the need arises to change the maximum spindle speed in the middle of a tool, for instance, between facing and turning cuts using the same tool.

To program G50 command as a separate block, anywhere in the program, just issue the preparatory command combined with the spindle speed preset value. Such a block will have no effect whatsoever on any active coordinate setting, it represents just another meaning of G50 command. The following examples are all correct applications of G50 command for both, the old style coordinate setting and/or the maximum spindle speed preset:

N12 G50 X20.0 Z3.0 S1500 Double meaning
N38 G50 S1250 Single meaning
N15 G50 X8.5 Z2.5 Single meaning
N40 G50 Z4.75 S700 Double meaning

If the CNC lathe supports old G92 instead of G50, keep in mind that they have exactly the same meaning and purpose. On old controls, G50 command is more common than G92 command but programming method is the same.

Part Diameter Calculation in CSS

Often, knowing at what diameter the spindle will actually be clamped can be a very useful information. Such knowledge may influence preset value of spindle speed clamping. To find out at what diameter the Constant Surface Speed will remain fixed, the formula that finds the r/min at a given diameter must be reversed:

D = Diameter where CSS stops (in inches)
12 = Multiplying factor – feet to inches conversion
ft/min = Active surface speed – feet per minute
pi = Constant 3.1415927
r/min = Preset maximum spindle speed

Example – Imperial units :

If the preset value in a program is G50 S1000 and the surface speed is set as G96 S350, the CSS will be clamped when it reaches the dia1.3369 inches:

D = (12 x 350) / (pi x 1000)
= 1.3369015
= dia1.3369

The formula may be shortened;

D = Diameter where CSS stops (in mm)
1000 = Multiplying factor – meters to mm conversion
m/min = Active surface speed – meters per minute
pi = Constant 3.1415927
r/min = Preset maximum spindle speed

Just like in its imperial version counterpart, metric formula may be shortened as well:
Example – Metric units :

If the preset value in a program is G50 S1200 and the surface speed is set as G96 S165, the CSS will be clamped when it reaches the dia43.768 mm:

D = (1000 x 165) / (pi x 1200)
= 43.767609
= dia43.768 mm

Cutting Speed Calculation

Constant Surface Speed (CSS) – cutting speed – is required for virtually all turning and boring operations on a CNC lathe. It is also the basic source of cutting data, from which the spindle speed is calculated for virtually all machining center operations. Now, consider a very common scenario:

CNC operator has optimized the current cutting conditions, including the spindle speed, so they are very favorable. Can these conditions be applied to subsequent jobs?
Yes, they can – and should – provided that certain critical requirements will be satisfied:

  • Machine and part setup are equivalent
  • Cutting tools are equivalent
  • Material conditions are equivalent
  • Other common conditions are satisfied

If these requirements are met, the most important source data is the spindle speed actually used during machining. Once the spindle speed is known, the cutting speed (CSS) can be calculated and used for any other tool diameter, providing the requirements above are met.

In a nutshell, the whole subject can be quickly summed up by categorizing it as a cutting speed calculation – calculation of Constant Surface Speed (CSS), when the tool or part diameter and the spindle speed are known.

From there on, it is a simple matter of formulas:

The major benefit of using this method is a significant reduction of time spent at the CNC machine, usually required to find and ‘fine-tune’ the optimum spindle speed during setup or part optimization. Knowing when a particular cutting speed can be applied is one of several optimizing methods available to CNC programmers.