Subprograms and program-section repeats

Programming techniques are useful in structuring your NC program and avoiding unnecessary repeats. By using subprograms, you need to define machining positions for multiple tools only once, for example. Program-section repeats, on the other hand, help you avoid multiple programming of identical, successive NC blocks or program sequences. By combining and nesting these two programming techniques, you can keep your NC programs rather short and restrict changes to a few central program locations.

Subprograms and program section repeats with the label LBL

Defining labels

With the G98 NC function, you define a new label in the NC program.

Each label must be unambiguously identifiable in the NC program by its number or name. If a number or a name exists twice in an NC program, the control shows a warning before the NC block.

If you define a label after M30 or M2, it corresponds to a subprogram. Subprograms must always be concluded with a G98 L0. This number is the only one which may exist any number of times in the NC program.

N110 G98 L1

; Start of subprogram defined by a number

N120 G00 Z+100

, Retract at rapid traverse

N130 G98 L0

; End of subprogram

N110 G98 L "UP"

; Start of subprogram defined by a name

G98 L corresponds to the LBL Klartext syntax.

Defining a label with LBL SET

Calling a subprogram

With the L NC function, you call a subprogram programmed after M30 or M2.

When the control reads the L NC function, it will jump to the defined label and continue execution of the NC program from this NC block. When the control reads G98 L0, it will jump back to the next NC block after the call with L.

N110 L1

; Call subprogram

L without G98 corresponds to the CALL LBL Klartext syntax.

Calling a label with CALL LBL

 
Tip

In order to define a certain number of desired repetitions (e.g., L1.3), program a program-section repeat.

Program-section repeat

Program-section repeat

Program-section repeats allow you to have a particular program section executed any number of times. The program section must start with a G98 L label definition and end with L. With the numeral after the decimal point, you can define optionally how often you want the control to repeat this program section.

N110 L1.2

; Call label 1 twice

L without 98 and the numeral after the decimal point correspond to the CALL LBL REP Klartext syntax.

Program-section repeats