beautypg.com

2 subprograms – HEIDENHAIN TNC 426B (280 472) ISO programming User Manual

Page 258

background image

9 Programming: Subprograms and Program Section Repeats

242

9.1 Mar

king Subpr

ogr

ams and Pr

ogr

am Section Repeats;

9.2 Subprograms

9.1 Marking Subprograms and

Program Section Repeats

Subprograms and program section repeats enable you to program a
machining sequence once and then run it as often as desired.

Labels
The beginnings of subprograms and program section repeats are
marked in a part program by G98 labels.

A label is identified by a number between 1 and 254. Each label can
be set only once with G98 in a program.

If a label is set more than once, the TNC sends an error
message at the end of the G98 block.

For the TNC 426, TNC 430:

With very long programs, you can limit the number of
blocks to be checked for repeated labels with MP7229.

Label 0 (G98 L0) is used exclusively to mark the end of a
subprogram and can therefore be used as often as desired.

9.2 Subprograms

Operating sequence
1
The TNC executes the part program up to the block in which a

subprogram is called with Ln.0. n can be any label number

2 The subprogram is then executed from beginning to end. The

subprogram end is marked with G98 L0.

3 The TNC then resumes the part program from the block after the

subprogram call Ln.0.

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.

% ...

L1,0

G00 Z+100 M2
G98 L1 *

G98 L0 *
N99999 % ...

Lkap9.pm6

29.06.2006, 08:07

242