Part 6 of the Heidenhain TNC 640 training series covers running a CAM program on the machine, stopping it and resuming an interrupted program where it left off: Test Run, single block, NC Stop and INTERNAL STOP, mid-program startup with BLOCK SCAN, returning to the contour and retracting the tool after a power failure. The information is taken from the Heidenhain TNC 640 Conversational Programming User’s Manual.
How do you run a program on a Heidenhain control?
| Preparation | Description |
|---|---|
| 1. Clamp the workpiece | Clamp the workpiece on the machine table |
| 2. Set the preset | Workpiece zero (part 5 of this series) |
| 3. Select the tables | Select the required tables and pallet files (status M) |
| 4. Select the program | Select the machining program with PGM MGT |
| Operating mode | How it works | When to use it |
|---|---|---|
| Program Run Single Block | Each NC block is started separately with NC Start. In point pattern cycles the control stops after each point | First part from a new program |
| Program Run Full Sequence | The program runs continuously with NC Start until the end or until an interruption | Series production |
Feed rate and spindle speed can be changed with the override potentiometers. The F MAX soft key limits all rapid and feed movements; this limit stays active after the machine is switched off and on.
How do you check a program with Test Run before running it?

| Step | What to do | What you see |
|---|---|---|
| 1 | Press the Test Run operating mode key | – |
| 2 | Select the program to be tested with PGM MGT | The test soft keys appear |
| 3 | To reset the blank form and tool data and test the entire program, press RESET + START | The simulation starts |
| 4 | To test block by block, press the single block soft key | One NC block is run per press |
| 5 | To stop the test, press the STOP soft key | The simulation stops and can be continued |
You can interrupt and continue the test at any time, even within fixed cycles. To continue the test, do not select another block with the arrow keys or GOTO, do not change the program and do not select a new program. For Test Run, a tool table must be selected in file management (status S).
How do you run the Test Run up to a certain block?

| Step | What to do | What you see |
|---|---|---|
| 1 | Press the STOP AT soft key | A pop-up window opens |
| 2 | Stop at: N = enter the block number at which the simulation should stop | – |
| 3 | Program = check the program name; if the block is in a program called with PGM CALL, enter that name | – |
| 4 | If the block is inside a program section repeat, enter the repeat number in Repetitions = | The test runs up to that block |
In this stopped state you can switch block skip and optional stop on or off, change the graphics resolution and model, and edit the program. A change before the interruption point restarts the simulation from the beginning; after a change behind the interruption point you can position to it with GOTO.
Note: The graphic simulation cannot show every real machine movement, for example tool change movements that the machine tool builder defines in a tool change macro or via the PLC. Even when the test shows no error, try every new program carefully on the machine.
How do you stop or abort a program?
| Method | What happens |
|---|---|
| STOP or M0 in the program | The control interrupts the program in that block |
| M1 in the program | Optional stop; the program stops only if the soft key is ON. With M1 the spindle and coolant are not switched off |
| Selecting Program Run Single Block while running | The control stops at the end of the current machining step |
| NC Stop key | The control does not exit the current NC block. Changing the operating mode is not possible; resume with NC Start |
| NC Stop, then the INTERNAL STOP soft key | The program is aborted; the operating mode can be changed. To re-enter you need the program start or BLOCK SCAN |
| M2 or M30 in the program | The program is terminated |
Danger of collision: Certain manual interactions make the control lose program information (the contextual reference): moving the cursor to another NC block, jumping with GOTO to another NC block, editing an NC block, changing Q parameters with Q INFO, or switching the operating mode. Unexpected movements can follow. Restore the contextual reference by repeating the required NC blocks.
How do you retract the spindle after a tool breakage?
During an interruption you can move the machine axes in the same way as in Manual Operation mode.
| Step | What to do | What you see |
|---|---|---|
| 1 | Interrupt machining (NC Stop) | – |
| 2 | Press the MANUAL TRAVERSE soft key | The axis direction keys are enabled |
| 3 | Move the axes with the axis direction keys (retract with Z+ first) | – |
On some machines you must also press NC Start after the MANUAL TRAVERSE soft key to enable the axis direction keys. If the tilted working plane was active, check the 3D ROT setting; the manual recommends the TOOL AXIS function and a low feed rate. If you change the active preset during an interruption, you can only resume with GOTO or mid-program startup at the interruption point.
How do you resume a stopped program where it left off?
| Situation | How to resume |
|---|---|
| Stopped with NC Stop | NC Start key |
| Stopped by STOP, M0 or M1 in the program | NC Start key |
| An erasable error message appeared | Remove the cause, clear the message with CE, then restart or resume where it was interrupted |
| Aborted with INTERNAL STOP | From the program start or with BLOCK SCAN |
| Axes were moved manually | Return to the contour with RESTORE POSITION (see below) |
During an interruption the control saves the last tool called, the active coordinate transformations (datum shift, rotation, mirroring) and the last defined circle center. It uses this data when returning the tool to the contour.
How do you re-enter an interrupted program with BLOCK SCAN?
Danger of collision: When you enter a program with GOTO and a block number, neither the control nor the PLC performs any function that ensures a safe entry. For a safe entry always use BLOCK SCAN. This function must be enabled and configured by the machine tool builder.
BLOCK SCAN starts the NC program at any NC block; machining up to this block is included in the calculation. If the program was stopped with INTERNAL STOP, an emergency stop or a power failure, the control saves the interruption point.

