Part 9 of the Heidenhain TNC 640 training series explains turning on mill-turn machines from the operator’s side: which keys switch to turning mode, how speed and feed rate are defined, how the turning tool table is opened and corrected, how unbalance is measured and what the 800-series turning cycles look like in a program. This page applies only to TNC 640 machines with the turning option (option 50). The information is taken from the Heidenhain TNC 640 user’s manuals.
How does mill-turning work on the Heidenhain TNC 640?

| Topic | In turning mode |
|---|---|
| What rotates | The workpiece rotates. The rotary table serves as the lathe spindle; the milling spindle with the tool is fixed |
| Coordinates | X describes the diameter of the workpiece, Z the longitudinal position. Programming is always in the XZ plane |
| Workpiece zero | The preset must be in the center of the lathe spindle (rotary table) |
| Position display | Diameter values are shown for the X axis, with an additional diameter symbol |
| Speed potentiometer | The spindle potentiometer acts on the lathe spindle (rotary table) |
| Simulation | Turning can be simulated only in the Test Run mode (option 20 and a workpiece blank suitable for turning are required) |
Which machine axes are used depends on the machine kinematics and is defined by the machine tool builder.
How do you switch to turning mode? (FUNCTION MODE TURN)
| Step | What to do | What you see |
|---|---|---|
| 1 | In the Programming mode, go to the block after which the line should be inserted | – |
| 2 | Press the SPEC FCT key | The soft-key row with special functions appears |
| 3 | Press the TURNING PROGRAM FUNCTIONS soft key | The turning functions appear |
| 4 | Press the BASIC FUNCTIONS soft key | – |
| 5 | Press the FUNCTION MODE soft key | – |
| 6 | Press the TURN or MILL soft key | The line FUNCTION MODE TURN or FUNCTION MODE MILL is written into the program |
| 7 | If the builder has enabled kinematics selection: enter a quotation mark and press SELECT KINEMATICS | The kinematics name is added, e.g. FUNCTION MODE TURN "AC_TABLE" |
While turning mode is active, a symbol is shown in the status display; in milling mode there is no symbol. When switching, the control runs a macro prepared by the machine tool builder that makes the machine-specific settings.
| Point to note | What the manual says |
|---|---|
| Tool position | The tool tip must be oriented to the center of the lathe spindle; position the Y coordinate to the center of the lathe spindle |
| Outside and inside machining | For outside machining the tool tip points to the center, for inside machining away from the center |
| Direction of rotation | After a tool change, check that the direction of rotation of the lathe spindle is correct |
| Switching not possible | The mode cannot be switched while Tilt Working Plane or TCPM is active |
| Coordinate transformations | In turning mode no coordinate transformations are permitted except the datum shift |
| Clamping | Heavy workpieces at high speed create large forces; make sure the workpiece is securely clamped |
How is the speed defined for turning? (FUNCTION TURNDATA SPIN)
| Step | What to do | What you see |
|---|---|---|
| 1 | Press the SPEC FCT key | The special functions row appears |
| 2 | Press the TURNING PROGRAM FUNCTIONS soft key | – |
| 3 | Press the FUNCTION TURNDATA soft key | – |
| 4 | Press the TURNDATA SPIN soft key | – |
| 5 | Use the VCONST: soft key to switch constant cutting speed on or off and enter the values | The line is written into the program |
| Entry | Meaning |
|---|---|
| VCONST:ON | Constant cutting speed. The control raises the speed as the tool moves toward the center and lowers it as the tool moves away |
| VCONST:OFF | Constant spindle speed, independent of the tool position |
| VC | Cutting speed (optional) |
| S | Nominal speed when constant cutting speed is not active (optional) |
| S MAX | Maximum speed with constant cutting speed (optional). Reset with S MAX 0 |
| GEARRANGE | Gear range for the lathe spindle (optional) |
| Program line | What it does |
|---|---|
FUNCTION TURNDATA SPIN VCONST:ON VC:100 GEARRANGE:2 | Constant cutting speed 100 in gear range 2 |
FUNCTION TURNDATA SPIN VCONST:OFF S550 | Constant spindle speed 550 |
When the maximum speed is reached, the status display shows SMAX instead of S. With constant cutting speed the selected gear range limits the possible speed range; the gear ranges depend on the machine.
How is the feed rate given in mm per revolution? (M136)
| Program line | What it means |
|---|---|
15 L Z-10 F200 | Without M136 the F value is interpreted in mm/min: 200 mm/min |
19 M136 | From here on feed rates are interpreted in mm per revolution |
20 L X+154 F0.2 | Feed rate 0.2 mm per revolution |
M137 | Cancels M136; the feed rate is in mm/min again |
With feed per revolution the control moves the tool by the entered value for each spindle revolution, so the contouring feed rate rises with the speed. Feed rates inside turning cycles follow the same rule: mm/rev if M136 is programmed, otherwise mm/min. Check whether M136 is active before you change an F value.
How do you open and fill in the turning tool table? (TOOLTURN.TRN)

