SINUMERIK 840D sl NC programming. Programming Manual (2020) - page 6

 

  Index      Manuals     SINUMERIK 840D sl NC programming. Programming Manual (2020)

 

Search            copyright infringement  

 

   

 

   

 

Content      ..     4      5      6      7     ..

 

 

 

SINUMERIK 840D sl NC programming. Programming Manual (2020) - page 6

 

 

Fundamentals
2.14 Supplementary commands
Example
Using the working area
;%
3URWHFWLRQ DUHD
limitation G25/26, the working area of a
lathe is limited so that the surrounding
:RUNLQJ DUHD
devices and equipment - such as revolver,
;
measuring station, etc. are protected
against damage.
Default setting: WALIMON
0
:
=%
;
Program code
Comment
N10 G0 G90 F0.5 T1
N20 G25 X-80 Z30
; Define the lower limit for the individual coordinate
axes
N30 G26 X80 Z330
;Define the upper limit
N40 L22
;Cutting program
N50 G0 G90 Z102 T2
;To tool change location
N60 X0
N70 WALIMOF
;Deactivate working area limitation
N80 G1 Z-2 F0.5
;Drill
N90 G0 Z200
;Back
N100 WALIMON
; Switch on working area limitation
N110 X70 M30
; End of program
Further information
Reference point at the tool
When tool length offset is active, the tip of the tool is monitored as reference point, otherwise
it is the toolholder reference point.
Taking into consideration the tool radius must be activated separately. This is done using
channel-specific machine data:
MD21020 $MC_WORKAREA_WITH_TOOL_RADIUS
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
353
Fundamentals
2.14 Supplementary commands
If the tool reference point lies outside the working area defined by the working area limitation,
or if this area is exited, then the program sequence is stopped.
Note
If transformations are active, the tool data taken into consideration (tool length and tool radius)
can deviate from the described behavior.
Programmable working area limitation, G25/G26
An upper (G26) and a lower (G25) working area limitation can be defined for each axis. These
values are effective immediately and remain effective for the corresponding MD setting (→
MD10710 $MN_PROG_SD_RESET_SAVE_TAB) after RESET and after being powered-up again.
Note
Using the predefined CALCPOSI (Page 582) tag function, it can be checked as to whether the
predicted path is moved through taking into account the working area limits and/or the
protection areas.
2.14.3.2
Working area limitation in WCS/SZS (WALCS0 ... WALCS10)
The "working area limitation in WCS/SZS" enables a flexible workpiece-specific limitation of the
traversing range of the channel axes in the workpiece coordinate system (WCS) or settable zero
system (SZS). It is intended mainly for use in conventional lathes.
Requirement
The channel axes must be homed.
Working area limitation group
In order that the axis-specific working area limits do not have to be rewritten for all channel axes
when switching axis assignments, e.g. when switching transformations or the active frame on/
off, working area limitation groups are available.
A working area limitation group comprises the following data:
• Working area limits for all channel axes
• Reference system of the working area limitation
Syntax
$P_WORKAREA_CS_COORD_SYSTEM[<WALimNo>]=<Value>
$P_WORKAREA_CS_PLUS_ENABLE[<WALimNo>,<Ax>]=<Value>
$P_WORKAREA_CS_LIMIT_PLUS[<WALimNo>,<Ax>]=<Value>
$P_WORKAREA_CS_MINUS_ENABLE[<WALimNo>,<Ax>]=<Value>
$P_WORKAREA_CS_LIMIT_MINUS[<WALimNo>,<Ax>]=<Value>
NC programming
354
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
WALCS<n>
WALCS0
Meaning
$P_WORKAREA_CS_COORD_SYSTEM[<WALimNo>]=<Value>
The coordinate system to which the working area limitation group refers
<WALimNo>:
Working area limitation group
Type:
INT
Range of values:
0 (group 1) ... 9 (group 10)
<Value>:
Value of the type INT
1
Workpiece coordinate system (WCS)
3
Settable zero system (SZS)
$$P_WORKAREA_CS_PLUS_ENABLE[<WALimNo>,<Ax>]=<Value>
Enable the working area limitation in the positive axis direction for the specified channel axis
<WALimNo>:
Working area limitation group
Type:
INT
Range of values:
0 (group 1) ... 9 (group 10)
<Ax>:
Channel axis name
<Value>:
Value of the type BOOL
0 (FALSE)
No release
1 (TRUE)
Release
$P_WORKAREA_CS_MINUS_ENABLE[<WALimNo>,<Ax>]=<Value>
Enable the working area limitation in the negative axis direction for the specified channel axis
<WALimNo>:
Working area limitation group
Type:
INT
Range of values:
0 (group 1) ... 9 (group 10)
<Ax>:
Channel axis name
<Value>:
Value of the type BOOL
0 (FALSE)
This has not been released
1 (TRUE)
Enable
$P_WORKAREA_CS_LIMIT_PLUS[<WALimNo>,<Ax>]=<Value>
Working area limitation in the positive direction of the specified channel axis
<WALimNo>:
Working area limitation group
Type:
INT
Range of values:
0 (group 1) ... 9 (group 10)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
355
Fundamentals
2.14 Supplementary commands
<Ax>:
Channel axis name
<Value>:
Value of the type REAL
$P_WORKAREA_CS_LIMIT_MINUS[<WALimNo>,<Ax>]=<Value>
Working area limitation in the negative direction of the specified channel axis
<WALimNo>:
Working area limitation group
Type:
INT
Range of val-
0 (group 1) ... 9 (group 10)
ues:
<Ax>:
Channel axis name
<Value>:
Value of the type REAL
WALCS<n>:
Activation of the working area limitations of a working area limitation group
<n>:
Number of the working area limitation group
Range of val-
1 ... 10
ues:
WALCS0:
Deactivation of the working area limits active in the channel
Note
The actual available number of working area limitation groups depends on the configuration (→
see details of the machine manufacturer).
Example
Three axes are defined in the channel: X, Y and Z
A working area limitation group No. 2 is to be defined and then activated in which the axes are
to be limited in the WCS according to the following specifications:
• X axis in the plus direction: 10 mm
• X axis in the minus direction: No limitation
• Y axis in the plus direction: 34 mm
• Y axis in the minus direction: -25 mm
• Z axis in the plus direction: No limitation
• Z axis in the minus direction: -600 mm
Program code
Comment
NC programming
356
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
Program code
Comment
N51 $P_WORKAREA_CS_COORD_SYSTEM[1]=1
; The working area limitation of
working area limitation group 2
applies in the WCS.
N60 $P_WORKAREA_CS_PLUS_ENABLE[1,X]=TRUE
N61 $P_WORKAREA_CS_LIMIT_PLUS[1,X]=10
N62 $P_WORKAREA_CS_MINUS_ENABLE[1,X]=FALSE
N70 $P_WORKAREA_CS_PLUS_ENABLE[1,Y]=TRUE
N73 $P_WORKAREA_CS_LIMIT_PLUS[1,Y]=34
N72 $P_WORKAREA_CS_MINUS_ENABLE[1,Y]=TRUE
N73 $P_WORKAREA_CS_LIMIT_MINUS[1,Y]=-25
N80 $P_WORKAREA_CS_PLUS_ENABLE[1,Z]=FALSE
N82 $P_WORKAREA_CS_MINUS_ENABLE[1,Z]=TRUE
N83 $P_WORKAREA_CS_LIMIT_PLUS[1,Z]=-600
N90 WALCS2
; Activate working area limita-
tion group 2.
Further information
Effectivity
The working area limitation with WALCS1 - WALCS10 acts independently of the working area
limitation with WALIMON. If both functions are active, that limit becomes effective which the axis
motion first reaches.
Reference point at the tool
Taking into account the tool data (tool length and tool radius) and therefore the reference point
at the tool when monitoring the working area limitation corresponds to the behavior for the
working area limitation with WALIMON.
2.14.4
Reference point approach (G74)
When the machine has been powered up (where incremental position measuring systems are
used), all of the axis slides must approach their reference mark. Only then can traversing
movements be programmed.
The reference point can be approached in the NC program with G74.
Syntax
G74 X1=0 Y1=0 Z1=0 A1=0 … ; Programmed in a separate NC block
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
357
Fundamentals
2.14 Supplementary commands
Meaning
G74:
G command call reference point approach
X1=0 Y1=0 Z1=0 … :
The specified machine axis address X1, Y1, Z1 … for linear axes is ap-
proached as the reference point.
A1=0 B1=0 C1=0 … :
The specified machine axis address A1, B1, C1 … for rotary axes is ap-
proached as the reference point.
Note
A transformation must not be programmed for an axis which is to approach the reference point
with G74.
The transformation is deactivated with command TRAFOOF.
Example
When the measuring system is changed, the reference point is approached and the workpiece
zero point is set up.
Program code
Comment
N10 SPOS=0
;Spindle in position control
N20 G74 X1=0 Y1=0 Z1=0 C1=0
;Reference point approach for linear axes and
rotary axes
N30 G54
; Zero offset
N40 L47
;Cutting program
N50 M30
; End of program
2.14.5
Approaching a fixed point (G75)
The non-modal command G75 can be used to move axes individually and independently of one
another to fixed points in the machine space, e.g. to tool change points, loading points, pallet
change points, etc.
The fixed points are positions in the machine coordinate system which are stored in the machine
data (MD30600 $MA_FIX_POINT_POS[n]). A maximum of four fixed points can be defined for
each axis.
The fixed points can be approached from every NC program irrespective of the current tool or
workpiece positions. An internal preprocessing stop is executed prior to moving the axes.
NC programming
358
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
;
)L[HG SRLQW
=
Requirements
The following requirements must be satisfied to approach fixed points with G75:
• The fixed-point coordinates must have been calculated exactly and written to machine data.
• The fixed points must be located within the valid traversing range (→ note the software limit
switch limits!)
• The axes to be traversed must be referenced.
• No tool radius compensation must be active.
• A kinematic transformation may not be active.
• None of the axes to be traversed must be involved in active transformation.
• None of the axes to be traversed must be a following axis in an active coupling.
• None of the axes to be traversed must be an axis in a gantry grouping.
• Compile cycles must not activate motion components.
Syntax
G75 <axis name><axis position> ... FP=<n>
Meaning
G75:
Fixed point approach
<axis name>:
Name of the machine axis to be traversed to the fixed point
All axis identifiers are permitted.
<axis position>:
The position value has no significance. A value of "0" is, therefore, usually
specified.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
359
Fundamentals
2.14 Supplementary commands
FP=:
Fixed point that is to be approached
<n>:
Fixed point number
Range of values:
1, 2, 3, 4
Note:
In the absence of FP=<n> or a fixed point number, or if FP=0 has been
programmed, this is interpreted as FP=1 and fixed point 1 is approached.
Note
Multiple axes can be programmed in one G75 block. The axes are then traversed simultaneously
to the specified fixed point.
Note
The value of the address FP must not be greater than the number of fixed points specified for
each programmed axis (MD30610 $MA_NUM_FIX_POINT_POS).
Example
For a tool change, axes X (= AX1) and Z (= AX3) need to move to the fixed machine axis position
1 where X = 151.6 and Z = -17.3.
Machine data:
• MD30600 $MA_FIX_POINT_POS[AX1,0] = 151.6
• MD30600 $MA_FIX_POINT[AX3,0] = 17.3
NC program:
Program code
Comment
…
N100 G55
; Activate settable zero offset.
N110 X10 Y30 Z40
; Approach positions in the WCS.
N120 G75 X0 Z0 FP=1 M0
; The X axis moves to 151.6
; and the Z axis moves to 17.3 (in the MCS).
; Each axis travels at its maximum velocity.
; No additional movements are permitted to be active in
this block.
; A stop is inserted here so that after reaching
; the end positions,
; no additional motion takes place.
N130 X10 Y30 Z40
; The position of N110 is approached again.
; The zero offset is reactivated.
…
NC programming
360
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
Note
If the "Tool management with magazines" function is active, the auxiliary function T… or M...
(typically M6) will not be sufficient to trigger a block change inhibit at the end of G75 motion.
Reason: If "Tool management with magazines" is active, auxiliary functions for tool change are
not output to the PLC.
Further information
G75
The axes are traversed as machine axes in rapid traverse. The motion is mapped internally using
the "SUPA" (suppress all frames) and "G0 RTLIOF" (rapid traverse motion with single-axis
interpolation) functions.
If the conditions for "RTLIOF" (single-axis interpolation) are not met, the fixed point is
approached as a path.
When the fixed point is reached, the axes come to a standstill within the "Exact stop fine"
tolerance window.
Parameterizable dynamic response for G75
The required dynamic response mode can be set via the following machine data for positioning
movements to fixed-point positions (G75):
MD18960 $MN_POS_DYN_MODE (type of positioning axis dynamic response)
Additional axis movements
The following additional axis movements are taken into account at the instant in time at which
the G75 block is interpreted:
• External work offset
• DRF
• Synchronization offset ($AA_OFF)
After this, the additional axis movements are not permitted to change until the end of traversing
is reached by the G75 block.
Additional motion following interpretation of the G75 block will offset the approach to the fixed
point accordingly.
The following additional movements are not taken into account, irrespective of the point at
which interpolation takes place, and will offset the target position accordingly:
• Online tool offset
• Additional movements from compile cycles in the BCS and machine coordinate system
Active frames
All active frames are ignored. Traversing is performed in the machine coordinate system.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
361
Fundamentals
2.14 Supplementary commands
Working area limitation in the workpiece coordinate system/SZS
Coordinate-system-specific working area limitation (WALCS0 ... WALCS10) is not effective in the
block with G75. The destination point is monitored as the starting point of the following block.
Axis/Spindle movements with POSA/SPOSA
If programmed axes/spindles were previously traversed with POSA or SPOSA, these movements
will be completed first before the fixed point is approached.
Spindle functions in the G75 block
If the spindle is excluded from "fixed-point approach", then additional spindle functions (e.g.
positioning with SPOS/SPOSA) can be programmed in the G75 block.
Modulo axes
In the case of modulo axes, the fixed point is approached along the shortest distance.
2.14.6
Travel to fixed stop (FXS, FXST, FXSW)
Function
The "Travel to fixed stop" function can be used to establish defined forces for clamping
workpieces, such as those required for tailstocks, quills and grippers. The function can also be
used for the approach of mechanical reference points.
$FWXDO SRVLWLRQ DIWHU
7UDYHO WR IL[HG VWRS
)L[HG VWRS
PRQLWRULQJ ZLQGRZ
3URJUDPPHG
HQG SRVLWLRQ
6WDUW SRVLWLRQ
With sufficiently reduced torque, it is also possible to perform simple measurement operations
without connecting a probe. The "travel to fixed stop" function can be implemented for axes as
well as for spindles with axis-traversing capability.
Syntax
FXS[<axis>]=…
FXST[<axis>]=…
NC programming
362
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
FXSW[<axis>]=…
FXS[<axis>]=… FXST[<axis>]=…
FXS[<axis>]=… FXST[<axis>]=… FXSW[<axis>]=…
Meaning
FXS:
Command for activation and deactivation of the "Travel to fixed stop" function
FXS[<axis>]=1:
Activate function
FXS=[<axis>]=0:
Deactivate function
FXST:
Optional command for setting the clamping torque
Specified as % of the maximum drive torque
FXSW:
Optional command for setting the window width for the fixed stop monitoring
Specified in mm, inches or degrees
<axis>:
Machine axis name
Machine axes (X1, Y1, Z1, etc.) are programmed
Note
The commands FXS, FXST and FXSW are modal.
The programming of FXST and FXSW is optional: If no parameter is specified, the last
programmed value or the value set in the relevant machine data applies.
Activate travel to fixed stop: FXS[<axis>] = 1
The movement to the destination point can be described as a path or positioning axis
movement. With positioning axes, the function can be performed across block boundaries.
Travel to fixed stop can be performed simultaneously for several axes and parallel to the
movement of other axes. The fixed stop must be located between the start and end positions.
NOTICE
Risk of collision
It is not permissible to program a new position for an axis if the "Travel to fixed stop" function
has already been activated for an axis/spindle.
Spindles must be switched to position-controlled mode before the function is selected.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
363
Fundamentals
2.14 Supplementary commands
Example:
Program code
Comment
X250 Y100 F100 FXS[X1]=1 FXST[X1]=12.3 FXSW[X1]=2
; Axis X1 travels with feedrate
F100 (specification optional)
to target position X=250 mm.
The clamping torque is 12.3% of
the maximum drive torque, moni-
toring is performed in a 2 mm
wide window.
Deactivate travel to fixed stop: FXS[<axis>] = 0
Deselection of the function triggers a preprocessing stop.
The block with FXS[<axis>]=0 may and should contain traversing movements.
NOTICE
Risk of collision
The traversing movement to the retraction position must move away from the fixed stop,
otherwise damage to the stop or to the machine may result.
The block change takes place when the retraction position has been reached. If no retraction
position is specified, the block change takes place immediately after the torque limit has been
deactivated.
Example:
Program code
Comment
X200 Y400 G01 G94 F2000 FXS[X1]=0
; Axis X1 is retracted from the fixed
stop to position X = 200 mm. All other
parameters are optional.
NC programming
364
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
Clamping torque (FXST) and monitoring window (FXSW)
Any programmed torque limiting FXST is effective from the block start, i.e. the fixed stop is also
approached at a reduced torque. FXST and FXSW can be programmed and changed in the part
program at any time. The changes take effect before traversing movements in the same block.
NOTICE
Risk of collision
Programming of a new fixed stop monitoring window causes a change not only in the window
width, but also in the reference point for the center of the window if the axis has moved prior
to reprogramming. The actual position of the machine axis when the window is changed is the
new window center point.
The window must be selected such that only a breakaway from the fixed stop causes the fixed
stop monitoring to respond.
Further information
Rise ramp
A rate of rise ramp for the new torque limit can be defined in MD to prevent any abrupt changes
to the torque limit setting (e.g. insertion of a quill).
Alarm suppression
The fixed stop alarm can be suppressed for applications by the part program by masking the
alarm in a machine data item and activating the new MD setting with NEW_CONF.
Activation
The commands for travel to fixed stop can be called from synchronized actions or technology
cycles. They can be activated without initiation of a motion, the torque is limited
instantaneously. As soon as the axis is moved via a setpoint, the limit stop monitor is activated.
Activation from synchronized actions
Example:
If the expected event ($R1) occurs and travel to fixed stop is not yet running, FXS should be
activated for axis Y. The torque must correspond to 10% of the rated torque value. The width of
the monitoring window is set to the default.
Program code
N10 IDS=1 WHENEVER (($R1=1) AND ($AA_FXS[Y]==0)) DO $R1=0 FXS[Y]=1
FXST[Y]=10
The normal part program must ensure that $R1 is set at the desired point in time.
Deactivation from synchronized actions
Example:
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
365
Fundamentals
2.14 Supplementary commands
If an anticipated event ($R3) has occurred and the status "Limit stop contacted" (system variable
$AA_FXS) is reached, then FXS must be deselected.
Program code
IDS=4 WHENEVER (($R3==1) AND ($AA_FXS[Y]==1)) DO FXS[Y]=0
FA[Y]=1000 POS[Y]=0
Fixed stop reached
When the fixed stop has been reached:
• The distance-to-go is deleted and the set position is tracked.
• The drive torque increases up to the programmed limit value FXSW, and then remains
constant.
• Fixed stop monitoring is activated within the specified window width.
Supplementary conditions
• Measurement with delete distance-to-go
"Measurement with delete distance-to-go" (MEAS command) and "Travel to fixed stop"
cannot be programmed at the same time in one block.
Exception: One function acts on a path axis and the other on a positioning axis or both act
on positioning axes.
• Contour monitoring
Contour monitoring is not performed while "Travel to fixed stop" is active.
• Positioning axes
For "Travel to fixed stop" with positioning axes, the block change is performed irrespective of
the fixed stop movement.
• Link and container axes
Travel to fixed stop is also permitted for link and container axes.
The status of the assigned machine axis is maintained beyond the container rotation. This
also applies for modal torque limiting with FOCON.
• Travel to fixed stop is not possible:
- With gantry axes
- For competing positioning axes that are controlled exclusively from the PLC (FXS must be
selected from the NC program).
• If the torque limit is reduced too far, the axis will not be able to follow the specified setpoint;
the position controller then goes to the limit and the contour deviation increases. In this
operating state, an increase in the torque limit may result in sudden, jerky movements. To
ensure that the axis can follow the setpoint, check the contour deviation to make sure it is not
greater than the deviation with an unlimited torque.
NC programming
366
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
2.14.7
Dwell time (G4)
With the command G4, a time (dwell time) is programmed in a block that expires as soon as the
block is executed in the main run. The block change to the following block is performed as soon
as the time has completely expired.
Note
G4 interrupts continuous-path mode.
Syntax
G4 F<Time>
G4 S<NumSpi>
G4 S<n> = <NumSpi>
Meaning
G4:
Activate dwell time
Alone in the
Yes
block:
F<Time>:
The dwell time <Time> in seconds is specified at address F.
S<NumSpi>:
The dwell time is programmed at address S in spindle revolutions <NumSpi> with
reference to the current main spindle.
S<n>=NumSpi>:
The dwell time is programmed at address S in spindle revolutions <NumSpi> with
reference to the spindle addressed with the address extension <n>.
Note
The addresses F and S used for the time specified in the dwell block G4 do not influence the
feedrates F... and the spindle speeds S... of the program.
Supplementary conditions
Synchronized actions
Two synchronized actions are programmed in one program in such a way that the following
block with the dwell time becomes the action block in which the synchronized actions are
performed. One synchronized action is a modal synchronized action. The other synchronized
action is a non-modal synchronized action. If the non-modal synchronized action is intended to
influence the model synchronized action, e.g. release it for execution with UNLOCK, at least two
interpolation cycles e.g. G4 F<interpolator_cycle * 2> must be provided as the
effective dwell time.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
367
Fundamentals
2.14 Supplementary commands
The effective dwell time depends on the setting in the machine data MD10280
$MN_PROG_FUNCTION_MASK, Bit 4 = <value>
Value
Meaning
0
The effective dwell time is equal to the programmed dwell time
1
The effective dwell time is equal to the programmed dwell time rounded to the next largest
multiple of the interpolator cycle (MD10071 $MN_IPO_CYCLE_TIME)
Program example:
• MD10071 $MN_IPO_CYCLE_TIME == 8 ms
• MD10280 $MN_PROG_FUNCTION_MASK, Bit 4 = 1
Program code
Comment
N10 WHEN TRUE DO LOCK(1)
; Non-modal SynAct: LOCK of the
; modal SynAct. ID=1
N20 G4 F2
; Action block for SynAct from N10
N30 WHEN TRUE DO UNLOCK(1)
; Non-modal SynAct: UNLOCK
; of the modal SynAct. ID=1
N40 ID=1 WHENEVER TRUE DO $R0=1 RDISABLE
; Modal SynAct ID=1
; R parameter R0=1
; Set the read-in disable
N50 G4 F0.012
; Action block for SynAct from N40 and N50
; See paragraph "Description" below
N60 G4 F10
Description
The desired behavior is that the modal synchronized action from N30 cancels the active lock
(LOCK) of the modal synchronized action with ID=1 from N40, causing the R parameter to be
written in N50 and the read-in disable to become active. This behavior is only achieved if the
active dwell time is at least two interpolation cycles long.
The active dwell time results from the programmed dwell time, the interpolation cycle, and the
setting in MD10280 $MN_PROG_FUNCTION_MASK, Bit 4. To ensure that the active dwell time
is at least two interpolation cycles long, the following dwell time must be programmed:
• Bit 4 == 0: Programmed dwell time ≥ 2 * interpolator cycle
• Bit 4 == 1: Programmed dwell time ≥ 1.5 * interpolator cycle
If the active dwell time is shorter than two interpolation cycles, writing the R parameter and read-
in disable will not be executed until block N60.
Example
Program code
Comment
N10 G1 F200 Z-5 S300 M3
;Feed F; spindle speed S
N20 G4 F3
; Dwell time: 3 s
N30 X40 Y10
NC programming
368
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.14 Supplementary commands
Program code
Comment
N40 G4 S30
; Dwelling 30 revolutions of the spindle (at S=300
rpm and 100% speed override, corresponds to: t = 0.1
min).
N50 X...
; The feedrate and spindle speed programmed in N10
continue to apply.
2.14.8
Internal preprocessing stop
Function
The control generates an internal preprocessing stop on access to machine status data ($A...).
The following block is not executed until all preprocessed and saved blocks have been executed
in full. The previous block is stopped in exact stop (as G9).
Example
Program code
Comments
N40 POSA[X]=100
N50 IF $AA_IM[X]==R100 GOTOF MARKE1
; Access to machine status data ($A...),
the control generates an internal pre-
processing stop.
N60 G0 Y100
N70 WAITP(X)
N80 LABEL1:
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
369
Fundamentals
2.15 Other information
2.15
Other information
2.15.1
Axes
Axis types
A distinction is made between the following types of axis types when programming:
• Main axes / geometry axes
• Special axes
• Main spindle, master spindle
• Machine axes
• Channel axes
• Path axes
• Positioning axes
• Synchronized axes
• Command axes
• PLC axes / competing positioning axes
• Link axes
• Lead link axes
&KDQQHO D[HV
*HRPHWU\ D[HV
6SHFLDO D[HV
3DWK D[HV
&RPPDQG D[HV
6\QFKURQL]HG D[HV
3RVLWLRQLQJ D[HV
3/& D[HV
.LQHPDWLF WUDQVIRUPDWLRQ
0DFKLQH D[HV
2.15.1.1
Main axes/Geometry axes
The main axes define a right-angled, right-handed coordinate system. Tool movements are
programmed in this coordinate system.
NC programming
370
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
In NC technology, the main axes are called geometry axes. This term is also used in this
Programming Guide.
Replaceable geometry axes
The "Replaceable geometry axes" function (see Function Manual, Job Planning) can be used to
alter the geometry axes grouping configured using machine data from the part program. Here
any geometry axis can be replaced by a channel axis defined as a synchronous special axis.
Axis identifier
The name/identifier of a geometry axis can be defined using the following machine data:
MD20060 $MC_AXCONF_GEOAX_NAME_TAB (name of the geometry axis in the channel)
Standard identifier for turning machines:
1. Geometry axis: X
2. Geometry axis: Z
7XUUHW VZLYHO D[LV
7RROV
6SHFLDO VSLQGOH
;
=
0DLQ VSLQGOH
6SHFLDO D[LV
PDVWHU VSLQGOH
7DLOVWRFN
& D[LV
*HRPHWU\ D[HV
Standard identifier for milling machines:
1. Geometry axis: X
2. Geometry axis: Y
3. Geometry axis: Z
Further information
A maximum of three geometry axes are used for programming frames and the workpiece
geometry (contour).
The identifiers for geometry and channel axes may be the same, provided a reference is possible.
Geometry and channel axis names must be the same in all channels. This means that a program
can be executed in any channel.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
371
Fundamentals
2.15 Other information
2.15.1.2
Special axes
In contrast to the geometry axes, no geometrical relationship is defined between the special
axes.
Typical special axes are:
• Tool revolver axes
• Swivel table axes
• Swivel head axes
• Loader axes
Axis identifier
On a turning machine with circular magazine, for example:
• Revolver position U
• Tailstock V
Programming example
Program code
Comment
N10 G1 X100 Y20 Z30 A40 F300
; Path axis movements
N20 POS[U]=10POS[X]=20 FA[U]=200 FA[X]=350
; Positioning axis movements.
N30 G1 X500 Y80 POS[U]=150FA[U]=300 F550
; Path and positioning axis.
N40 G74 X1=0 Z1=0
; Approach reference point.
2.15.1.3
Main spindle, master spindle
The machine kinematics determine, which spindle is the main spindle. This spindle is usually
declared as the master spindle in the machine data.
This assignment can be changed with the SETMS(<spindle number>) program command.
SETMS can be used without specifying a spindle number to switch back to the master spindle
defined in the machine data.
Special functions such as thread cutting are supported by the master spindle.
Spindle identifier
S or S0
2.15.1.4
Machine axes
Machine axes are the axes physically existing on a machine.
The programmed motion of a path or additional axis can act on several machine axes due to
transformation (TRANSMIT, TRACYL or TRAORI) active in the channel.
Machine axes are only directly addressed in the program in special circumstances (e.g. for
reference point or fixed point approach).
NC programming
372
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
Axis identifier
The name/identifier of a machine axis can be defined using the following NC-specific machine
data:
MD10000 $MN_AXCONF_MACHAX_NAME_TAB (machine axis name)
Default setting: X1, Y1, Z1, A1, B1, C1, U1, V1
Further, machine axes have fixed axis identifiers, which can always be used, independent of the
names set in the machine data:
AX1, AX2, …, AX<n>
2.15.1.5
Channel axes
All geometry, special and machine axes, which are assigned to a channel, are called channel
axes.
Axis identifier
The channel-specific name/identifier of a geometry and special axis can be defined using the
following machine data:
MD20080 $MC_AXCONF_CHANAX_NAME_TAB (channel axis name)
Default setting: X, Y, Z, A, B, C, U, V
The assignment regarding on which machine axis a geometry or special axis is emulated in the
channel, is defined in the following machine data:
MD20070 $MC_AXCONF_MACHAX_USED (machine axes used)
2.15.1.6
Path axes
Path axes define the path and therefore the movement of the tool in space.
The programmed feed is active for this path. The axes involved in this path reach their position
at the same time. As a rule, these are the geometry axes.
However, default settings define, which axes are the path axes, and therefore determine the
velocity.
Path axes can be specified in the NC program with FGROUP.
For more information about FGROUP, see "Feedrate (G93, G94, G95, F, FGROUP, FL, FGREF)
(Page 105)".
2.15.1.7
Positioning axes
Positioning axes are interpolated separately; in other words, each positioning axis has its own
axis interpolator and its own feedrate. Positioning axes do not interpolate with the path axes.
Positioning axes are traversed by the NC program or the PLC. If an axis is to be traversed
simultaneously by the NC program and the PLC, an error message appears.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
373
Fundamentals
2.15 Other information
Typical positioning axes are:
• Loaders for moving workpieces to the machine
• Loaders for moving workpieces away from the machine
• Tool magazine/turret
Types
A distinction is made between positioning axes with synchronization at the block end or over
several blocks.
POS axes
Block change occurs at the end of the block when all the path and positioning axes programmed
in this block have reached their programmed end point.
POSA axes
The movement of these positioning axes can extend over several blocks.
POSP axes
The movement of these positioning axes for approaching the end position takes place in
sections.
Note
Positioning axes become synchronized axes if they are traversed without the special POS/POSA
identifier.
Continuous-path mode (G64) for path axes is only possible if the positioning axes (POS) reach
their final position before the path axes.
Path axes programmed with POS/POSA are removed from the path axis grouping for the
duration of this block.
For more information about POS, POSA, and POSP, see "Traverse positioning axes (POS, POSA,
POSP, FA, WAITP, WAITMC) (Page 113)".
2.15.1.8
Synchronized axes
Synchronized axes traverse synchronously to the path from the start position to the
programmed end position.
The feedrate programmed in F applies to all the path axes programmed in the block, but does
not apply to synchronized axes. Synchronized axes take the same time as the path axes to
traverse.
A synchronized axis can be a rotary axis, which is traversed synchronously to the path
interpolation.
NC programming
374
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
2.15.1.9
Command axes
Command axes are started from synchronized actions in response to an event (command). They
can be positioned, started and stopped fully asynchronous to the part program. An axis cannot
be moved from the part program and from synchronized actions simultaneously.
Command axes are interpolated separately; in other words, each command axis has its own axis
interpolator and its own feedrate.
2.15.1.10
PLC axes
PLC axes are traversed by the PLC via special function blocks in the basic program; their
movements can be asynchronous to all other axes. Traversing movements take place
independently of path and synchronized movements.
2.15.1.11
Link axes
Link axes are axes which are physically connected to another NCU, and whose position is
controlled from this NCU. Link axes can be assigned dynamically to channels of another NCU.
Link axes are not local axes from the perspective of a particular NCU.
'ULYH
'ULYH
1&8
V\VWHP
1&8
V\VWHP
&KDQQHO
&KDQQHO
%
$
&KDQQHO
$
%
$
/LQN PRGXOH +:
/LQN PRGXOH +:
/LQN FRPPXQLFDWLRQ
The axis container concept is used for the dynamic modification of the assignment to an NCU.
Axis interchange with GET and RELEASE from the part program is not available for link axes.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
375
Fundamentals
2.15 Other information
Further information
Requirements
• The participating NCUs, NCU1 and NCU2, must be connected by means of high-speed
communication via the link module.
• The axis must be configured appropriately by machine data.
• The "Link axis" option must be installed.
Description
The position control is implemented on the NCU on which the axis is physically connected to the
drive. This NCU also contains the associated axis VDI interface. The position setpoints for link
axes are generated on another NCU and communicated via the NCU link.
The link communication must ensure the interaction between the interpolators and the position
controller or PLC interface. The setpoints calculated by the interpolators must be transported to
the position control loop on the home NCU and, vice versa, the actual values must be returned
from there back to the interpolators.
Axis container
An axis container is a circular buffer data structure, in which local axes and/or link axes are
assigned to channels. The entries in the circular buffer can be shifted cyclically.
In addition to the direct reference to local axes or link axes, the link axis configuration in the
logical machine axis image also permits references to axis containers. This type of reference
comprises:
• A container number and
• A slot (circular buffer location within the container)
The entry in a circular buffer location contains:
• A local axis or
• A link axis
Axis container entries contain local machine axes or link axes from the perspective of an
individual NCU. The entries in the logical machine axis image
(MD10002 $MN_AXCONF_LOGIC_MACHAX_TAB) of an individual NCU are fixed.
NC programming
376
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
2.15.1.12
Lead link axes
A leading link axis is one that is interpolated by one NCU and utilized by one or several other
NCUs as the master axis for controlling slave axes.
1&8 OLQN PRGXOHV
1&8
1&8
1&8 Q
6HWSRLQWV IURP
$
&RQWURO
,QWHUSRODWRU
,QWHUSRODWRU
WKURXJK
IROORZLQJ
D[LV D[HV
$FWXDO YDOXHV
6HUYR
6HUYR
IURP $
'ULYH
'ULYH
V\VWHP
V\VWHP
$
%
%
An axial position controller alarm is sent to all other NCUs, which are connected to the affected
axis via a leading link axis.
NCUs that are dependent on the leading link axis can utilize the following coupling relationships
with it:
• Master value (setpoint, actual master value, simulated master value)
• Coupled motion
• Tangential correction
• Electronic gear (ELG)
• Synchronous spindle
Programming
Master NCU:
Only the NCU, which is physically assigned to the master value axis can program travel motions
for this axis. The travel program must not contain any special functions or operations.
NCUs of slave axes:
The travel program on the NCUs of the slave axes must not contain any travel commands for the
leading link axis (master value axis). Any violation of this rule triggers an alarm.
The leading link axis is addressed in the usual way via channel axis identifiers. The states of the
leading link axis can be accessed by means of selected system variables.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
377
Fundamentals
2.15 Other information
Further information
Requirements
• The NCUs involved, i.e., NCU1 to NCU<n> (<n> equals max. of 8), must be interconnected via
the link module for high-speed communication.
Reference:
Device Manual Configuration NCU
• The axis must be configured appropriately by machine data.
• The "Link axis" option must be installed.
• The same interpolator clock cycle must be configured for all participating NCUs.
Restrictions
• A master axis, which is a leading link axis, cannot be a link axis, i.e. it cannot be traversed by
NCUs other than its home NCU.
• A master axis, which is a leading link axis cannot be a container axis, i.e. it cannot be
addressed alternately by different NCUs.
• A leading link axis cannot be the programmed as leading axis in a gantry grouping.
• Couplings with leading link axes cannot be cascaded.
• Axis replacement can only be implemented within the home NCU of the leading link axis.
System variables
The following system variables can be used in conjunction with the channel axis identifier of the
leading link axis:
System variable
Meaning
$AA_LEAD_SP
Simulated master value - position
$AA_LEAD_SV
Simulated master value - velocity
If these system variables are updated by the home NCU of the master axis, the new values are
also transferred to any other NCUs that wish to control slave axes as a function of this master axis.
NC programming
378
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
2.15.2
From travel command to machine movement
The relationship between the programmed axis movements (travel commands) and the
resulting machine movements is illustrated in the following figure:
$[LV PRYHPHQW SURJUDPPHG LQ WKH ZRUNSLHFH FRRUGLQDWH V\VWHP
'HVFULSWLRQ RI WKH
ZRUNSLHFH JHRPHWU\ YLD JHRPHWU\
D[HV H J ; < =
)UDPH FDOFXODWLRQ
2IIVHW 75$16
'HVFULSWLRQ RI WKH WRRO
5HPDLQLQJ WUDYHUVLQJ
5RWDWLRQ
527
RULHQWDWLRQ YLD RULHQWDWLRQ
FRPPDQGV YLD VR FDOOHG
6FDOLQJ 6&$/(
YHFWRU (XOHU DQJOH
VSHFLDO D[HV H J & 8 9
&RQWRXU LQ WKH &DUWHVLDQ
FRRUGLQDWH V\VWHP
RI WKH FKDQQHO %&6
)UDPH FDOFXODWLRQ
7RRO UDGLXV FRPSHQVDWLRQ
2IIVHW
0RYHPHQW RI WKH
6FDOLQJ
WRRO ]HUR
LQ WKH %&6
5RWDU\ D[HV IRU D[LV
7RRO OHQJWK FRPSHQVDWLRQ
WUDQVIRUPDWLRQ
.LQHPDWLF WUDQVIRUPDWLRQ LI DFWLYH
0RYHPHQW RI WKH PDFKLQH D[HV RI FKDQQHO DEF
2.15.3
Path calculation
The path calculation determines the distance to be traversed in a block, taking into account all
offsets and compensations.
In general:
Path =
setpoint - actual value + zero offset (ZO) + tool offset (TO)
;
7
0
:
=
6HW
19
SRLQW :.
$EVROXWH SRVLWLRQ
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
379
Fundamentals
2.15 Other information
If a new zero offset and a new tool offset are programmed in a new program block, the following
applies:
• With absolute dimensioning:
Path = (absolute dimension P2 - absolute dimension P1) + (WO P2 - WO P1) +
(TO P2 - TO P1).
• With incremental dimensioning:
Path = incremental dimension + (WO P2 - WO P1) +
(TO P2 - TO P1).
193
$EVROXWH GLPHQVLRQ VHWSRLQW IRU 3
:. 3
193
$EVROXWH GLP
:. 3
'LVWDQFH
VHWSRLQW
IRU 3
0
:
3
0RYHPHQW
3
$FWXDO YDOXH
$FWXDO YDOXH
2.15.4
Addresses
Fixed addresses
These addresses are permanently set, that is the address characters cannot be changed.
A list can be found in Table "Fixed addresses (Page 1279)".
Settable addresses
The machine manufacturer may assign another name to these addresses via machine data.
Note
Settable addresses must be unique within the control, i.e. the same address name must not be
used for different address types (axis values and end points, tool orientation, interpolation
parameters, etc.).
A list can be found in Table "Settable addresses (Page 1283)".
NC programming
380
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
Modal/non-modal addresses
Modal addresses remain valid with the programmed value (in all subsequent blocks) until a new
value is programmed at the same address.
Non-modal addresses only apply in the block, in which they were programmed.
Example:
Program code
Comment
N10 G01 F500 X10
N20 X10
; Feedrate F from N10 remains active until a new feedrate
is entered.
Addresses with axial extension
In addresses with axial extension, an axis name is inserted in square brackets after the address.
The axis name assigns the axis.
Example:
Program code
Comment
FA[U]=400
; Axis-specific feedrate for U axis.
See also Table "Fixed addresses (Page 1279)".
Extended address notation
Extended address notation enables a larger number of axes and spindles to be organized in a
system.
An extended address consists of a numeric extension and an arithmetic expression assigned
with an "=" character. The numeric extension has one or two digits and is always positive.
The extended address notation is only permitted for the following direct addresses:
Address
Meaning
X, Y, Z, …
Axis addresses
I, J, K
Interpolation parameters
S
Spindle speed
SPOS, SPOSA
Spindle position
M
Special functions
H
Auxiliary functions
T
Tool number
F
Feedrate
Examples:
Program code
Comment
X7
; No "=" required, 7 is a value, but the "=" character can also be
used here
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
381
Fundamentals
2.15 Other information
Program code
Comment
X4=20
; Axis X4; "=" is required
CR=7.3
; Two letters; "=" are required
S1=470
; Speed for 1st spindle: 470 rpm
M3=5
; Spindle stop for 3rd spindle
The numeric extension can be replaced by a variable for addresses M, H, S and for SPOS and
SPOSA. The variable identifier is enclosed in square brackets.
Examples:
Program code
Comment
S[SPINU]=470
; Speed for the spindle whose number is stored in the SPINU vari-
able.
M[SPINU]=3
; Clockwise rotation for the spindle whose number is stored in the
SPINU variable.
T[SPINU]=7
; Selection of the tool for the spindle whose number is stored in
the SPINU variable.
2.15.5
Names
The commands according to DIN 66025 are supplemented with named objects, etc. by the NC
high-level language.
Examples of named objects:
• System variables
• User-defined variables
• Axes/spindles
• Subprograms
• Keywords
• Jump markers
• Macros
Note
Identifiers must be unique. It is not permissible to use the same identifier for different objects.
NC programming
382
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
Naming rules
A name can be chosen freely providing the following rules are observed:
• Permissible characters:
- Letters: A ... Z, a ... z
- Numbers: 0 ... 9
- Underscore: _
• The first two characters should be letters or underscores.
• Maximum length:
- Program names (Page 42): 24 characters
- Axis names: 8 characters
- Variable names: 31 characters
Note
Reserved keywords must not be used as identifiers.
Cycles
To prevent name conflicts, we recommend that the following specification for the assignment
of names for user cycles is observed:
Character string
Reserved for names for
• CYCLE
SIEMENS cycles
• CUST_
• GROUP_
•
_
• S_
• E_
• F_
• CCS_
SIEMENS compile cycles
• CC_
User compile cycles
User cycles
We recommend that the names of user cycles begin with U_.
Variables
Information relating to the name assignment for variables is provided in the following chapters:
• System data (Page 390)
• Definition of user variables (DEF) (Page 397)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
383
Fundamentals
2.15 Other information
2.15.6
Constants
Constant (general)
A constant is a data element whose value does not change during the execution of a program,
e.g. a value assignment to an address.
Decimal constant
The numeric value of a decimal constant is displayed in the decimal system.
INTEGER constant
An INTEGER constant is an integer value, i.e. a sequence of digits without decimal point, with or
without sign.
Examples:
X10
Assignment of the value +10 to address X
X-35
Assignment of the value -35 to address X
X0
Assignment of the value 0 to address X
Note:
X0 cannot be replaced by X.
REAL constant
A REAL constant is a sequence of digits with decimal point, with or without sign and with or
without exponent.
Examples:
X10.25
Assignment of the value +10.25 to address X
X-10.25
Assignment of the value -10.25 to address X
X0.25
Assignment of the value +0.25 to address X
X.25
Assignment of the value +0.25 to address X without leading "0"
X=-.1EX-3
Assignment of the value -0.1*10-3 to address X
Note
If, in an address, which permits decimal point input, more decimal places are specified than
actually provided for the address, then they are rounded to fit the number of places provided.
Hexadecimal constant
Constants can also be interpreted as hexadecimal format, i.e. based on 16. The letters A to F are
hexadecimal digits with the decimal values 10 to 15.
NC programming
384
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
Hexadecimal constants are enclosed in single quotation marks and start with the letter "H",
followed by the value in hexadecimal notation. Separators are permitted between the letters
and digits.
Example:
Program code
Comment
$MC_TOOL_MANAGEMENT_MASK='H7F'
; By assigning the hexadecimal constant,
bits 0 to 7 are set in the machine data.
Note
The maximum number of characters is limited by the value range of the integer data type.
Binary constant
Constants can also be interpreted in binary format. In this case, only the digits "0" and "1" are
used.
Binary constants are enclosed in single quotation marks and start with the letter "B", followed by
the binary value. Separators are permitted between the digits.
Example:
Program code
Comment
$MN_AUXFU_GROUP_SPEC='B10000001'
; By assigning the binary constant, bit 0
and bit 7 are set in the machine data.
Note
The maximum number of characters is limited by the value range of the integer data type.
2.15.7
Operators and arithmetic functions
Operators
Arithmetic operators
System variables of the REAL and INT type can be linked by the following operators:
Operator
Meaning
+
Addition
-
Subtraction
*
Multiplication
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
385
Fundamentals
2.15 Other information
Operator
Meaning
/
• Division in synchronous actions: INT / INT ⇒ INT
• Division in synchronous actions with REAL result by using the function ITOR():
ITOR( INT ) / ITOR( INT ) ⇒ REAL
• Division in NC programs: INT / INT ⇒ REAL
DIV
Integer division: INT / INT ⇒ INT
MOD
Modulo division (only for type INT) supplies remainder of an INT division
Example: 3 MOD 4 = 3
Note
Only variables of the same type may be linked by these operations.
Relational operators
Operator
Meaning
==
Equal to
>
Not equal to
<
Less than
>
Greater than
<=
Less than or equal to
>=
Greater than or equal to
Boolean operators
Operator
Meaning
NOT
NOT
AND
AND
OR
OR
XOR
Exclusive OR
Bit logic operators
Operator
Meaning
B_OR
Bit-by-bit OR
B_AND
Bit-by-bit AND
B_XOR
Bit-by-bit exclusive OR
B_NOT
Bit-by-bit negation
NC programming
386
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Fundamentals
2.15 Other information
Priority of the operators
The operators have the following priorities for execution in the synchronous action (highest
priority: 1):
Priori-
Operators
Meaning
ty
1
NOT, B_NOT
Negation, bit-by-bit negation
2
*, /, DIV, MOD
Multiplication, division
3
+, -
Addition, subtraction
4
B_AND
Bit-by-bit AND
5
B_XOR
Bit-by-bit exclusive OR
6
B_OR
Bit-by-bit OR
7
AND
AND
8
XOR
Exclusive OR
9
OR
OR
10
<<
Concatenation of strings, result type STRING
11
==, <>, <, >, >=, <=
Relational operators
Note
It is strongly recommended that the individual operators are clearly prioritized by setting
parentheses "( … )" when several operators are used in an expression.
Example of a condition with an expression with several operators:
Program code
... WHEN ($AA_IM[X] > VALUE) AND ($AA_IM[Y] > VALUE1) DO ...
Arithmetic functions
Operator
Meaning
SIN()
Sine
COS()
Cosine
TAN()
Tangent
ASIN()
Arc sine
ACOS()
Arc cosine
ATAN2()
Arc tangent 2
SQRT()
Square root
ABS()
Absolute value
POT()
2nd power (square)
TRUNC()
Integer component
The accuracy for comparison commands can be set using TRUNC
ROUND()
Round to an integer
LN()
Natural logarithm
EXP()
Exponential function
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
387
Fundamentals
2.15 Other information
Indexing
The index of a system variable of type "Array of …" can in turn be a system variable. The index
is also evaluated in the main run in the interpolator clock cycle.
Example
Program code
... WHEN … DO $AC_PARAM[$AC_MARKER[1]]=3
Restrictions
• It is not permissible to nest indices with further system variables.
• The index must not be formed via preprocessing variables. The following example is
therefore not permitted since $P_EP is a preprocessing variable:
$AC_PARAM[ 1 ] = $P_EP[ $AC_MARKER[ 0 ] ]
See also
Arithmetic functions (Page 441)
Instructions (Page 441)
NC programming
388
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3
3.1
Flexible NC programming
3.1.1
Variables
The use of variables from the system data and user data areas, especially in conjunction with
arithmetic functions and check structures, enables highly flexible NC programs and cycles to be
written.
WARNING
Material damage and personal injuries caused by changed variables
When using variables in the NC program it must be taken into account that machine operators
or unauthorized persons with corresponding access rights can change the variables and thus
affect the program run. This can result in material damage and personal injuries.
• In order to avoid negative effects on the program run caused by changed variables,
appropriate data checks ("input validation") are to be provided in the NC program.
• System data
The system data contains the variables predefined in the system. These variables have a
defined meaning. They are primarily used by the system software. The user can read and
write these variables in NC programs and cycles. Example: Machine data, setting data,
system variables.
Although the meaning of a system data item is fixed, the user can modify its properties within
certain limits by redefinition.
See "Redefinition of system data, user data, and NC commands (REDEF) (Page 402)"
• User data
The user data contains those variables defined by the user with meanings defined exclusively
by the user. They are not evaluated by the system.
The user data is divided into:
- Predefined user variables
Predefined user variables are variables that have already been defined in the system and
whose number is parameterized in the machine data. The user can change the properties
of these variables.
See "Redefinition of system data, user data, and NC commands (REDEF) (Page 402)".
- User-defined variables
User-defined variables are variables that are defined by the user and are not created by the
system until runtime. Their number, data type, visibility, and all other properties are
defined exclusively by the user.
See "Definition of user variables (DEF) (Page 397)"
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
389
Work preparation
3.1 Flexible NC programming
3.1.1.1
System data
The system data contain the variables that are predefined in the system and enable access to the
current parameter settings of the control, as well as to machine, control, and process states, in
NC programs and cycles.
Preprocessing variables
Preprocessing variables are system data that are read and written during preprocessing, in other
words, at the instant at which the block containing the variable is interpreted. Preprocessing
variables do not trigger preprocessing stops.
Main run variables
Main run variables are system data that are read and written during the main run, in other words,
at the instant at which the block containing the variable is executed. The following are main run
variables:
• Variables that can be programmed in synchronized actions (read/write)
• Variables that can be programmed in the NC program and trigger preprocessing stops (read/
write)
• Variables that can be programmed in the NC program and whose value is calculated during
preprocessing but not written until the main run (main run synchronized: write only)
Prefix system
To distinguish system data from other data, their names are usually preceded by a prefix
comprising the $ sign followed by one or two letters and an underscore.
$ + 1. Letter
Meaning: Data type
Preprocessing data (system data that are read/written during preprocessing)
$M
Machine data 1)
$S
Setting data, protection areas 1)
$T
Tool management data
$P
Programmed values
$C
Cycle variables of ISO envelope cycles
$O
Option data
R
R-parameters (arithmetic parameters) 2)
Main run data (system data that are read/written during the main run)
$$M
Machine data 1)
$$S
Setting data 1)
$A
Current main run data
$V
Position controller data
NC programming
390
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
$ + 1. Letter
Meaning: Data type
$R
R-parameters (arithmetic parameters) 2)
1) Whether machine and setting data is treated as preprocessing or main run variables depends on
whether they are written with one or two $ characters. The notation is freely selectable for the specific
application.
2) When an R-parameter is used in the part program/cycle as a preprocessing variable, the prefix is omitted,
e.g. R10. When it is used in a synchronized action as a main run variable, a $ sign is written as a prefix,
e.g. $R10.
2nd letter
Meaning: Visibility
N
NC global variable (NC)
C
Channel-specific variable (Channel)
A
Axis-specific variable (Axis)
Supplementary conditions
Exceptions in the prefix system
The following system of variables deviate from the prefix system specified above:
• $TC_...: Here, the 2nd letter C does not refer to channel-specific system variables but to
toolholder-specific system variables (TC= tool carrier).
• $P_ ...: Channel-specific system variables
Use of machine and setting data in synchronized actions
When machine and setting data is used in synchronized actions, the prefix can be used to define
whether the machine or setting data will be read/written synchronous to the preprocessing run
or the main run.
If the data remains unchanged during machining, it can be read synchronous to the
preprocessing run. For this purpose, the machine or setting data prefix is written with a $ sign:
ID=1 WHENEVER $AA_IM[z] < $SA_OSCILL_REVERSE_POS2[Z]-6 DO $AA_OVR[X]=0
If the data changes during machining, it must be read/written synchronous to the main run. For
this purpose, the machine or setting data prefix is written with two $ signs:
ID=1 WHENEVER $AA_IM[z] < $$SA_OSCILL_REVERSE_POS2[Z]-6 DO $AA_OVR[X]=0
Note
Writing machine and setting data
When writing an item of machine or setting data, it is important to ensure that the access level
which is active when the part program/cycle is executed permits write access and that the data
is set to take "IMMEDIATE" effect.
See also
Variables (Page 389)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
391
Work preparation
3.1 Flexible NC programming
3.1.1.2
Predefined user variables: Channel-specific arithmetic parameters (R)
Channel-specific arithmetic parameters or R parameters are predefined user variables with the
designation R, defined as an array of the REAL data type. For historical reasons, notation both
with array index, e.g. R[10], and without array index, e.g. R10, is permitted for R parameters.
When using synchronized actions, the $ sign must be included as a prefix, e.g. $R10.
Syntax
When used as a preprocessing variable:
R<n>
R[<expression>]
When used as a main run variable:
$R<n>
$R[<expression>]
Meaning
R:
Identifier when used as a preprocessing variable, e.g. in the part program
$R:
Identifier when used as a main run variable, e.g. in synchronized actions
Type:
REAL
Range of values:
For a non-exponential notation:
± (0.000 0001 ... 9999 9999)
Note:
A maximum of 8 decimal places are permitted
For an exponential notation:
± (1*10-300 ... 1*10+300)
Note:
• Notation: <Mantissa>EX<Exponent> e.g. 8.2EX-3
• A maximum of 10 characters are permitted including sign
and decimal point.
<n>:
Number of the R parameter
Type:
INT
Range of values:
0 - MAX_INDEX
Note
MAX_INDEX is calculated from the parameterized number of R-
parameters:
MAX_INDEX = (MD28050 $MN_MM_NUM_R_PARAM) - 1
<expression>:
Array index
Any expression can be used as an array index, as long as the result of the expression
can be converted to the INT data type (INT, REAL, BOOL, CHAR).
NC programming
392
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Example
Assignments to R-parameters and use of R-parameters in mathematical functions:
Program code
Comment
R0=3.5678
; Assignment in preprocessing
R[1]=-37.3
; Assignment in preprocessing
R3=-7
; Assignment in preprocessing
$R4=-0.1EX-5
; Assignment in the main program run: R4 = -0.1 * 10^-5
$R[6]=1.874EX8
; Assignment in the main program run: R6 = 1.874 * 10^8
R7=SIN(25.3)
; Assignment in preprocessing
R[R2]=R10
; Indirect addressing using R-parameter
R[(R1+R2)*R3]=5
; Indirect addressing using math. expression
X=(R1+R2)
; Traverse axis X to the position resulting from the sum of
R1 and R2
Z=SQRT(R1*R1+R2*R2)
; Traverse axis Z to the square root position (R1^2 + R2^2)
See also
Variables (Page 389)
3.1.1.3
Predefined user variables: Global arithmetic parameters (RG)
Function
In addition to the channel-specific R parameters, the user has access to global R parameters. They
exist once within the control unit and can be read and written from all channels.
Global R parameters are used, for example, to transfer information from one channel to the next.
Another example concerns global settings that should be evaluated for all channels, such as the
overhang of the raw part from the spindle.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
393
Work preparation
3.1 Flexible NC programming
The global R parameters are read and written from the user interface or in the NC program during
the preprocessing. Synchronous actions and technology cycles cannot be used.
Note
No synchronization between the channels when reading and writing global R parameters.
Because the reading and writing is performed during the preprocessing, the point in time when
a written value from one channel becomes active in another channel is not defined.
Example:
In channel 1, a loop runs with a global R parameter as loop counter. Channel 2 writes a value to
this global R parameter; this causes a loop abort in channel 1. All loops that can be interpreted
in the preprocessing in channel 1 are however still executed. The number of loops is not defined
and depends on the channel loading, etc.
The user must implement a synchronization between the channels as application, e.g. with
WAIT flags!
Syntax
Writing in the NC program
RG[<n>]=<value>
RG[<expression>]=<value>
Reading in the NC program
R...=RG[<n>]
R...=RG[<expression>]
Meaning
RG :
Default name of the NC address for global R parameters
Note:
The name of the NC address can be set via MD15800 $MN_R_PARAM_NCK_NAME
<n>:
Number of the global R parameter
Type:
INT
Range of values:
0 ... MAX_INDEX
Note
MAX_INDEX is calculated from the parameterized number of
global R parameters:
MAX_INDEX = (MD18156 $MN_MM_NUM_R_PARAM_NCK) -
1
<expression>:
Any expression can be used as an array index, as long as the result of the expres-
sion can be converted to the INT data type (INT, REAL, BOOL, CHAR).
NC programming
394
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
<value>:
Value of the global R parameter
Type:
REAL
Range of values:
For a non-exponential notation:
± (0.000 0001 ... 9999 9999)
Note:
A maximum of eight decimal places are permitted
For an exponential notation:
± (1*10-300 ... 1*10+300)
Note:
• Notation: <mantissa>EX<exponent> e.g. 8.2EX-3
• A maximum of ten characters are permitted including
sign and decimal point.
3.1.1.4
Predefined user variables: Link variables
Link variables can be used in the context of the "NCU-Link" function for cyclic data exchange
between NCUs which are linked on a network. They facilitate data-format-specific access to the
link variables memory. The link variables memory is defined both in terms of size and data
structure on a system-specific basis by the user / machine manufacturer.
Link variables are system-global user variables which can be read and written in part programs
and cycles by all NCUs involved in a link if link communication has been configured. Unlike global
user variables (GUD), link variables can also be used in synchronized actions.
On systems without an active NCU link, link variables can be used locally on the control as
additional global user variables alongside global user variables (GUD).
Syntax
$A_DLB[<index>]
$A_DLW[<index>]
$A_DLD[<index>]
$A_DLR[<index>]
Meaning
$A_DLB:
Link variable for BYTE data format (1 byte)
Data type:
UINT
Range of values:
0 ... 255
$A_DLW:
Link variable for WORD data format (2 bytes)
Data type:
INT
Range of values:
-32768 ... 32767
$A_DLD:
Link variable for DWORD data format (4 bytes)
Data type:
INT
Range of values:
-2147483648 ... 2147483647
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
395
Work preparation
3.1 Flexible NC programming
$A_DLR:
Link variable for REAL data format (8 bytes)
Data type:
REAL
Range of values:
±(2.2*10-308 … 1.8*10+308)
<index>:
Address index in bytes, counted from the start of the link variable memory
Data type:
INT
Range of values:
0 - MAX_INDEX
Note
• MAX_INDEX is calculated from the parameterized size of the
link variables memory: MAX_INDEX = (MD18700 $MN_MM_SI-
ZEOF_LINKVAR_DATA) - 1
• Only indices may be programmed, so that the bytes addressed
in the link variables memory are located on a data format limit
⇒
Index = n * bytes, where n = 0, 1, 2, etc.
- $A_DLB[i]: i = 0, 1, 2, ...
- $A_DLW[i]: i = 0, 2, 4, ...
- $A_DLD[i]: i = 0, 4, 8, ...
- $A_DLR[i]: i = 0, 8, 16, ...
Example
An automation system contains two NCUs (NCU1 and NCU2). Machine axis AX2 is connected to
NCU1. It is traversed as a link axis of NCU2.
NCU1 writes the actual current value ($VA_CURR) of axis AX2 cyclically to the link variables
memory. NCU2 reads the actual current value transferred via link communication cyclically and
displays alarm 61000 if the limit value is exceeded.
The data structure in the link variables memory is illustrated in the following figure. The actual
current value is transmitted in the REAL value.
/LQN YDULDEOH PHPRU\
0'
01B00B6,=(2)B/,1.9$5B'$7$
,QGH[
%<7(
%<7(
:25'
':25'
':25'
':25'
5(
$/
NC programming
396
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
NCU1
NCU1 uses link variable $A_DLR[ 16 ] to write the actual current value of axis AX2 to the link
variables memory cyclically in the interpolation cycle in a static synchronized action.
Program code
N111 IDS=1 WHENEVER TRUE DO $A_DLR[16]=$VA_CURR[AX2]
NCU2
NCU2 uses link variable $A_DLR[ 16 ] to read the actual current value of axis AX2 to the link
variables memory cyclically in the interpolation cycle in a static synchronized action. If the actual
current value is greater than 23.0 A, alarm 61000 is displayed.
Program code
N222 IDS=1 WHEN $A_DLR[16] > 23.0 DO SETAL(61000)
3.1.1.5
Definition of user variables (DEF)
With the DEF command, you can define user-specific variables, or user variables (user data), and
assign values to them.
According to the range of validity (in other words, the range in which the variable is visible) there
are the following categories of user variables:
• Local user variables (LUD)
Local user variables (LUD) are variables defined in an NC program that is not the main
program at the time of execution. They are created when the NC program is called, and
deleted with an end of program reset - or the next time that the control system powers up.
Local user variables can only be accessed within the NC program in which they are defined.
• Program-global user variables (PUD)
Program-global user variables (PUD) are user variables defined in an NC program used as the
main program. They are created when the NC program is called, and deleted with an end of
program reset - or the next time that the control system powers up. It is possible to access
PUD in the main program and in all subprograms of the main program.
Note
Availability of program-global user variables (PUD)
Program-global user variables (PUD) defined in the main program are only available in
subprograms if the following machine data is set:
MD11120 $MN_LUD_EXTENDED_SCOPE = 1
If MD11120 = 0 the program-global user variables defined in the main program will only be
available in the main program.
• Global user variables (GUD)
Global user variables (GUD) are NC or channel-global variables which are defined in a data
block (SGUD, MGUD, UGUD, GUD4 to GUD9) and are kept even after an end of program reset
or the next time that the control system powers up. GUD can be accessed in all NC programs.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
397
Work preparation
3.1 Flexible NC programming
User variables must be defined before they can be used (read/write). The following rules must
be observed in this context:
• GUDs must be defined in a definition file, e.g. _N_DEF_DIR/_N_UGUD_DEF.
• PUDs and LUDs must be defined in the definition section of the NC program.
• The data must be defined in a dedicated block.
• Only one data type may be used for each data definition.
• Several variables of the same data type can be defined for each data definition.
Syntax
LUD and PUD
DEF <type> <phys_unit> <limit values> <name>[<value_1>, <value_2>,
<value_3>]=<init_value>
GUD
DEF <range> <pp_stop> <access_rights> <data class> <type>
<phys_unit> <limit values> <name>[<value_1>, <value_2>,
<value_3>]=<init_value>
Meaning
DEF:
Command for defining GUD, PUD, LUD user variables
<range>:
Range of validity, only relevant for GUD:
NC:
NC-global user variable
CHAN:
Channel-global user variable
<PP_stop>:
Preprocessing stop, only relevant for GUD (optional)
SYNR:
Preprocessing stop when reading
SYNW:
Preprocessing stop when writing
SYNRW:
Preprocessing stop when reading/writing
<access rights>:
Protection level for reading/writing GUD via NC program or OPI (optional)
APRP <protection level>:
Read: NC program
APWP <protection level>:
Write: NC program
APRB <protection level>:
Read: OPI
APWB <protection level>:
Write: OPI
<protection level>:
Range of values: 0 ... 7
See "Attribute: Access rights (APR, APW, APRP, APWP, APRB, APWB)
(Page 412)"
<data class>:
Data class assignment (only SINUMERIK 828D)
DCM:
Data class M (= Manufacturer)
DCI:
Data class I (= Individual)
DCU:
Data class U (= User)
NC programming
398
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
<type>:
Data type:
INT:
Integer with sign
REAL:
Real number (LONG REAL to IEEE)
BOOL:
Truth value TRUE (1)/FALSE (0)
CHAR:
ASCII character
STRING[<MaxLength>]:
Character string of a defined length
AXIS:
Axis/spindle identifier
FRAME:
Geometric data for a static coordinate trans-
formation
See "Data types (Page 424)"
<phys_unit>:
Physical unit (optional)
PHU <unit>:
Physical unit
See "Attribute: Physical unit (PHU) (Page 410)"
<limit values>:
Lower/upper limit value (optional)
LLI <limit val-
Lower limit value (lower limit)
ue>:
ULI <limit val-
Upper limit value (upper limit)
ue>:
See "Attribute: Limit values (LLI, ULI) (Page 409)"
<name>:
Name of variable
Note
• Maximum 31 characters
• The first two characters must be a letter and/or an underscore.
• The $ sign is reserved for system variables and must not be used.
[<value_1>,
Specification of array sizes for 1- to max. 3-dimensional array variables
<value_2>,
(optional)
<value_3>]:
For the Initialization of array variables see "Definition and initialization of
array variables (DEF, SET, REP) (Page 418)"
<init_value>:
Initialization value (optional)
See "Attribute: Initialization value (Page 406)"
For the Initialization of array variables see "Definition and initialization of
array variables (DEF, SET, REP) (Page 418)"
Examples
Example 1: Definition of user variables in the data block for machine manufacturers
Program code
Comment
%_N_MGUD_DEF
; GUD block: Machine manufacturer
$PATH=/_N_DEF_DIR
DEF CHAN REAL PHU 24 LLI 0 ULI 10 CURRENT_1, CURRENT_2
;Description
;Definition of two GUD items: CURRENT_1, CURRENT_2
;Range of validity: Throughout the channel
;Data type: REAL
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
399
Work preparation
3.1 Flexible NC programming
Program code
Comment
PP stop: Not programmed => default value = no PP stop
; phys. unit: 24 = [A]
;Limit values: Low = 0.0, high = 10.0
;Access rights: Not programmed => default value = 7 = key-operated switch position 0
;Initialization value: Not programmed => default value = 0.0
DEF NCK REAL PHU 13 LLI 10 APWP 3 APRP 3 APWB 0 APRB 2 TIME_1=12, TIME_2=45
;Description
;Definition of two GUD items: TIME_1, TIME_2
;Range of validity: Throughout NC
;Data type: REAL
PP stop: Not programmed => default value = no PP stop
; phys. unit: 13 = [s]
;Limit values: low = 10.0, high = not programmed => upper definition range limit
;Access rights:
; NC program: Write/read = 3 = user
; OPI: Write = 0 = Siemens, read = 3 = user
;Initialization value: TIME_1 = 12.0, TIME_2 = 45.0
DEF NCK APWP 3 APRP 3 APWB 0 APRB 3 STRING[5] GUD5_NAME = "COUNTER"
;Description
; Definition of one GUD item: GUD5_NAME
;Range of validity: Throughout NC
;Data type: STRING, max. 5 characters
PP stop: Not programmed => default value = no PP stop
; phys. unit: Not programmed => default value = 0 = no phys. unit
;Limit values: Not programmed => definition range limits: Low = 0, high = 255
;Access rights:
; NC program: Write/read = 3 = user
; OPI: Write = 0 = Siemens, read = 3 = user
;Initialization value: "COUNTER"
M30
Example 2: Global program and local user variables (PUD/LUD)
Program code
Comment
PROC MAIN
; Main program
DEF INT VAR1
; PUD definition
SUB2
; Subprogram call
M30
NC programming
400
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Program code
Comment
PROC SUB2
; Subprogram SUB2
DEF INT VAR2
; LUD DEFINITION
IF (VAR1==1)
; Read PUD
VAR1=VAR1+1
; Read & write PUD
VAR2=1
; Write LUD
ENDIF
SUB3
; Subprogram call
M17
Program code
Comment
PROC SUB3
; Subprogram SUB3
IF (VAR1==1)
; Read PUD
VAR1=VAR1+1
; Read & write PUD
VAR2=1
; Error: LUD from SUB2 not known
ENDIF
M17
Example 3: Definition and use of user variables of data type AXIS
Program code
Comment
DEF AXIS ABSCISSA
; 1st geometry axis
DEF AXIS SPINDLE
; Spindle
IF ISAXIS(1) == FALSE GOTOF CONTINUE
ABSCISSA = $P_AXN1
CONTINUE:
SPINDLE=(S1)
; 1st Spindle
OVRA[SPINDLE]=80
; Spindle override = 80%
SPINDLE=(S3)
; 3rd Spindle
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
401
Work preparation
3.1 Flexible NC programming
Supplementary conditions
Global user variables (GUD)
In the context of the definition of global user variables (GUD), the following machine data has
to be taken into account:
No.
Identifier: $MN_
Meaning
11140
GUD_AREA_ SAVE_TAB
Additional save for GUD blocks
18118 1)
MM_NUM_GUD_MODULES
Number of GUD files in the active file system
18120 1)
MM_NUM_GUD_NAMES_NCK
Number of global GUD names
18130 1)
MM_NUM_GUD_NAMES_CHAN
Number of channel-specific GUD names
18150 1)
MM_GUD_VALUES_MEM
Memory location for global GUD values
18660 1)
MM_NUM_SYNACT_GUD_REAL
Number of configurable GUD of the REAL data
type
18661 1)
MM_NUM_SYNACT_GUD_INT
Number of configurable GUD of the INT data type
18662 1)
MM_NUM_SYNACT_GUD_BOOL
Number of configurable GUD of the BOOL data
type
18663 1)
MM_NUM_SYNACT_GUD_AXIS
Number of configurable GUD of the AXIS data
type
18664 1)
MM_NUM_SYNACT_GUD_CHAR
Number of configurable GUD of the CHAR data
type
18665 1)
MM_NUM_SYNACT_GUD_STRING
Number of configurable GUD of the STRING data
type
1)
For SINUMERIK 828D, MD can only be read!
Cross-channel use of an NC-global user variable of the AXIS data type
An NC-global user variable of the AXIS data type initialized during definition in the data block
with an axis identifier can then only be used in other NC channels if the axis has the same channel
axis number in these channels.
If this is not the case, the variable has to be loaded at the beginning of the NC program or, as in
the following example, the AXNAME(...) function (see "Axis functions (AXNAME, AX, SPI,
AXTOSPI, ISAXIS, AXSTRING, MODAXVAL) (Page 877)") has to be used.
Program code
Comment
DEF NCK STRING[5] ACHSE="X"
;Definition in the data block
N100 AX[AXNAME(AXIS)]=111 G00
; Use in the NC program
3.1.1.6
Redefinition of system data, user data, and NC commands (REDEF)
The REDEF command changes the attributes of system data, user data, and NC commands. A
fundamental condition of redefinition is that it has to post-date the corresponding definition.
Multiple attributes cannot be changed simultaneously during redefinition. A separate REDEF
command must be programmed for each attribute to be changed.
If several concurrent attribute changes are programmed, the last change is always active.
NC programming
402
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Resetting attribute values
The attributes for access rights and initialization time change with REDEF can be reset to their
default values by reprogramming REDEF, followed by the name of the variable or the NC
language command:
• Access rights: Protection level 7
• Initialization time: No initialization or retention of the current value
Redefinable attributes
See "Overview of definable and redefinable attributes (Page 417)".
Local user variables (PUD/LUD)
Redefinitions are not permitted for local user variables (PUD/LUD).
Syntax
REDEF <name>
<PP_stop>
REDEF <name>
<phys_unit>
REDEF <name>
<limit_values>
REDEF <name>
<access_rights>
REDEF <name>
<init_time>
REDEF <name>
<init_time> <init_value>
REDEF <name>
<data class>
REDEF <name>
Meaning
REDEF:
Command for redefinition of a certain attribute or to reset the
"Access rights" and/or "Initialization time" attributes of system
variables, user variables and NC language commands
<name>:
Name of an already defined variable or an NC language com-
mand
<PP stop>:
Preprocessing stop
SYNR:
Preprocessing stop when reading
SYNW:
Preprocessing stop when writing
SYNRW:
Preprocessing stop when reading/writing
<phys_unit>:
Physical unit
PHU <unit>:
Physical unit
See "Attribute: Physical unit (PHU) (Page 410)".
Note
Cannot be redefined for:
• System variables
• Global user data (GUD) of the data types: BOOL, AXIS,
STRING, FRAME
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
403
Work preparation
3.1 Flexible NC programming
<limit values>:
Lower/upper limit
LLI <limit value>:
Lower limit value (lower limit)
ULI <limit value>:
Upper limit value (upper lim-
it)
See "Attribute: Limit values (LLI, ULI) (Page 409)".
Note
Cannot be redefined for:
• System variables
• Global user data (GUD) of the data types: BOOL, AXIS,
STRING, FRAME
<access rights>:
Access rights for reading/writing via part program or OPI
APX <protection level>:
Execute: NC language ele-
ment
APRP <protection level>:
Read: Part program
APWP <protection level>:
Write: Part program
APRB <protection level>:
Read: OPI
APWB <protection level>:
Write: OPI
<protection level>:
Range of values: 0 ... 7
See "Attribute: Access rights (APR, APW, APRP, APWP, APRB,
APWB) (Page 412)".
<init_time>:
Point in time at which the variable is reinitialized
INIPO:
Power On
INIRE:
End of main program, NC reset or Power On
INICF:
NEWCONF or main program end, NC reset or
Power On
PRLOC:
End of main program, NC reset following lo-
cal change or Power On
See "Attribute: Initialization value (Page 406)".
<init_value>:
Initialization value
When redefining the initialization value, an initialization time
always has to be specified also (see <init_time>).
See "Attribute: Initialization value (Page 406)".
For the Initialization of array variables, see "Definition and initi-
alization of array variables (DEF, SET, REP) (Page 418)".
Note
Cannot be redefined for system variables, except setting data.
<data class>:
Data class assignment (only SINUMERIK 828D)
DCM:
Data class M (= Manufacturer)
DCI:
Data class I (= Individual)
DCU:
Data class U (= User)
NC programming
404
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Example
Redefinitions of system variable $TC_DPCx in the data block for machine manufacturers
Program code
%_N_MGUD_DEF
; GUD block: Machine manufacturer
N100 REDEF $TC_DPC1 APWB 2 APWP 3
N200 REDEF $TC_DPC2 PHU 21
N300 REDEF $TC_DPC3 LLI 0 ULI 200
N400 REDEF $TC_DPC4 INIPO (100, 101, 102, 103)
N800 REDEF $TC_DPC1
N900 REDEF $TC_DPC4
M30
regard-
Write access: OPI = protection level 2, part program = protection level 3
ing
N100:
regard-
Physical unit [ % ]
ing
N200:
regard-
Lower limit value = 0, upper limit value = 200
ing
N300:
regard-
The array variable is initialized with the four values at POWER ON.
ing
N400:
regard-
Reset of the "Access rights" and/or "Initialization time" attribute values
ing
N800 /
N900
Note
Use of ACCESS files
If ACCESS files are used, the redefinition of access rights has to be relocated from _N_MGUD_DEF
to _N_MACCESS_DEF.
Supplementary conditions
Granularity
A redefinition is always applied to the entire variable which is uniquely identified by its name.
Array variables do not, for example, support the assignment of different attributes to individual
array elements.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
405
Work preparation
3.1 Flexible NC programming
3.1.1.7
Attribute: Initialization value
Definition (DEF) of user variables
During definition, an initialization value can be preassigned for the following user variables:
• Global user variables (GUD)
• Program-global user variables (PUD)
• Local user variables (LUD)
Redefinition (REDEF) of system and user variables
During redefinition, an initialization value can be preassigned for the following variables:
• System data
- Setting data
• User data
- R parameters
- Synchronized action variables ($AC_MARKER, $AC_PARAM, $AC_TIMER)
- Synchronized action GUD (SYG_xy[ ], where x=R, I, B, A, C, S and y=S, M, U, 4 to 9)
- EPS parameters
- Tool data OEM
- Magazine data OEM
- Global user variables (GUD)
Reinitialization time
During redefinition, the point in time can be specified at which the variable should be
reinitialized, i.e. reset to the initialization value.
• INIPO (POWER ON)
The variable is reinitialized at Power On.
• INIRE (reset)
The variable is reinitialized on NC reset, mode group reset, at the end of the part program
(M02/M30) or at Power On.
• INICF (NEWCONF)
For the function "Set machine data active", the variable is reinitialized via HMI, part program
command NEWCONF or NC reset, mode group reset, part program end (M02 / M30) or a
Power On.
• PRLOC (program-local change)
The variable is only reinitialized on an NC reset, mode group reset or at the end of the part
program (M02/M30) if it has changed during the current part program.
The PRLOC attribute may only be changed in conjunction with programmable setting data
(see the table below).
NC programming
406
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Table 3-1
Programmable setting data
Number
Identifier
G command 1)
42000
$SC_THREAD_START_ANGLE
SF
42010
$SC_THREAD_RAMP_DISP
DITS/DITE
42400
$SA_PUNCH_DWELLTIME
PDELAYON
42800
$SA_SPIND_ASSIGN_TAB
SETMS
43210
$SA_SPIND_MIN_VELO_G25
G25
43220
$SA_SPIND_MAX_VELO_G26
G26
43230
$SA_SPIND_MAX_VELO_LIMS
LIMS
43300
$SA_ASSIGN_FEED_PER_REV_SOURCE
FPRAON
43420
$SA_WORKAREA_LIMIT_PLUS
G26
43430
$SA_WORKAREA_LIMIT_MINUS
G25
43510
$SA_FIXED_STOP_TORQUE
FXST
43520
$SA_FIXED_STOP_WINDOW
FXSW
43700
$SA_OSCILL_REVERSE_POS1
OSP1
43710
$SA_OSCILL_REVERSE_POS2
OSP2
43720
$SA_OSCILL_DWELL_TIME1
OST1
43730
$SA_OSCILL_DWELL_TIME2
OST2
43740
$SA_OSCILL_VELO
FA
43750
$SA_OSCILL_NUM_SPARK_CYCLES
OSNSC
43760
$SA_OSCILL_END_POS
OSE
43770
$SA_OSCILL_CTRL_MASK
OSCTRL
43780
$SA_OSCILL_IS_ACTIVE
OS
43790
$SA_OSCILL_START_POS
OSB
1) This G command addresses the setting data.
Supplementary conditions
Initialization value: Global user variables (GUD)
• Only INIPO (Power On) can be defined as the initialization time for global user variables
(GUD) with the NC range of validity.
• In addition to INIPO (Power On), INIRE (reset) or INICF (NEWCONF) can be defined as the
initialization time for global user variables (GUD) with the CHAN range of validity.
• In the case of global user variables (GUD) with the CHAN range of validity and INIRE (reset)
or INICF (NEWCONF) initialization time, for an NC reset, mode group reset and "Activate
machine data", the variables are only reinitialized in the channels in which the named events
were triggered.
Initialization value: FRAME data type
It is not permitted to specify an initialization value for variables of the FRAME data type. Variables
of the FRAME data type are initialized implicitly and always with the default frame.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
407
Work preparation
3.1 Flexible NC programming
Initialization value: CHAR data type
For variables of the CHAR data type, instead of the ASCII code (0...255), the corresponding ASCII
character can be programmed in quotation marks, e.g. "A".
Initialization value: Data type STRING
In the case of variables of the STRING data type, the character string must be enclosed in
quotation marks, e.g
= "MACHINE_1"
Initialization value: AXIS data type
In the case of variables of the AXIS data type, for an extended address notation, the axis
identifier must be enclosed in brackets, e.g
=(X3).
Initialization value: System variable
For system variables, redefinition cannot be used to define user-specific initialization values. The
initialization values for the system variables are specified by the system and cannot be changed.
However, redefinition can be used to change the point in time (INIRE, INICF) at which the
system variable is reinitialized.
Implicit initialization value: AXIS data type
For variables of the AXIS data type the following implicit initialization value is used:
• System data: "First geometry axis"
• Synchronized action GUD (designation: SYG_A*), PUD, LUD:
axis designation from the machine data: MD20082
$MC_AXCONF_CHANAX_DEFAULT_NAME
Implicit initialization value: Tool and magazine data
Initialization values for tool and magazine data can be defined using the following machine data:
MD17520 $MN_TOOL_DEFAULT_DATA_MASK
Note
Synchronization
The synchronization of events triggering the reinitialization of a global variable when this
variable is read in a different location is the sole responsibility of the user / machine
manufacturer.
See also
Variables (Page 389)
NC programming
408
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
3.1.1.8
Attribute: Limit values (LLI, ULI)
An upper and a lower limit of the definition range can only be defined for the following data
types:
• INT
• REAL
• CHAR
Definition (DEF) of user variables: Limit values and implicit initialization values
If no explicit initialization value is defined when defining a user variable of one of the above data
types, the variable is set to the data type's implicit initialization value.
• INT: 0
• REAL: 0.0
• CHAR: 0
If the implicit initialization value is outside the definition range specified by the programmed
limit values, the variable is initialized with the limit value which is closest to the implicit
initialization value:
• Implicit initialization value < lower limit value (LLI) ⇒
initialization value = lower limit value
• Implicit initialization value > upper limit value (ULI) ⇒
initialization value = upper limit value
Examples:
Program code
Comment
DEF REAL GUD1
; Lower limit value = definition range limit
; Upper limit value = definition range limit
; No initialization value programmed
; => Implicit initialization value = 0.0
DEF REAL LLI 5.0 GUD2
; Lower limit value = 5.0
; Upper limit value = definition range limit
; => Initialization value = 5.0
DEF REAL ULI -5 GUD3
; Lower limit value = definition range limit
; Upper limit value = -5.0
; => Initialization value = -5.0
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
409
Work preparation
3.1 Flexible NC programming
Redefinition (REDEF) of user variables: Limit values and current actual values
If the limit values of a user variable are redefined, they change to the extent that the current
actual value is outside the new definition range, an alarm will be issued and the limit values will
be rejected.
Note
Redefinition (REDEF) of user variables
If the limit values of a user variable are redefined, care must be taken to ensure that the following
values are changed consistently:
• Limit values
• Actual value
• Initialization value on redefinition and automatic reinitialization on the basis of INIPO, INIRE
or INICF
See also
Variables (Page 389)
3.1.1.9
Attribute: Physical unit (PHU)
A physical unit can only be specified for variables of the following data types:
• INT
• REAL
Programmable physical units (PHU)
The physical unit is specified as fixed point number: PHU <unit>
The following physical units can be programmed:
<unit>
Meaning
Physical unit
0
Not a physical unit
-
1
Linear or angular position 1)2)
[ mm ], [ inch ], [ degree ]
2
Linear position 2)
[ mm ], [ inch ]
3
Angular position
[ degree ]
4
Linear or angular velocity 1)2)
[ mm/min ], [ inch/min ], [ rpm ]
5
Linear velocity 2)
[ mm/min ]
6
Angular velocity
[ rpm ]
7
Linear or angular acceleration 1)2)
[ m/s2 ], [ inch/s2 ], [ rev/s2 ]
8
Linear acceleration 2)
[ m/s2 ], [ inch/s2 ]
9
Angular acceleration
[ rev/s2 ]
10
Linear or angular jerk 1)2)
[ m/s3 ], [ inch/s3 ], [ rev/s3 ]
11
Linear jerk 2)
[ m/s3 ], [ inch/s3 ]
12
Angular jerk
[ rev/s3 ]
NC programming
410
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
<unit>
Meaning
Physical unit
13
Time
[ s ]
14
Position controller gain
[ 16.667/s ]
15
Revolutional feedrate 2)
[ mm/rev ], [ inch/rev ]
16
Temperature compensation 1)2)
[ mm ], [ inch ]
18
Force
[ N ]
19
Mass
[ kg ]
20
Moment of inertia 3)
[ kgm2 ]
21
Percent
[ % ]
22
Frequency
[ Hz ]
23
Voltage
[ V ]
24
Current
[ A ]
25
Temperature
[ °C ]
26
Angle
[ degree ]
27
KV
[ 1000/min ]
28
Linear or angular position 3)
[ mm ], [ inch ], [ degree ]
29
Cutting rate 2)
[ m/min ], [ feet/min ]
30
Peripheral speed 2)
[ m/s], [ feet/s ]
31
Resistance
[ ohm ]
32
Inductance
[ mH ]
33
Torque 3)
[ Nm ]
34
Torque constant 3)
[ Nm/A ]
35
Current controller gain
[ V/A ]
36
Speed controller gain 3)
[ Nm/(rad*s) ]
37
Speed
[ rpm ]
42
Power
[ kW ]
43
Current, low
[ μA ]
46
Torque, low 3)
[ μNm ]
48
Per mil
-
49
-
[ Hz/s ]
65
Flow rate
[ l/min ]
66
Pressure
[ bar ]
67
Volume 3)
[ cm3 ]
68
Controlled-system gain 3)
[ mm/(V*min) ]
69
Force controller controlled-system gain
[ N/V ]
155
Thread lead 3)
[ mm/rev ], [ inch/rev ]
156
Change in thread lead 3)
[ mm/rev / rev ], [ inch/rev / rev ]
1) The physical unit depends on the axis type: Linear or rotary axis
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
411
Work preparation
3.1 Flexible NC programming
<unit>
Meaning
Physical unit
2) System of units changeover
G70/G71(inch/metric)
After changing over the basic system (MD10240 $MN_SCALING_SYSTEM_IS_METRIC) with G70/G71, for
read/write operations to system and user variables involving a length, then the values are not converted
(actual value, default value and limit values)
G700/G710(inch/metric)
After changing over the basic system (MD10240 $MN_SCALING_SYSTEM_IS_METRIC) with G700/G710,
for read/write operations to system and user variables involving a length, then the values are converted
(actual value, default value and limit values)
3) The variable is not converted to the NC's current measuring system (inch/metric) automatically. Con-
version is the sole responsibility of the user/machine manufacturer.
Note
Level overflow due to format conversion
The internal storage format for all user variables (GUD/PUD/LUD) with physical units of length is
metric. Excessive use of these types of variable in the NCK's main run, e.g. in synchronized
actions, can lead to a CPU time overflow at interpolation level when the measuring system is
switched over, generating alarm 4240.
Note
Compatibility of units
When using variables (assignment, comparison, calculation, etc.) the compatibility of the units
involved is not checked. Should conversion be required, this is the sole responsibility of the user /
machine manufacturer.
See also
Variables (Page 389)
3.1.1.10
Attribute: Access rights (APR, APW, APRP, APWP, APRB, APWB)
Designation
The designation of the access attribute AP... comprises:
1. A: Access
2. P: Protection
3. R / W: Read / Write
4. P / O: Program / BTSS (OPI)
NC programming
412
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Access rights / access levels
The following access levels, which have to be specified during programming, correspond to the
access rights:
Access right
Protection level
System password
0
Machine manufacturer password
1
Service password
2
User password
3
Key-operated switch position 3
4
Key-operated switch position 2
5
Key-operated switch position 1
6
Key-operated switch position 0
7
Definition (DEF) of user data
Access rights (APR.../APW...) can be defined for the following data:
• Global user data (GUD)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
413
Work preparation
3.1 Flexible NC programming
Redefinition (REDEF) of system and user data
Access rights (APR.../APW...) can be redefined for the following data:
•
System data
- Machine data
Note
Redefinition of reading rights of machine data
The protection level for reading machine data can only be set with keyword APR for the
part program and OPI.
The keywords APRP and APRB are not supported by the redefinition of the reading rights,
and result in alarm 12490 "Access right APRP/APRB <protection level> was not set".
- Setting data
- System variable
- Process data
- Magazine data
- Tool data
•
User data
- R parameters
- Synchronized action variables ($AC_MARKER, $AC_PARAM, $AC_TIMER)
- Synchronized action GUD (SYG_xy[ ], where x=R, I, B, A, C, S and y=S, M, U, 4 to 9)
- EPS parameters
- Tool data OEM
- Magazine data OEM
- Global user variables (GUD)
Note
During redefinition the access right can be freely assigned to a variable between the
lowest protection level 7 and the dedicated protection level, e.g. 1 (machine
manufacturer).
Redefinition (REDEF) of NC language commands
The access or execution right (APX) can be redefined for the following NC language commands:
• G commands / preparatory functions (Page 170)
• Predefined functions (Page 1333)
• Predefined subprogram calls
• DO operation with synchronized actions
• Cycles program identifier
The cycle must be saved in a cycle directory and must contain a PROC operation.
NC programming
414
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Access rights in relation to NC programs and cycles (APRP, APWP)
The various access rights facilitate the following with regard to access from an NC program or
cycle:
•
APRP 0/APWP 0
- During NC program processing the system password has to be set.
- The cycle has to be stored in the _N_CST_DIR directory (system).
- The execution right must be set to system for the _N_CST_DIR directory in MD11160
$MN_ACCESS_EXEC_CST.
•
APRP 1/APWP 1 or APRP 2/APWP 2
- During NC program processing the machine manufacturer or service password has to be
set.
- The cycle has to be stored in the _N_CMA_DIR (machine manufacturer) or _N_CST_DIR
directory.
- The execution rights must be set to at least machine manufacturer for the _N_CMA_DIR
or _N_CST_DIR directories in machine data MD11161 $MN_ACCESS_EXEC_CMA or
MD11160 $MN_ACCESS_EXEC_CST respectively.
•
APRP 3/APWP 3
- During NC program execution, the user password must be set.
- The cycle has to be stored in the _N_CUS_DIR (user), _N_CMA_DIR or _N_CST_DIR
directory.
- The execution rights must be set to at least user for the _N_CUS_DIR, _N_CMA_DIR or
_N_CST_DIR directories in machine data MD11162 $MN_ACCESS_EXEC_CUS, MD11161
$MN_ACCESS_EXEC_CMA or MD11160 $MN_ACCESS_EXEC_CST respectively.
•
APRP 4...7 / APWP 4...7
- During NC program processing the key-operated switch must be set to 3 ... 0.
- The cycle has to be stored in directory _N_CUS_DIR, _N_CMA_DIR or in directory
_N_CST_DIR.
- The execution rights must be set to at least the corresponding key-operated switch
position for the _N_CUS_DIR, _N_CMA_DIR or _N_CST_DIR directories in machine data
MD11162 $MN_ACCESS_EXEC_CUS, MD11161 $MN_ACCESS_EXEC_CMA or MD11160
$MN_ACCESS_EXEC_CST respectively.
Access rights in relation to OPI (APRB, APWB)
The access rights (APRB, APWB) restrict access to system and user variables via the OPI equally
for all system components (HMI, PLC, external computers, EPS services, etc.).
Note
Local HMI access rights
When changing access rights to system data, care must be taken to ensure that such changes are
consistent with the access rights defined using HMI mechanisms.
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
415
Work preparation
3.1 Flexible NC programming
APR/APW access attributes
For compatibility reasons, attributes APR and APW are implicitly mapped to the attributes APRP /
APRB and APWP / APWB:
• APR x ⇒ APRP x APRB x
• APW y ⇒ APWP y APWB y
Access rights using ACCESS files
When using ACCESS files to assign access rights, access rights for system data, user data, and NC
language commands must only be redefined in ACCESS files. Global user data (GUD) is an
exception. For this data, access rights still have to be redefined in the corresponding definition
files *_DEF.
For continuous access protection, the machine data for the execution rights and the access
protection for the corresponding directories have to be modified consistently.
In principle, the procedure is as follows:
1.
Creation of the necessary definition files:
- _N_DEF_DIR/_N_SACCESS_DEF
- _N_DEF_DIR/_N_MACCESS_DEF
- _N_DEF_DIR/_N_UACCESS_DEF
2.
Setting of the write right for the definition files to the value required for redefinition:
- MD11170 $MN_ACCESS_WRITE_SACCESS = <protection level>
- MD11171 $MN_ACCESS_WRITE_MACCESS = <protection level>
- MD11172 $MN_ACCESS_WRITE_UACCESS = <protection level>
3.
For access to protected elements from cycles, the execution and write rights for cycle
directories _N_CST_DIR, _N_CMA_DIR, and _N_CST_DIR have to be modified.
Execution rights
- MD11160 $MN_ACCESS_EXEC_CST = <protection level>
- MD11161 $MN_ACCESS_EXEC_CMA = <protection level>
- MD11162 $MN_ACCESS_EXEC_CUS = <protection level>
Write rights
- MD11165 $MN_ACCESS_WRITE_CST = <protection level>
- MD11166 $MN_ACCESS_WRITE_CMA = <protection level>
- MD11167 MN_ACCESS_WRITE_CUS = <protection level>
The execution right has to be set to at least the same protection level as the highest
protection level of the element used.
The write right must be set to at least the same protection level as the execution right.
4.
The write rights of the local HMI cycle directories must be set to the same protection level as
the local NC cycle directories.
NC programming
416
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
Subprogram calls in ACCESS files
To structure access protection further, subprograms (SPF or MPF identifier) can be called in
ACCESS files. The subprograms inherit the execution rights of the calling ACCESS file.
Note
Only access rights can be redefined in the ACCESS files. All other attributes have to continue to be
programmed/redefined in the corresponding definition files.
See also
Variables (Page 389)
3.1.1.11
Overview of definable and redefinable attributes
The following tables show which attributes can be defined (DEF) and/or redefined (REDEF) for
which data types.
System data
Data type
Init. value
Limit values
Physical unit
Access rights
Data class
(only 828D)
Machine data
---
---
---
REDEF
REDEF
Setting data
REDEF
---
---
REDEF
---
FRAME data
---
---
---
REDEF
---
Process data
---
---
---
REDEF
---
Leadscrew error comp. (EEC)
---
---
---
REDEF
---
Sag compensation (CEC)
---
---
---
REDEF
---
Quadrant error compensation (QEC)
---
---
---
REDEF
---
Magazine data
---
---
---
REDEF
---
Tool data
---
---
---
REDEF
---
Protection areas
---
---
---
REDEF
---
Toolholder, with orientation capabili-
---
---
---
REDEF
---
ty
Kinematic chains
---
---
---
REDEF
---
3D protection areas
---
---
---
REDEF
---
Working area limitation
---
---
---
REDEF
---
User data
Data type
Init. value
Limit values
Physical unit
Access rights
Data class
R-parameters
REDEF
REDEF
REDEF
REDEF
---
Synchronized action variable
REDEF
REDEF
REDEF
REDEF
---
($AC_...)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
417
Work preparation
3.1 Flexible NC programming
Data type
Init. value
Limit values
Physical unit
Access rights
Data class
Synchronized action GUD (SYG_...)
REDEF
REDEF
REDEF
REDEF
---
EPS parameters
REDEF
REDEF
REDEF
REDEF
---
Tool data OEM
REDEF
REDEF
REDEF
REDEF
---
Magazine data OEM
REDEF
REDEF
REDEF
REDEF
---
Global user variables (GUD)
DEF/REDEF
DEF
DEF
DEF/REDEF
DEF/REDEF
Local user variables (PUD/LUD)
DEF
DEF
DEF
---
---
See also
Variables (Page 389)
3.1.1.12
Definition and initialization of array variables (DEF, SET, REP)
A user variable can be defined as a 1- up to a maximum of a 3-dimensional array.
•
1-dimensional: DEF <data type> <variable name>[<n>]
•
2-dimensional: DEF <data type> <variable name>[<n>,<m>]
•
3-dimensional: DEF <data type> <variable name>[<n>,<m>,<o>]
Note
STRING data type user variables can be defined as up to a maximum of 2-dimensional arrays.
Data types
User variables can be defined as arrays for the following data types: BOOL, CHAR, INT, REAL,
STRING, AXIS, FRAME
Assignment of values to array elements
Values can be assigned to array elements at the following points in time:
• During array definition (initialization values)
• During program execution
Values can be assigned by means of:
• Explicit specification of an array element
• Explicit specification of an array element as a starting element and specification of a value list
(SET)
• Explicit specification of an array element as a starting element and specification of a value
and the frequency at which it is repeated (REP)
Note
FRAME data type user variables cannot be assigned initialization values.
Syntax (DEF)
DEF <data type> <variable name>[<n>,<m>,<o>]
NC programming
418
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
DEF STRING[<string length>] <variable name>[<n>,<m>]
Syntax (DEF...=SET...)
Using a value list:
• During definition:
DEF <data type> <variable
name>[<n>,<m>,<o>]=SET(<value1>,<value2>, etc.)
Equivalent to:
DEF <data type> <variable name>[<n>,<m>,<o>]=(<value1>,<value2>,
etc.)
Note
SET does not have to be specified for initialization via a value list.
• During value assignment:
<variable name>[<n>,<m>,<o>]=SET(<VALUE1>,<value2>, etc.)
Syntax (DEF...=REP...)
Using a value with repetition
• During definition:
DEF <data type> <variable name>[<n>,<m>,<o>]=REP(<value>)
DEF <data type> <variable name>[<n>,<m>,<o>]=REP(<value>,
<number_array_elements>)
• During value assignment:
<variable name>[<n>,<m>,<o>]=REP(<value>)
DEF <data type> <variable
name>[<n>,<m>,<o>]=REP(<value>,<number_array_elements>)
Meaning
DEF:
Command to define variables
<data type>:
Data type of variables
Range of values:
• for system variables:
BOOL, CHAR, INT, REAL, STRING, AXIS
• for GUD or LUD variables:
BOOL, CHAR, INT, REAL, STRING, AXIS, FRAME
<string length>:
Maximum number of characters for a STRING data type
<variable name>:
Variable name.
[<n>,<m>,<o>]:
Array sizes or array indices
<n>:
Array size or array index for 1st dimension
Type:
INT (for system variables, also AXIS)
Range of values:
Max. array size: 65535
Array index: 0 ≤ n ≤ 65534
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
419
Work preparation
3.1 Flexible NC programming
<m>:
Array size or array index for 2nd dimension
Type:
INT (for system variables, also AXIS)
Range of values:
Max. array size: 65535
Array index: 0 ≤ m ≤ 65534
<o>:
Array size or array index for 3rd dimension
Type:
INT (for system variables, also AXIS)
Range of values:
Max. array size: 65535
Array index: 0 ≤ o ≤ 65534
SET:
Value assignment using specified value list
(<value1>,<value2>, etc.):
Value list
REP:
Value assignment using specified <value>
<value>:
Value, which the array elements should be written when in-
itializing with REP.
<number_array_elements>:
Number of array elements to be written with the speci-
fied <value>. The following apply to the remaining array
elements, dependent on the point in time:
• Initialization when defining the array:
→ Zero is written to the remaining array elements.
• Assignment during program execution:
→ The actual values of the array elements remain un-
changed.
If the parameter is not programmed, all array elements are
written with <value>.
If the parameter equals zero, the following apply dependent
on the point in time:
• Initialization when defining the array:
→ All elements are pre-assigned zero
• Assignment during program execution:
→ The actual values of the array elements remain un-
changed.
Array index
The implicit sequence of the array elements, e.g. in the case of value assignment using SET or
REP, is right to left due to iteration of the array index.
Example: Initialization of a 3-dimensional array with 24 array elements:
DEF INT FELD[2,3,4] = REP(1,24)
FELD[0,0,0] = 1
1. array element
FELD[0,0,1] = 1
2. array element
FELD[0,0,2] = 1
3. array element
FELD[0,0,3] = 1
4. array element
FELD[0,1,0] = 1
5. array element
FELD[0,1,1] = 1
6. array element
NC programming
420
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
Work preparation
3.1 Flexible NC programming
FELD[0,2,3] = 1
12. array element
FELD[1,0,0] = 1
13. array element
FELD[1,0,1] = 1
14. array element
FELD[1,2,3] = 1
24. array element
corresponding to:
FOR n=0 TO 1
FOR m=0 TO 2
FOR o=0 TO 3
FELD[n,m,o] = 1
ENDFOR
ENDFOR
ENDFOR
Example: Initializing complete variable arrays
For the actual assignment, refer to the diagram.
Program code
N10 DEF REAL FELD1[10,3]=SET(0,0,0,10,11,12,20,20,20,30,30,30,40,40,40,)
N20 ARRAY1[0,0] = REP(100)
N30 ARRAY1[5,0] = REP(-100)
N40 FELD1[0,0]=SET(0,1,2,-10,-11,-12,-20,-20,-20,-30, , , ,-40,-40,-50,-60,-70)
N50 FELD1[8,1]=SET(8.1,8.2,9.0,9.1,9.2)
NC programming
Programming Manual, 10/2020, 6FC5398-2EP40-0BA1
421

 

 

 

 

 

 

 

Content      ..     4      5      6      7     ..