beautypg.com

2 subprograms, Operating sequence, Programming notes – HEIDENHAIN TNC 406 User Manual

Page 196: Programming a subprogram, Calling a subprogram, 2 subpr ogr ams 9.2 subprograms

background image

HEIDENHAIN TNC 406, TNC 416

175

9.2 Subpr

ogr

ams

9.2 Subprograms

Operating sequence

1

The TNC executes the part program up to the block in which a
subprogram is called with CALL LBL.

2

The subprogram is then executed from beginning to end. The
subprogram end is marked LBL 0.

3

The TNC then resumes the part program from the block after the
subprogram call.

Programming notes

„

A main program can contain up to 254 subprograms.

„

You can call subprograms in any sequence and as often as desired.

„

A subprogram cannot call itself.

„

Write subprograms at the end of the main program (behind the block
with M2 or M30).

„

If subprograms are located before the block with M02 or M30, they
will be executed at least once even if they are not called.

Programming a subprogram

8

To mark the beginning, press the LBL SET key and

enter a label number.

8

Enter the subprogram number.

8

To mark the end, press the LBL SET key and enter the

label number ”0”.

Calling a subprogram

8

To call a subprogram, press the LBL CALL key.

8

Label number:

Enter the label number of the

subprogram you wish to call.

8

Repeat REP:

Ignore the dialog question with the NO

ENT key. Repeat REP is used only for program section
repeats.

0 BEGIN PGM ...

CALL LBL1

L Z+100 M2
LBL1

LBL0
END PGM ...

CALL LBL 0 is not permitted (label 0 is only used to mark
the end of a subprogram).

This manual is related to the following products: