Cycles as global or local subroutines (Call L | LL CYCLE)

Cycles are available in the NC kernel in the form of global or local subroutines and permit special machining operations such as deep hole drilling or pocket milling. The machining task defined in the cycle is described in general form. When the cycle is invoked, the data is supplied when the transfer parameters are assigned.

A cycle is programmed independently of the currently valid plane (G17, G18, G19) and independently of the axis names configured in the NC channel. Only the direction from which machining should be executed in the current plane must be specified at cycle call. In the cycle, access can be made to an encapsulated group of parameters of its own. They are assigned values at cycle call.

A special syntax characterised by the "@" character is available for this purpose. This character is used in cycle programming in combination with:


Transfer parameter in the cycle call and the cycle

@X, @Y, @Z

Main axes in the cycle

@I, @J, @K

Centre point coordinates in the cycle


Main spindle in the cycle

The cycle call must be programmed in a separate NC block without any further NC commands. The syntax consists of a global or local subroutine call with additional specification of cycle-dependent transfer parameters.

L | LL CYCLE [ NAME=<cycle> [MODAL_MOVE / _BLOCK] @P1=<expr> ... @P50=<expr> { \ } ]


Name of cycle (file name)


(MODAL, old syntax)

Modal cycle call. After every NC block in the main program that contains motion commands, the cycle is implicitly executed again.


Modal cycle call. The cycle is again executed implicitly after every further NC block in the main program.


With the following NC commands, the implicit block-modal cycle call is suppressed:


  • Blank lines, comment lines
  • Subroutine calls (L, LL, M6, G8xx).
  • $ commands ($GOTO, $IF, $FOR etc...)
  • Program end M functions (M2, M30, M17, M29)





The modal effect of MODAL_MOVE / _BLOCK is deselected by the NC command #DISABLE MODAL CYCLE.


List of transfer parameters.

... @P50<expr>

A maximum of 50 @Pxx parameters of REAL type can be transferred. Write and read accesses are only allowed within a cycle. The @Pxx parameters can be assigned direct values, any variables, P parameters and mathematical expressions.


Separator ("Backslash") for programming the command over multiple lines

In the brackets there is no particular sequence for specifying keywords and transfer parameters. When programming, users only need to know which @Pxx parameters must be assigned for the cycle.

Parameters that are not needed can be omitted. When called, @Pxx parameters that are not programmed are initialised with 0 (zero). The variable V.G.@P[i].VALID determines whether a parameter is programmed (valid) in the cycle. Transfer parameters are retained until the programmed call of another cycle.

Transfer parameters that are programmed in the cycle call but are not used in the cycle itself are ignored.

The variable V.G.CYCLE_ACTIVE determines whether the current subroutine or the current program level is a cycle.



A cycle is a self-contained NC program unit with a defined machining task. It is advisable to avoid nested calls of cycles because there is a danger of assigning transfer parameters several times.



Depending on the version, the processing lines of the cycle in the default setting are masked or visible in the display during a running NC program or in single block mode when a cycle is executed. When active display is off, only the cycle call is displayed during this time.

This feature is switchable by the channel parameter P-CHAN-00211.



In TwinCat systems, all cycle lines are visible in the display by default.

Definitions required before cycle call:

Deselecting a modal cycle

A modal acting cycle (keyword MODAL_MOVE or MODAL_BLOCK in the cycle call) is deselected with the following NC command. The command must be programmed on its own in the NC block.


Available cycles:

Parameterisable cycles are available for various machining tasks (e.g. drilling, tapping, pocket milling, grooving etc.). For more information on programming and use, see the functional description "Cycles (C21)" (@@[FCT-C21]).

Programing Example


Available cycles

The various parameter assignment options are presented in the example below of a cycle call for drilling (drill.cyc).

The drill.cyc drilling cycle requires the following transfer parameters:


Position of the return plane (absolute)


Position of the machining plane (absolute)


Safety distance (unsigned)


Final drilling depth (absolute) or


Final drilling depth relative to the machining plane (unsigned)

Cycle call with constant values:


Nxx L CYCLE [NAME=drill.cyc @P1=110 @P2=100 @P3=4 @P4=40]


or by specifying a relative drilling depth @P5:


Nxx L CYCLE [NAME=drill.cyc @P1=110 @P2=100 @P3=4 @P5=60]


Cycle call with variables:

Variables must be defined and assigned values before cycle call.



V.L.RPL = 110

V.L.WPL = 100

V.L.SDST = 4

V.L.DEP = 50


Nxx L CYCLE [NAME=drill.cyc @P1= V.L.RPL @P2=V.L.WPL @P3=V.L.SDST @P4=V.P.DEP]


Cycle call with P parameters:

The parameters must be defined and assigned values before cycle call.


Nxx P10 = 110

Nxx P11 = 100

Nxx P15 = 4

Nxx P17 = 50

Nxx L CYCLE [NAME=drill.cyc @P1= P10 @P2=P11 @P3=P15 @P4=P17]


Cycle call with mathematic expressions:


Nxx P20 = 100

Nxx L CYCLE [NAME=drill.cyc @P1= 10+P20 @P2=2*50 @P3=5-1 @P4=P20/2]


Cycle call with constant; any sequence of parameters in brackets:


Nxx L CYCLE [@P4=40 NAME=drill.cyc @P2=100 @P3=4 @P1= 110]


Cycle call with constant values; cycle should have a modal effect:


Nxx L CYCLE [NAME=drill.cyc @P1=110 @P2=100 @P3=4 @P4=40 MODAL_MOVE]




N05 T1 D1

N10 M06

N15 G53 G17 G90 M3 S300 F200 S300

N16 G0 X0 Y0 Z0

N20 Z110

N30 X40 Y40 (drill position 1)

N40 L CYCLE [NAME=drill.cyc @P1=110 @P2=100 @P3=2 @P4=55 MODAL_MOVE]

N50 X60 Y60 (drill position 2 and implicit cycle call because it is modal)

N60 X100 Y60 (drill position 3 and implicit cycle call because it is modal)

N70 X100 Y20 (drill position 4 and implicit cycle call because it is modal)


N80 X0 Y0 M5

N100 M30



Notes on creating cycles

As far as possible, cycles must be programmed as generally valid and independently of the axis names currently used in the NC channel and the definition of planes. For this purpose, the cycle has the option of using plane-independent "neutral axis names " @X, @Y and @Z for the first three main axes. Meanings:

@X  always the first main axis

@Y  always the second main axis

@Z  always the third main axis

Example 1: axes in the cycle

Nxx G91 @X=@P1 @Y=@P2 @Z=@P3 F1000 G01

By analogy, so-called "neutral centre point coordinates" are available for programming circles. Meanings:

@I always the centre point coordinate in the first main axis

@J always the centre point coordinate in the second main axis

@K  always the centre point coordinate in the second main axis

Example 2: circle in the cycle

Nxx G91 G02 @X=@P1 @Y=@P2 @I=@P4 @J=@P5 F1000

To remain independent from the spindle name configured during spindle programming, the main spindle can always be addressed in the cycle by the neutral spindle name @S.

@S  always the main spindle

Example 3: spindle in the cycle

Nxx @S=1000 M3 (main spindle cw at 1000 rpm)