Part 8 of the Heidenhain TNC 640 training series explains cycles (CYCL DEF) from the operator’s side: what a cycle looks like in a CAM program, which key brings up which screen, how to change a depth or feed rate at the machine and how a cycle is called. It then goes through the values of the drilling (200), rigid tapping (207) and rectangular pocket (251) cycles one by one. The information is taken from the Heidenhain cycle programming and conversational programming user’s manuals.
What is a cycle on a Heidenhain control and how does it look in the program?
Frequently recurring operations that consist of several working steps (drilling, tapping, pocket milling) are stored in the control as ready-made cycles. The values of a cycle are entered as Q parameters. In the program a cycle looks like this:
| Program line | What it means |
|---|---|
11 CYCL DEF 200 DRILLING | Cycle definition: drilling cycle number 200. The tool does not move in this line |
Q201=-15 ;DEPTH | One value of the cycle. The text after the semicolon is a comment added by the control |
12 L X+30 Y+20 FMAX M3 | Move to the hole center and switch on the spindle |
13 CYCL CALL | Run the cycle once at this position |
14 L X+80 Y+50 FMAX M99 | Move to the new position and run the cycle there too |
Rule to remember: For machining cycles, CYCL DEF only defines; the tool starts cutting in the CYCL CALL or M99 line.
How do you add a new cycle to a program? (key by key)

| Step | What to do | What you see |
|---|---|---|
| 1 | Press the Programming operating mode key | The program is on the screen |
| 2 | Use the up / down arrow keys to select the block after which the cycle should be inserted | The block is highlighted |
| 3 | Press the CYCL DEF key | The soft-key row shows the groups of cycles |
| 4 | Select the group, for example the DRILLING/ THREAD soft key | The cycles of that group appear as soft keys with number and small picture (200, 203, 207 …) |
| 5 | Select the cycle, for example the 200 soft key | The dialog opens: the first prompt appears (e.g. Set-up clearance?), a help graphic is shown in the right half of the screen and the requested parameter is highlighted in it |
| 6 | Type the value and press ENT | The next prompt appears |
| 7 | Repeat for all prompts: type the value, ENT | After the last value the control ends the dialog; the cycle is in the program |
How do you pick a cycle from the list with GOTO?
| Step | What to do | What you see |
|---|---|---|
| 1 | Press the CYCL DEF key | The groups of cycles appear |
| 2 | Press the GOTO key | The smartSelect window with an overview of the cycles opens |
| 3 | Select the cycle with the arrow keys or the mouse | The cycle dialog opens as described above |
Which cycle groups appear on the CYCL DEF key?
| Soft key | Cycles in the group |
|---|---|
| DRILLING/ THREAD | Drilling, pecking, reaming, boring, counterboring; tapping, thread cutting and thread milling |
| POCKETS/ STUDS/ SLOTS | Pocket, stud, slot and face milling |
| COORD. TRANSF. | Coordinate transformation: shifting, rotating, mirroring, enlarging and reducing |
| SL cycles | Contours made up of several overlapping subcontours, cylinder surface machining |
| PATTERN | Point patterns: holes on a circle and on lines |
| Turning | Turning (mill-turn) and gear hobbing cycles |
| SPECIAL CYCLES | Dwell time, program call, oriented spindle stop, engraving, tolerance |
The machine tool builder can add own cycles: numbers 300 to 399 on the CYCL DEF key and touch probe cycles 500 to 599 on the TOUCH PROBE key. They are described in the machine manual.
How do you change a depth or feed rate in a cycle of a CAM program?
| Step | What to do | What you see |
|---|---|---|
| 1 | Open the program in the Programming mode | The program is on the screen |
| 2 | Use the up / down arrow keys to go to the Q line you want to change, e.g. Q201=-15 ;DEPTH | The line is highlighted |
| 3 | Press the right arrow key to move onto the value | The value is highlighted and its dialog prompt appears |
| 4 | Type the new value | It overwrites the old value |
| 5 | Press the END key | The change is concluded |
The control usually saves changes automatically when you switch the operating mode or open the file manager; to save at once use the STORE soft key. If you want to delete a cycle that consists of several lines, the control asks whether the whole cycle should be deleted.
Caution: Cycles execute extensive operations. After changing a value, run a Test Run before machining (part 6 of this series).
How is a cycle called? CYCL CALL, M99 and M89
| Call | What it does |
|---|---|
| CYCL CALL | Calls the most recently defined cycle once. The starting point is the position programmed last before the CYCL CALL block |
| M99 (at the end of a positioning block) | The control moves to that position and calls the last defined cycle once |
| M89 | The cycle runs automatically after every positioning block. Cancel with M99 in the block moving to the last position, or by defining a new cycle with CYCL DEF |
| CYCL CALL PAT | Calls the cycle at all positions defined in a PATTERN DEF pattern or a point table |
| CYCL CALL POS | Calls the cycle once at the position written in the block; three axes must always be programmed in it |
| Step | What to do | What you see |
|---|---|---|
| 1 | Press the CYCL CALL key | The cycle call soft keys appear |
| 2 | Press the CYCL CALL M soft key | The control asks for a miscellaneous function |
| 3 | Enter an M function if needed (e.g. M3 to switch on the spindle) or end with the END key | The call block is written into the program |
Before a cycle call the program must contain: a tool call (TOOL CALL), the direction of spindle rotation (M3/M4) and the cycle definition (CYCL DEF). BLK FORM is needed only for the test graphics.
Cycles that are not called: These cycles take effect from the line in which they are defined: coordinate transformation cycles (7, 247, 8, 10, 11, 26, 19), 32 TOLERANCE, 9 DWELL TIME, point patterns 220 and 221, SL cycles 14 CONTOUR and 20 CONTOUR DATA, and all touch probe cycles.
How does Cycle 200 DRILLING work and what do its values mean?

| Step | What the tool does |
|---|---|
| 1 | Moves at rapid traverse (FMAX) to the set-up clearance above the workpiece surface |
| 2 | Drills to the first plunging depth at the programmed feed rate F |
| 3 | Retracts at FMAX to the set-up clearance, dwells there if a dwell is entered, then moves at FMAX to the set-up clearance above the first plunging depth |
| 4 | Drills one more plunging depth at feed rate F; steps 2 to 4 repeat until the total depth is reached |
| 5 | Retracts from the hole bottom at FMAX to the set-up clearance or, if entered, to the 2nd set-up clearance |
| Parameter | Name in the program | Meaning |
|---|---|---|
| Q200 | SET-UP CLEARANCE | Distance between tool tip and workpiece surface (incremental). Enter a positive value |
| Q201 | DEPTH | Distance from workpiece surface to hole bottom (incremental). Enter a negative value |
| Q206 | FEED RATE FOR PLNGNG | Drilling feed rate in mm/min. Alternatives: FAUTO, FU |
| Q202 | PLUNGING DEPTH | Infeed per cut (incremental). If it is equal to or greater than the depth, the control drills in one step |
| Q210 | DWELL TIME AT TOP | Dwell at set-up clearance after retracting from the hole for chip removal, in seconds |
| Q203 | SURFACE COORDINATE | Coordinate of the workpiece surface (absolute) |
| Q204 | 2ND SET-UP CLEARANCE | Height at which no collision between tool and workpiece or fixtures can occur (incremental) |
| Q211 | DWELL TIME AT DEPTH | Dwell at the hole bottom, in seconds |
| Q395 | Depth reference | 0 = depth refers to the tool tip; 1 = depth refers to the cylindrical part of the tool (point angle T-ANGLE must be defined in the tool table) |
Danger of collision: If a positive depth is entered, the control reverses the pre-positioning and the tool moves at rapid traverse to the set-up clearance below the workpiece surface. Enter the depth as a negative value. The machine parameter displayDepthErr (no. 201003) defines whether the control outputs an error message for a positive depth. With depth = 0 the cycle is not executed.
What other drilling cycles are there?
| Cycle | Name | What it does |
|---|---|---|
| 240 | CENTERING | Centering; centering diameter or depth can be entered |
| 200 | DRILLING | Drilling in several infeeds |
| 201 | REAMING | Reaming |
| 202 | BORING | Boring |
| 203 | UNIVERSAL DRILLING | Drilling with chip breaking and decrement |
| 204 | BACK BORING | Back boring |
| 205 | UNIVERSAL PECKING | Deep-hole pecking with chip breaking |
| 208 | BORE MILLING | Milling a hole with an end mill |
| 241 | SINGLE-LIP DEEP-HOLE DRILLING | Deep-hole drilling with a single-lip drill |
How do you use tapping Cycle 207?

