Subprograms and program section repeats with the label LBL

Application

Subprograms and program section repeats enable you to program a machining sequence once and then run it as often as necessary. Use subprograms to insert contours or complete machining steps after the end of the program and call them in the NC program. Program section repeats repeat single or several NC blocks during the NC program. Subprograms and program section repeats can also be combined.

Subprograms and program section repeats are programmed with the NC function LBL.

Description of function

The label LBL is used for defining the machining steps for subprograms and program section repeats.

The control offers the following keys and icons in connection with labels:

Key or icon

Function

Create LBL

Call LBL: Jump to the label in the NC program

In case of LBL number: Enter the next free number automatically

Defining a label with LBL SET

The LBL SET function defines 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.

LBL 0 marks the end of a subprogram. This number is the only one which may exist more than once in the NC program.

Input

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

11 LBL "Reset"

; Subprogram for resetting a coordinate transformation

12 TRANS DATUM RESET

13 LBL 0

To navigate to this function:

Insert NC function All functions Label LBL SET

The NC function includes the following syntax elements:

Syntax element

Meaning

LBL

Syntax initiator for a label

Number or Name

Number or name of the label

Number, text, or variable

Input: 0...65535 or text width 32

Use an icon to enter the next free number automatically.

Description of function

Calling a label with CALL LBL

The CALL LBL function calls a label in the NC program.

When the control reads CALL LBL, it jumps to the defined label and continues executing the NC program from this NC block. When the control reads LBL 0, it jumps back to the next NC block after CALL LBL.

In case of program section repeats, you can optionally define that the control executes that jump several times.

Input

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

Change the following contents as needed:

  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions (e.g., with M91)
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

11 CALL LBL 1 REP2

; Call label 1 twice

To navigate to this function:

Insert NC function All functions Label CALL LBL

The NC function includes the following syntax elements:

Syntax element

Meaning

CALL LBL

Syntax initiator for calling a label

Number, Name or Parameter

Number or name of the label

Number, text, or variable

Input: 1...65535 or text width 32 or 0...1999

The label can be selected from a selection menu that displays all labels available in the NC program.

REP

Number of repetitions until the control executes the next NC block

Optional syntax element

Subprograms

A subprogram allows calling parts of an NC program any number of times at different points of the NC program (e.g., machining positions or a contour).

A subprogram starts with a LBL label and ends with LBL 0. CALL LBL calls the subprogram from any point in the NC program. In this process, repetitions must not be defined with REP.

The control executes the NC program as follows:

  1. The control executes the NC program up to the CALL LBL function.
  2. The control jumps to the beginning of the defined subprogram LBL.
  3. The control executes the subprogram up to the subprogram end LBL 0.
  4. After that, the control jumps to the next NC block after CALL LBL and continues executing the NC program.

The following conditions apply to subprograms:

  • A subprogram cannot call itself
  • CALL LBL 0 is not permitted (Label 0 is only used to mark the end of a subprogram).
  • Write subprograms after the NC block with M2 or M30
  • If subprograms are located in the NC program before the NC block with M2 or M30, they will be executed at least once even if they are not called

The control displays information about the active subprogram on the LBL tab of the Status workspace.

The LBL tab

Program-section repeats

A program section repeat allows repeating a part of an NC program any number of times (e.g., contour machining with incremental infeed).

A program section repeat starts with a LBL label and ends after the last programmed repetition REP of the label call CALL LBL.

The control executes the NC program as follows:

  1. The control executes the NC program up to the CALL LBL function.
  2. In this process, the control already executes the program section once because the program section to be repeated is positioned ahead of the CALL LBL function.

  3. The control jumps to the beginning of the program section repeat LBL.
  4. The control repeats the program section as many times as programmed under REP.
  5. After that, the control continues executing the NC program.

The following conditions apply to program section repeats:

  • Program the program section repeat before the end of the program with M30 or M2.
  • No LBL 0 can be defined with a program section repeat.
  • The total number of times the program section is executed is always one more than the programmed number of repeats, because the first repeat starts after the first machining process.

The control displays information about the active program section repeat on the LBL tab of the Status workspace.

The LBL tab

Notes

  • The control displays the NC function LBL SET in the structure by default.
  • The Structure column in the Program workspace

  • You can repeat a program section up to 65 534 times in succession
  • The following characters are allowed in the name of a label: # $ % & , - _ . 0 1 2 3 4 5 6 7 8 9 @ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  • The following characters are not allowed in the name of a label: <blank> ! " ‘ ( ) * + : ; < = > ? [ / ] ^ ` { | } ~