Control
SINUMERIK 840D sl / 840DE sl
SINUMERIK 828D
Software Version
CNC software 4.5 SP2
Preface
Flexible NC programming
File and Program
Management
Protection zones
Special motion commands
Coordinate transformations
(frames)
Transformations
Kinematic chains
Collision avoidance with
kinematic chains
Tool offsets
Path traversing behavior
Axis couplings
Synchronized actions
Oscillation
Punching and nibbling
Grinding
Additional functions
User stock removal
programs
Programming cycles
externally
Tables
Appendix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
A
03/2013
6FC5398-2BP40-3BA1
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Siemens AG
Industry Sector
Postfach 48 48
90026 NÜRNBERG
GERMANY
Order number: 6FC5398-2BP40-3BA1
Ⓟ 04/2013 Technical data subject to change
You can find Frequently Asked Questions in the Service&Support pages under Product
Support. http://support.automation.siemens.com
SINUMERIK
You can find information on SINUMERIK under the following link:
www.siemens.com/sinumerik
Target group
This publication is intended for:
● Programmers
● Project engineers
Benefits
With the programming manual, the target group can develop, write, test, and debug
programs and software user interfaces.
Standard scope
This Programming Manual describes the functionality afforded by standard functions.
Extensions or changes made by the machine tool manufacturer are documented by the
machine tool manufacturer.
Other functions not described in this documentation might be executable in the control. This
does not, however, represent an obligation to supply such functions with a new control or
when servicing.
Further, for the sake of simplicity, this documentation does not contain all detailed
information about all types of the product and cannot cover every conceivable case of
installation, operation or maintenance.
Technical Support
You will find telephone numbers for other countries for technical support in the Internet under
http://www.siemens.com/automation/service&support
Job Planning
4Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Preface
Information on structure and contents
"Fundamentals" and "Job planning" Programming Manual
The description of the NC programming is divided into two manuals:
1. Fundamentals
The "Fundamentals" Programming Manual is intended for use by skilled machine
operators with the appropriate expertise in drilling, milling and turning operations. Simple
programming examples are used to explain the commands and statements which are
also defined according to DIN 66025.
2. Job planning
This "Job planning" Programming Manual is intended for use by technicians with in-depth,
comprehensive programming knowledge. By virtue of a special programming language,
the SINUMERIK control enables the user to program complex workpiece programs (e.g.
for free-form surfaces, channel coordination, ...) and makes programming of complicated
operations easy for technologists.
Availability of the described NC language elements
All NC language elements described in the manual are available for the SINUMERIK
840D sl. The availability regarding SINUMERIK 828D can be found in table "Operations:
Availability for SINUME
The use of variables, especially in conjunction with arithmetic functions and check structures,
enables part programs and cycles to be set up with extremely high levels of flexibility. The
system provides three different types of variables.
● System variables
System variables are variables with a fixed predefined meaning; they are defined in the
system and made available to the user. They are also read and written by the system
software. Example: Machine data
The meaning of a system variable is permanently set by the system. However, minor
modifications can be made to the properties by the user in the form of redefinition. See
"Redefinition of system variables, user variables, and NC language
(Page 29)"
● User variable
User variables are variables whose meaning is not known to the system; they are not
evaluated by the system. The meaning is defined exclusively by the user.
User variables are subdivided into:
s
ands (REDEF)
comm
1
– Predefined user variables
Predefined user variables are variables which have already been defined in the
system and whose number simply has to be parameterized by the user via specific
machine data. The user can make significant changes to the properties of these
variables. See "Redefinition of system variables, user variables, and NC language
comm
ands (REDEF) (Page 29)".
– User-defined
User-defined variables are variables which are defined exclusively 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 24)"
1.1.1 System variable
System variables are variables which 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 part programs and cycles.
Preprocessing variables are system variables that are read and written in the context of
preprocessing; in other words, at the point in time at which the part program block in which
the system variable is programmed is interpreted. Preprocessing variables do not trigger
preprocessing stops.
Main run variables
Main run variables are system variables which are read and written in the context of the main
run; in other words at the point in time at which the part program block in which the system
variable is programmed is executed. The following are main run variables:
● System variables which can be programmed in synchronized actions (read/write)
● System variables which can be programmed in the part program and trigger
preprocessing stops (read/write)
● System variables which can be programmed in the part program and whose value is
calculated during preprocessing but not written until the main run (main run synchronized:
write only)
Prefix system
In order that they can be specifically identified, the names of system variables are usually
preceded by a prefix comprising the $ sign followed by one or two letters and an underscore.
$ + 1st letter Meaning: Data type
System variables which are read/written during preprocessing
$M Machine data 1)
$S Setting data, protection zones 1)
$T Tool management data
$P Programmed values
$C Cycle variables of ISO envelope cycles
$O Option data
R R-parameters (arithmetic parameters) 2)
System variables which are read/written during the main run
$$M Machine data 1)
$$S Setting data 1)
$A Current main run data
$V Servo data
$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.
Job Planning
18Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Flexible NC programming
1.1 Variables
2nd letter Meaning: Visibility
N NCK-global variable (NCK)
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.
References
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 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.
A list of the properties of all system variables appears in:
1.1.2 Predefined user variables: Arithmetic parameters (R)
Function
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.
Syntax
Meaning
When using synchronized actions, the $ sign must be included as a prefix, e.g.
$R10.
When used as a preprocessing variable:
R<n>
R[<expression>]
When used as a main run variable:
$R<n>
$R[<expression>]
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: <Mantisse>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).
Job Planning
20Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Flexible NC programming
1.1 Variables
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 main run: R4 = -0.1 * 10^-5
$R[6]=1.874EX8 ; Assignment in main 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 17)
1.1.3 Predefined user variables: Link variables
Function
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 controller
as additional global user variables alongside global user variables (GUD).
Link variable for BYTE data format (1 byte)
Data type: UINT
Range of values: 0 ... 255
Link variable for WORD data format (2 bytes)
Data type: INT
Range of values: -32768 ... 32767
Link variable for DWORD data format (4 bytes)
Data type: INT
Range of values: -2147483648 ... 2147483647
Link variable for REAL data format (8 bytes)
Data type: REAL
Range of values: ±(2.2*10
-308
… 1.8*10
+308
)
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_SIZEOF_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 2 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 transmitted via link communication cyclically
and displays alarm 61000 if the limit value is exceeded.
Job Planning
22Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Flexible NC programming
1.1 Variables
The data structure in the link variables memory is illustrated in the following figure. The
actual current value is transmitted in the REAL value.
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 from 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.
The DEF command is used to define user-specific variables and assign values to them. To set
them apart from system variables, these are called user-defined variables or user variables
(user data).
According to the range of validity (in other words, the range in which the variable is visible)
there are the following categories of user variable:
● Local user variables (LUD)
Local user variables (LUD) are variables defined in a part program which is not the main
program at the time of execution. They are created when the part program is called and
deleted at the end of the part program or when the NC is reset. Local user variables can
only be accessed within the part program in which they are defined.
● Program-global user variables (PUD)
Program-global user variables (PUD) are user variables defined in a part program used
as the main program. They are created when the part program starts up and deleted at
the end of the part program or when the NC is reset. It is possible to access PUD in the
main program and in all subprograms of the main program.
Syntax
● 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 retained following shutdown
and restart. GUD can be accessed in all part programs.
User variables must be defined before they can be used (read/write). The following rules
must be observed in this context:
● GUD have to be defined in a definition file, e.g. _N_DEF_DIR/_M_SGUD_DEF.
● PUD and LUD have to be defined in a definition section of the part 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.
DEF: Command for defining GUD, PUD, LUD user variables
<range>:
<PP_stop>:
<access rights>:
<type>:
<phys_unit>:
<limit values>:
Range of validity, only relevant for GUD:
NCK: NC-global user variable
CHAN: Channel-global user variable
Preprocessing stop, only relevant for GUD (optional)
SYNR: Preprocessing stop when reading
SYNW: Preprocessing stop when writing
SYNRW: Preprocessing stop when reading/writing
Protection level for reading/writing GUD via part program or OPI
(optional)
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 39)"
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
transformation
See "Data types (Page 52)"
Physical unit (optional)
PHU <unit>: Physical unit
See "Attribute: Physical unit (PHU) (Page 37)"
Lower/upp
LLI <limit value>: Lower limit value (lower limit)
ULI <limit value>: Upper limit value (upper limit)
er limit value (optional)
See "Attribute: Limit values (LLI, ULI) (Page 35)"
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>,
<value_2>,
<value_3>]
:
Specification of array sizes for 1- to max. 3-dimensional array
variables (optional)
For the Initialization of array variables see "Definition and
initialization of array
<init_value>: Initialization value (optional)
variables (DEF, SET, REP) (Page 45)"
See "Attribute: Initialization value (Page 32)"
For the Initializa
initialization of array
tion of array variables see "Definition and
variables (DEF, SET, REP) (Page 45)"
Examples
Example 1: Definition of user variables in the data block for machine manufacturers
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
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-spec. GUD names
18140 1) MM_NUM_GUD_NAMES_AXIS Number of axis-spec. 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!
Job Planning
28Programming Manual, 03/2013, 6FC5398-2BP40-3BA1
Flexible NC programming
1.1 Variables
Program-global user variables (PUD)
Note
Visibility of program-global user variables (PUD)
Program-global user variables (PUD) defined in the main program will only be visible 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
visible in the main program.
Cross-channel use of an NCK-global user variable of the AXIS data type
An NCK-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 start of the part program or, as in
the following example, the AXNAME(...) function has to be used.
Program code Comment
DEF NCK STRING[5] ACHSE="X" ;Definition in the data block
...
N100 AX[AXNAME(ACHSE)]=111 G00 ;Use in the part program
1.1.5 Redefinition of system variables, user variables, and NC language commands
(REDEF)
Function
The REDEF command can be used to change the attributes of system variables, user
variables and NC language 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
statement has to be programmed for each attribute to be changed.
If two or more concurrent attribute changes are programmed, the last change is always
active.