Cycle 207 (RIGID TAPPING NEW) cuts the thread without a floating tap holder. It can be used only on machines with a controlled spindle; machine and control must be prepared by the machine tool builder. The tool moves at FMAX to the set-up clearance, goes to the thread depth in one movement, the spindle reverses, the tool retracts to the set-up clearance and the spindle stops.
| Parameter | Name in the program | Meaning |
|---|---|---|
| Q200 | SET-UP CLEARANCE | Distance between tool tip and workpiece surface (incremental) |
| Q201 | DEPTH | Distance from workpiece surface to the bottom of the thread (incremental). Enter a negative value |
| Q239 | PITCH | Thread pitch. The sign defines the direction: + right-hand thread, – left-hand thread |
| Q203 | SURFACE COORDINATE | Coordinate of the workpiece surface (absolute) |
| Q204 | 2ND SET-UP CLEARANCE | Height at which no collision can occur (incremental) |
| Topic | What the manual says |
|---|---|
| Potentiometers | The spindle speed potentiometer is inactive. Whether the feed rate potentiometer can be used during tapping is configured by the machine tool builder |
| Spindle | If M3 or M4 is programmed before the cycle, the spindle keeps turning after the cycle. If not, it stops and must be switched on again with M3 or M4 before the next operation |
| Pitch check | If a pitch is entered in the Pitch column of the tool table, the control compares it with the pitch in the cycle and outputs an error message if they differ |
| Other tapping cycles | 206 TAPPING NEW: tapping with a floating tap holder. 209 TAPPING W/ CHIP BREAKING. 262 THREAD MILLING: milling a thread into a pre-drilled hole |
How do you retract the tap if the program is stopped during tapping?
| Step | What to do | What you see |
|---|---|---|
| 1 | Press the NC Stop key | The control shows the MANUAL TRAVERSE soft key |
| 2 | Press MANUAL TRAVERSE | The tool can be moved in the active spindle axis |
| 3 | Move the tool in the direction that takes it out of the hole | – |
| 4 | To continue machining, press the RESTORE POSITION soft key and NC Start | The control returns the tool to the position before the NC stop |
Danger of collision: During retraction the tool can be moved in both the positive and the negative direction of the tool axis. Be sure which direction leads out of the hole before you move.
What do the values of Cycle 251 RECTANGULAR POCKET do?