| Step | What to do | What you see |
|---|---|---|
| 1 | Select a machine operating mode, e.g. Manual Operation | – |
| 2 | Press the TOOL TABLE soft key | The tool table (TOOL.T) opens |
| 3 | Press the TURNING TOOLS soft key | The turning tool table (toolturn.trn) opens |
| 4 | Set the EDIT soft key to ON | Values can be changed; below the table the control shows the dialog text, unit and input range of the selected field |
Two tables work together: A turning tool must also be marked in the tool table TOOL.T by selecting the tool type TURN in the TYP column. The tool number in TOOLTURN.TRN must match the number in TOOL.T. Geometry values such as L and R from TOOL.T are not effective with turning tools.

| Column | Meaning |
|---|---|
| T | Tool number; must match the number in TOOL.T |
| NAME | Tool name; taken over automatically from the tool table |
| ZL | Tool length 1 (Z direction) |
| XL | Tool length 2 (X direction) |
| YL | Tool length 3 (Y direction) |
| DZL / DXL / DYL | Delta values (wear); added to ZL, XL and YL |
| RS | Tool tip radius; considered in turning cycles and for contours with RL/RR compensation |
| TO | Tool orientation (direction of the tool tip), 1 to 9 |
| ORI | Spindle orientation angle of the milling spindle for aligning the turning tool to the machining position |
| T-ANGLE | Setting angle for roughing and finishing tools |
| P-ANGLE | Point angle for roughing and finishing tools |
| CUTLENGTH / CUTWIDTH | Cutting length and width of the recessing tool |
| DCW | Oversize for the recessing tool width |
| TYPE | Tool type: ROUGH, FINISH, THREAD, RECESS, BUTTON, RECTURN (groove turning) |
Roughing and finishing tools require ZL, XL, RS, TO, ORI, T-ANGLE, P-ANGLE and TYPE. Recessing tools require CUTWIDTH instead of T-ANGLE and P-ANGLE. The tool must be clamped and measured in the correct position; check the tool orientation before machining.
How do you enter a size correction (wear) for a turning tool?
When you enter the deviation measured on the workpiece, the control calculates DXL and DZL itself (tool management, option 93; the range of functions is defined by the machine tool builder).
| Step | What to do | What you see |
|---|---|---|
| 1 | Select a machine operating mode, e.g. Manual Operation | – |
| 2 | Press the TOOL TABLE soft key | – |
| 3 | Press the TOOL MANAGEMENT soft key | Tool management opens |
| 4 | Press the FORM FOR TOOL soft key | The form view of the tool opens |
| 5 | Set the EDIT soft key to ON | – |
| 6 | Select the DXL or DZL field with the arrow keys | – |
| 7 | Press the CALCULATE TOOL COMPENSTN. soft key | A pop-up window opens |
| 8 | Enter the measured error in Z and in X (as a diameter); press APPLY if required | The control calculates the new DZL and DXL values |
| 9 | Press the OK soft key | The window closes and the new compensation values are saved in the tool table |
Example from the manual: with compensation value Z = 1, compensation X (diameter) = 1, inclination angle 90 and reverse the tool = Yes, the result is DZL +0.5 and DXL +1.
A correction can also be given in the program: FUNCTION TURNDATA CORR-TCS:Z/X DZL:0.1 DXL:0.05 applies additional compensation to the active tool; the values are added to those in the table. A new TOOL CALL deactivates this compensation.
How do you measure unbalance after clamping a workpiece?
If the mass of the rotating workpiece is not evenly distributed, centrifugal forces cause vibration; this harms the machining, shortens tool life and high forces can damage the machine. The manual asks you to check the unbalance after clamping a new workpiece and also between machining steps. These functions are adapted by the machine tool builder and are not available on every machine.