| Step | What to do | What you see |
|---|---|---|
| 1 | In Program Run, press the BLOCK SCAN soft key | A pop-up window with the active main program opens |
| 2 | Start-up at: N = enter the NC block number where you want to start | – |
| 3 | Program = check the name and path (or use the SELECT soft key) | – |
| 4 | If the block is inside a program section repeat, enter the repeat number in Repetitions = (1 = first) | – |
| 5 | If required, press ADVANCED and INSERT LAST NC BLOCK to select the last saved interruption | – |
| 6 | NC Start | The control calculates up to the entered block |
| 7 | If the machine status changed: NC Start | The control restores TOOL CALL and M functions |
| 8 | If the axis positions changed: NC Start | The control moves the axes to the positions in the displayed sequence |
| 9 | NC Start | The program continues |
Example from the manual: after an internal stop, to start in block 12 in the third machining operation of LBL 1, enter N = 12 and Repetitions = 3.
| Point to note | What the manual says |
|---|---|
| Machining cycles | Mid-program startup is always executed at the start of the cycle; if the program was interrupted during a cycle, steps already done are repeated |
| Subprograms and repeats | If interrupted inside a program section repeat or subprogram, re-enter at the interruption point with BLOCK SCAN |
| Start | The control resets all data at the start, as when selecting the program. You can switch between Single Block and Full Sequence during the scan |
| Touch probe cycles | BLOCK SCAN skips probing cycles, so their result parameters may be empty or wrong; use multi-level startup if later machining uses them |
How do you start inside a subprogram called from the main program? (multi-level)
| Step | What to do | What you see |
|---|---|---|
| 1 | Press BLOCK SCAN, enter the block of the subprogram call in the main program, press NC Start | The control calculates up to that block |
| 2 | Press NC Start as needed to restore machine status and position, and to run the block | The control jumps into the subprogram |
| 3 | Press CONTINUE BLOCK SCAN and enter the start-up block in the subprogram | – |
| 4 | If required, NC Start for machine status and position | – |
| 5 | NC Start | The control continues the subprogram |
How do you return to the contour?
The RESTORE POSITION function moves the tool back to the workpiece contour after the axes were moved during an interruption that was not done with INTERNAL STOP, or after a block scan.

| Step | What to do | What you see |
|---|---|---|
| 1 | Press the RESTORE POSITION soft key | – |
| 2 | Restore the machine status if required | – |
| 3 | To approach in the sequence shown by the control, press NC Start | The axes move in sequence |
| 4 | To approach in your own sequence: SELECT AXIS, first axis soft key, NC Start; second axis, NC Start; repeat for all axes | The axes move in your sequence |
Note: If the tool is below the starting point in the tool axis, the control offers the tool axis as the first traverse direction. When you choose the sequence yourself, consider the current tool position and the workpiece.
How do you free the tool after a power failure? (Retraction)
The Retraction operating mode lets you disengage the tool after a power interruption, a missing relay control voltage or when reference points must be traversed. The machine tool builder must configure and enable it. Traverse modes are Machine axes, Tilted system, Tool axis and Thread.

| Step | What to do | What you see |
|---|---|---|
| 1 | Switch on the power for control and machine | The control starts (may take several minutes) and shows Power interrupted in the header |
| 2 | Press the RETRACT soft key | The message Retraction selected appears |
| 3 | Confirm the power interruption with CE | The control compiles the PLC program |
| 4 | Switch on the machine control voltage | For non-referenced axes, compare the displayed and actual positions and confirm |
| 5 | Check the preselected traverse mode and parameters (e.g. THREAD, thread pitch, direction of rotation) | – |
| 6 | Press the RETRACT soft key | Retraction is active |
| 7 | Retract the tool with the axis direction keys or the handwheel (Z+ out of the workpiece) | – |
| 8 | Press END RETRACTION; if the tool was retracted correctly, press YES | Retraction mode ends |
| 9 | If required, cross the reference points and reset the tilted working plane | The machine is ready |
Danger to tool and workpiece: For non-referenced axes the control uses the last saved axis values, which can differ from the real position, and traverse range monitoring is not available. If the tool is still engaged, use a low feed rate.

How do you skip marked blocks and stop at M1?
| Function | Soft key ON | Soft key OFF |
|---|---|---|
| Block skip (blocks marked with /) | Blocks with / are not run or tested | Blocks with / are run |
| Optional stop (M1) | The program stops at blocks with M1 | No stop at M1 |
Block skip does not work for TOOL DEF blocks; after a power interruption the last setting is restored. The behavior of M1 depends on the machine.
Frequently asked questions
How do you resume an interrupted program on a Heidenhain?
If the program was stopped with NC Stop, press NC Start. After INTERNAL STOP, an emergency stop or a power failure, use the BLOCK SCAN soft key in Program Run, enter the start-up block and continue with NC Start.
Can I jump to a line with GOTO and start from there?
The manual does not recommend it: with GOTO and a block number neither the control nor the PLC ensures a safe entry. Use BLOCK SCAN for a safe entry.
What is the difference between NC Stop and INTERNAL STOP?
NC Stop halts the program; you continue with NC Start and cannot change the operating mode. INTERNAL STOP aborts the program; the operating mode can be changed, but re-entry needs the program start or BLOCK SCAN.
What happens if I re-enter a program interrupted inside a cycle?
Mid-program startup is always executed at the start of the cycle. If the program was interrupted during a cycle, the machining steps already done are repeated.
The power failed with the tool inside the workpiece. What should I do?
Switch on the machine and select the Retraction mode with the RETRACT soft key. Check the traverse mode and free the tool slowly with the axis keys or handwheel. This function depends on the machine tool builder enabling it.
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 (this page)
- 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
Safety warning and disclaimer
When entering a program mid-way and returning to the contour, run the machine in single block with a low feed override, watch the remaining path and keep your hand near the NC Stop key. BLOCK SCAN, Retraction and M1 behavior 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.