Cycle 251 machines a rectangular pocket completely, with roughing and finishing.
| Parameter | Name in the program | Meaning |
|---|---|---|
| Q215 | MACHINING OPERATION | 0 = roughing and finishing, 1 = only roughing, 2 = only finishing |
| Q218 | FIRST SIDE LENGTH | Pocket length parallel to the principal axis |
| Q219 | 2ND SIDE LENGTH | Pocket length parallel to the secondary axis |
| Q220 | CORNER RADIUS | Radius of the pocket corner. With 0 the corner radius equals the tool radius |
| Q368 | ALLOWANCE FOR SIDE | Finishing allowance on the walls |
| Q224 | ANGLE OF ROTATION | Angle by which the whole operation is rotated; the center of rotation is the tool position at the cycle call |
| Q367 | POCKET POSITION | Pocket position relative to the tool position at the call: 0 = pocket center, 1 = lower left, 2 = lower right, 3 = upper right, 4 = upper left corner |
| Q207 | FEED RATE FOR MILLING | Milling feed rate in mm/min |
| Q351 | CLIMB OR UP-CUT | +1 = climb milling, -1 = up-cut milling (with M3) |
| Q201 | DEPTH | Distance from workpiece surface to pocket floor. Enter a negative value |
| Q202 | PLUNGING DEPTH | Infeed per cut; enter a value greater than 0 |
| Q369 | ALLOWANCE FOR FLOOR | Finishing allowance on the floor |
| Q206 | FEED RATE FOR PLNGNG | Feed rate when moving to depth, mm/min |
| Q338 | INFEED FOR FINISHING | Infeed in the spindle axis per finishing cut. 0 = finishing in one infeed |
| Q200 / Q203 / Q204 | SET-UP CLEARANCE / SURFACE COORDINATE / 2ND SET-UP CLEARANCE | Same meaning as in Cycle 200 |
| Q370 | TOOL PATH OVERLAP | Q370 x tool radius = stepover |
| Q366 | PLUNGE | Plunging strategy: 0 = vertical, 1 = helical, 2 = reciprocating. For 1 and 2 the plunging angle ANGLE in the tool table must not be 0, otherwise the control outputs an error message |
| Q385 | FEED RATE FOR FINISHING | Feed rate for side and floor finishing, mm/min |
| Q439 | Feed rate reference | Whether the programmed feed rate refers to the tool center path or to the cutting edge (0 to 3) |
Danger of collision: If the cycle is called with Q215=2 (only finishing), the tool is pre-positioned at rapid traverse to the first plunging depth plus set-up clearance. Roughing must have been done before. The depth is entered as a negative value here too.
The same group contains 252 CIRCULAR POCKET, 253 SLOT MILLING, 254 CIRCULAR SLOT, 256 RECTANGULAR STUD, 257 CIRCULAR STUD and Cycle 233 for face milling. Cycles with numbers above 200 always use the same parameter number for the same purpose; the set-up clearance, for example, is Q200 in every cycle.
What do Cycles 247, 7 and 32 at the start of a CAM program do?
| Cycle | Line in the program | What it does |
|---|---|---|
| 247 DATUM SETTING | CYCL DEF 247 DATUM SETTING with Q339=4 ;DATUM NUMBER | Activates line 4 of the preset table as the new preset. When it is activated, the control resets datum shift, mirroring, rotation and scaling factor |
| 7 DATUM SHIFT | CYCL DEF 7.0 DATUM SHIFT, 7.1 X+60, 7.2 Y+40, 7.3 Z-5 | All following coordinates refer to the shifted datum. Reset by defining it again with X0, Y0, Z0 |
| 32 TOLERANCE | CYCL DEF 32.0 TOLERANCE, 32.1 T0.05 | Permissible contour deviation for high-speed machining. The larger the value, the faster the machine moves. The manual recommends 1.1 to 2 times the CAM chord error |
| 19 WORKING PLANE | CYCL DEF 19.0 WORKING PLANE, 19.1 A+0 B+45 C+0 | Tilts the working plane on machines with swivel heads or tilting tables (software option) |
These cycles are not called; they take effect from the line in which they are written and stay active until they are reset, redefined or a new program is selected. Operator check: Make sure the Q339 number in the program is the preset table line in which you set the workpiece zero (part 5 of this series). The number of the active preset is shown in the status display next to the preset symbol.
What does PREDEF in a cycle mean? (GLOBAL DEF)
With GLOBAL DEF, common values such as set-up clearance, 2nd set-up clearance or retraction feed rate are defined once at the start of the program. If a cycle shows PREDEF instead of a value, that value is taken from the GLOBAL DEF block at the program start. When defining a cycle, this link is made with the SET STANDARD VALUES soft key.
Danger of collision: If a GLOBAL DEF value is changed later, the change affects the cycles in the entire program. Run a Test Run after such a change.
Frequently asked questions
How do you define a cycle on a Heidenhain control?
In the Programming mode press the CYCL DEF key, then select the cycle group (e.g. DRILLING/ THREAD) and the cycle (e.g. 200) by soft key. The control asks for the values one after the other; type each value and press ENT.
What is the difference between CYCL DEF and CYCL CALL?
CYCL DEF defines the cycle and its values. CYCL CALL runs the most recently defined machining cycle once at the position reached in the previous block. M99 at the end of a positioning block does the same.
Why is the depth negative in a Heidenhain cycle?
The algebraic sign of the depth parameter determines the working direction. With a positive depth the control reverses the pre-positioning and the tool moves at rapid traverse below the workpiece surface, which is a collision risk.
How do you program a left-hand thread in Cycle 207?
Enter the pitch Q239 with a negative sign. A positive sign means a right-hand thread, a negative sign a left-hand thread.
What is the difference between M99 and M89?
M99 is active only in the block in which it is programmed and calls the cycle once. After M89 the cycle runs automatically after every positioning block; it is cancelled by M99 in the last positioning block or by a new CYCL DEF.
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 (this page)
- 9. Mill-Turning on Heidenhain: Turning Mode and 800-Series Cycles
Safety warning and disclaimer
After changing a value in a cycle, check the program first with Test Run and then on the machine in single block with a low feed override. Check the sign of the depth, the clearances and the surface coordinate every time. The scope and some behavior of the cycles depend on the machine tool builder and the software version; 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.