| Step | What to do | What you see |
|---|---|---|
| 1 | Activate turning mode first (FUNCTION MODE TURN) | The cycle runs only in turning mode |
| 2 | In Manual Operation, shift the soft-key row and press MANUAL CYCLES | – |
| 3 | Press the TURNING soft key | – |
| 4 | Press the MEASURE UNBALANCE soft key | The control asks for the speed |
| 5 | Enter the speed for unbalance detection | – |
| 6 | Press NC Start | The table starts at low speed and increases step by step to the entered speed; then a window shows the calculated mass and radial position of the balancing weight |
| 7 | Clamp the balancing weight and repeat the measurement | The remaining unbalance is shown |
If you want to use a different mass or radial position, overwrite one of the two values in the window and have the other recalculated. The unbalance monitor is activated automatically when you switch to turning mode; if the limit set by the builder is exceeded, the control outputs an error message and goes to emergency stop.
How do you select a turning cycle?
| Step | What to do | What you see |
|---|---|---|
| 1 | In the Programming mode press the CYCL DEF key | The groups of cycles appear |
| 2 | Press the turning soft key | The groups of turning cycles appear |
| 3 | Select the cycle group, e.g. longitudinal stock removal | The cycles of that group appear |
| 4 | Select the cycle, e.g. 811 | The dialog opens; type each value and confirm with ENT (part 8 of this series) |
| Cycle group | Cycles | What they are for |
|---|---|---|
| Special cycles | 800, 801, 880, 892 | Adapting and resetting the coordinate system for turning, gear hobbing, unbalance check |
| Longitudinal stock removal | 811, 812, 813, 814, 810, 815 | Longitudinal turning (shoulder, plunge, contour) |
| Transverse stock removal | 821, 822, 823, 824, 820 | Face turning |
| Recess turning | 841, 842, 840, 851, 852, 850 | Radial and axial turning with a recessing tool |
| Recessing | 861, 862, 860, 871, 872, 870 | Radial and axial recessing |
| Thread cutting | 831, 832, 830 | Thread turning |
Turning cycles can be used only while FUNCTION MODE TURN is active and are called with CYCL CALL or M99.
What does the turning section of a CAM program look like? (line by line)
The turning part of the example program in the manual shows, in order, everything that must be in the program before the cycle call:
| Program line | What it does |
|---|---|
3 TOOL CALL 12 | Calls the turning tool |
4 M140 MB MAX | Retracts the tool |
5 FUNCTION MODE TURN | Activates turning mode |
6 FUNCTION TURNDATA SPIN VCONST:ON VC:150 | Constant cutting speed 150 |
7 CYCL DEF 800 ADJUST XZ SYSTEM | Adapts the coordinate system for turning and aligns the tool |
8 M136 | Feed rate in mm per revolution |
9 L X+165 Y+0 R0 FMAX | Moves to the starting point in the plane (Y = center of the lathe spindle) |
10 L Z+2 R0 FMAX M304 | Moves to the set-up clearance and switches on the lathe spindle |
11 CYCL DEF 812 SHOULDER, LONG. EXT. | Longitudinal shoulder turning cycle with its values |
12 CYCL CALL M8 | Runs the cycle and switches on the coolant |
13 M305 | Stops the lathe spindle |
Note: The M codes that start and stop the lathe spindle (M303, M304, M305 in the example) depend on the machine tool builder; check the machine manual for the codes on your machine.
What do Cycles 800 and 801 do?
For turning, the tool must be brought to a suitable angle relative to the lathe spindle. Cycle 800 ADJUST XZ SYSTEM aligns the workpiece coordinate system for turning and orients the tool. It stays in effect until it is reset by Cycle 801 or redefined. The function is machine-dependent and must be adapted by the machine tool builder.
| Parameter | Name in the program | Meaning |
|---|---|---|
| Q497 | PRECESSION ANGLE | When milling spindle and lathe spindle axes are parallel: rotation of the coordinate system around the spindle axis, e.g. to bring the tool into a certain position when space is tight |
| Q498 | REVERSE TOOL | Mirrors the tool by positioning the milling spindle rotated by 180 degrees, so one tool can be used for inside and outside machining. Reset by a new TOOL CALL |
| Q530 | INCLINED MACHINING | How the swivel axis is positioned for inclined turning: 0 = the coordinate system is aligned to an already positioned swivel axis. 1 = the swivel axis is positioned with a compensating movement. 2 = positioned without compensating movement. 3 = the angle is calculated but no positioning is done |
| Q531 | ANGLE OF INCIDENCE | Angle between tool and lathe spindle for inclined turning; the swivel axis angle is calculated from it |
| Q535 | ECCENTRIC TURNING | Eccentric turning for workpieces that cannot be clamped with the turning center aligned to the lathe spindle axis. Reset at the end of the program or by a program abort |
Cycle 801 has no parameters; it resets the settings Q497 and Q498 and the speed limit set by Cycle 800. It does not move the tool to a starting position; the tool stays where it is.
Danger of collision: During eccentric turning the control performs compensating movements when coupling and decoupling, and DCM collision monitoring is not active. Coupling and decoupling must be done while the lathe spindle is stationary.
What do the values of Cycle 811 for longitudinal shoulder turning do?

