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:
@Pxx | 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 |
@S | Main spindle in the cycle |
The cycle call must be programmed in its own 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.
Syntax: |
L | LL CYCLE [ NAME=<cycle> [MODAL_MOVE / MODAL_BLOCK] @P1=.. @P200=.. { \ } ] |
NAME=<cycle> | Name of cycle (file name) |
MODAL_MOVE (MODAL, old syntax) | Modal cycle call. The cycle is again executed implicitly after every further NC block in the main program containing motion commands. |
MODAL_BLOCK | Modal cycle call. The cycle is again executed implicitly after every further NC block in the main program. |
| The following NC commands suppress the implicit block-modal cycle call: |
|
|
| |
| |
| The model effect of MODAL_MOVE / _BLOCK is deselected at program level ((M2, M30, M17; M29) or by #DISABLE MODAL CYCLE. |
@Pxx=.. | List of transfer parameters. A maximum of 200 @Pxx parameters of type REAL or STRING (as of V3.3079.25) 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 |
Transfer parameters - @P parameter
- Inside the brackets, no order is required to specify the key words and supply parameters. When programming, users only need to know which @P parameter must be assigned for the cycle.
- @P parameters that are not needed can be omitted.
- With read access to a @P parameter that was not transferred to the cycle, it is implicitly created (default) and initialised with 0 (zero). This then increases the memory requirement. The user can switch off this behaviour using P-CHAN-00463 as of CNC Build V3.1.3079.20. When a read access is executed to @P parameters that are not transferred, the error ID 20394 is output.
In CNC Builds up to V3.1.3079.19, non-programmed @P parameters are initialised with 0 (zero) on read access. - The variable V.G.@P[i].VALID determines whether a @P parameter is used or is valid in the cycle.
- The functions IS_STRING and IS_NUMBER can be used to check whether @P parameters in the cycle are a string or a number, see Example 4. (as of V3.3079.25)
- In CNC Builds up to V3.1.3079.19, the transfer parameters are retained until the programmed call of another cycle (L CYCLE.. or G80..). As of CNC Build V3.1.3079.20, the transfer parameters are deleted when the cycle is closed (M17 or M29).
- @P 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.
Attention
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.
Notice
Depending on the version, the processing lines of the cycle are masked or visible in the default setting in the running NC program or in single-block mode during the execution of a cycle in the display. When the display is off, only the cycle call is displayed during this time.
This feature is switchable by the channel parameter P-CHAN-00211.
Definitions required before cycle call:
- Modal G functions, circle geometry data and the currently active feedrate (F word) active before cycle call are retained beyond the cycle. This feature is switchable by the channel parameter P-CHAN-00210.
- Modal G functions that are programmed in combination with axis names (e.g. G92, G98, G99, G100, G112, G130, etc.) are not restored if they were programmed in the cycle itself.
- The machining plane (G17, G18, G19) should be defined in the higher-level NC program before cycle call. The axis perpendicular to this plane in drilling cycles is the axis in which the drilling operation is executed and in milling cycles it is the feed axis for depth.
- Any tool geometry compensation (e.g. length compensation) must also be selected before the cycle is invoked.
- The values required for feedrate, spindle speed and spindle rotation direction must be defined in the higher-level NC program, unless there are corresponding transfer parameters in the cycle.
- Spindle commands programmed in the cycles always refer to the active main spindle of the NC channel. Make sure that this main spindle is defined before cycle call.
- The start position for a corresponding drilling or milling operation and the tool's orientation must always be approached before the cycle is invoked in the higher-level NC program.
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.
Syntax: |
#DISABLE MODAL CYCLE |
Available cycles:
The following cycles are available:
Programing Example
Available cycles
The example below of a cycle call for drilling (drill.cyc) presents various parameter assignment parameter.
The drill.cyc drilling cycle requires the following transfer parameters:
@P1 | Position of the retraction plane (absolute) |
@P2 | Position of the machining plane (absolute) |
@P3 | Safety distance (unsigned) |
@P4 | Final drilling depth (absolute) or |
@P5 | Final drilling depth relative to the machining plane (unsigned) |
Cycle call with constant values:
..
Nxx L CYCLE [NAME=drilling.cyc @P1=110 @P2=100 @P3=4 @P4=40]
..
or by specifying a relative drilling depth @P5:
..
Nxx L CYCLE [NAME=drilling.cyc @P1=110 @P2=100 @P3=4 @P5=60]
..
Cycle call with variables:
Variables must be defined and assigned values before cycle call.
..
#VAR
V.L.RPL = 110
V.L.WPL = 100
V.L.SDST = 4
V.L.DEP = 50
#ENDVAR
Nxx L CYCLE [NAME=drilling.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=drilling.cyc @P1= P10 @P2=P11 @P3=P15 @P4=P17]
..
Cycle call with mathematical expressions:
..
Nxx P20 = 100
Nxx L CYCLE [NAME=drilling.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=drilling.cyc @P2=100 @P3=4 @P1=110]
..
Cycle call with constant values; cycle should have a modal effect:
..
Nxx L CYCLE [NAME=drilling.cyc @P1=110 @P2=100 @P3=4 @P4=40 MODAL_MOVE]
..
[Example:]
%drill_main
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=drilling.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)
#DISABLE MODAL CYCLE
N80 X0 Y0 M5
N100 M30
Notice
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)
Example 4: Check @P parameter
Transferred @P parameters can be checked by the functions IS_STRING and IS_NUMBER.
%L cycle
( Check variables)
$IF IS_STRING[@P1] == TRUE
#MSG["Text: %s",@P1]
$ELSE
#MSG["Error no String"]
$ENDIF
$IF IS_NUMBER[@P2] == TRUE
#MSG["Number: %f",@P2]
$ELSE
#MSG["Error not a number"]
$ENDIF
M17
% Main
LL CYCLE [NAME=cycle @P1 ="String1" @P2=12.34]
M30