Cycle 811 (SHOULDER, LONGITDNL.) turns a right-angled shoulder longitudinally. The machined area runs from the tool position at the cycle call to the end point defined in the cycle. If the tool is outside the contour at the call, outside machining is performed; if it is inside, inside machining.
| Parameter | Meaning |
|---|---|
| Q215 | Machining operation: 0 = roughing and finishing, 1 = only roughing, 2 = only finishing to final dimension, 3 = only finishing to oversize |
| Q460 | Set-up clearance for retraction and pre-positioning |
| Q493 | X coordinate of the contour end point (diameter) |
| Q494 | Z coordinate of the contour end point |
| Q463 | Maximum infeed in radial direction (radius value). The control distributes the cuts evenly |
| Q478 | Roughing feed rate. In mm/rev if M136 is programmed, otherwise mm/min |
| Q483 | Oversize on the diameter |
| Q484 | Oversize in Z |
| Q505 | Finishing feed rate. In mm/rev if M136 is programmed, otherwise mm/min |
| Q506 | Contour smoothing: 0 = after each cut along the contour, 1 = after the last cut (entire contour), 2 = no smoothing |
Caution: The tool position at the cycle call defines the size of the area to be machined. If you change the positioning block before the call (e.g. L X+75 Y+0 Z+2 FMAX M303), the amount of material removed changes too. During finishing the cycle moves the tool to the starting point itself; position the tool so that this approach cannot damage the contour.
Frequently asked questions
Can every TNC 640 do turning?
No. The turning functions require software option 50 and a machine prepared for turning by the machine tool builder. The TNC 640 is a milling control; turning is done on mill-turn machines with a rotary table.
How do you switch to turning mode on a Heidenhain?
With the line FUNCTION MODE TURN in the program. To write it, press SPEC FCT, then the soft keys TURNING PROGRAM FUNCTIONS, BASIC FUNCTIONS, FUNCTION MODE and TURN. Use FUNCTION MODE MILL to return to milling.
Is X a diameter or a radius in turning mode?
A diameter. In turning mode the position display of the X axis shows diameter values with an additional diameter symbol.
In which table is the length of a turning tool entered?
In the turning tool table TOOLTURN.TRN: ZL (Z direction) and XL (X direction). The L and R values in TOOL.T are not effective for turning tools; in TOOL.T only the type TURN is selected in the TYP column.
Is the turning feed rate in mm/rev or mm/min?
In mm per revolution if M136 is programmed, otherwise in mm/min. M137 cancels M136. Feed rates inside turning cycles follow the same rule.
Heidenhain TNC 640 training series
- 1. Heidenhain TNC 640 Keys, Screen and Operating Modes
- 2. Entering, Editing and Deleting Programs
- 3. Transferring CAM Programs and File Management
- 4. Tool Length Setting: Single Tool and All Tools
- 5. Setting the Work Zero (Preset) and the Preset Table
- 6. Resuming an Interrupted Program on Heidenhain
- 7. Heidenhain Error Messages, PLC Messages and MOD Settings
- 8. Heidenhain Cycles: Drilling, Tapping and Pockets
- 9. Mill-Turning on Heidenhain: Turning Mode and 800-Series Cycles (this page)
Safety warning and disclaimer
In turning the workpiece rotates: check the clamping, the unbalance and the speed limit (S MAX) for every workpiece, and do not use high speeds with heavy or unbalanced workpieces. Check the program first with Test Run and then on the machine in single block with a low feed override. Turning mode, Cycle 800, the unbalance functions and the lathe spindle M codes depend on the machine tool builder; the machine manual always takes priority.
Mentor CNC cannot be held responsible for tool breakage, scrap parts, machine damage or accidents resulting from the use of the information on this page. Responsibility lies with the person and the company applying it.
