|
|
Preface
Fundamental safety
1
instructions
2
Flexible NC programming
File and Program
SINUMERIK
3
Management
Protection zones
4
SINUMERIK 840D sl
5
Job Planning
Special motion commands
Coordinate transformations
6
(frames)
7
Programming Manual
Transformations
8
Kinematic chains
Collision avoidance with
9
kinematic chains
Transformation with
10
kinematic chains
11
Tool offsets
12
Path traversing behavior
13
Axis couplings
14
Synchronized actions
15
Oscillation
Punching and nibbling
16
17
Grinding
18
Additional functions
Valid for
19
User stock removal programs
Control
SINUMERIK 840D sl / 840DE sl
Programming cycles
20
externally
CNC software Version 4.91
21
Tables
12/2018
A5E40869460B AB
A
Appendix
Table of contents
Preface
3
1
Fundamental safety instructions
17
1.1
General safety instructions
17
1.2
Warranty and liability for application examples
18
1.3
Industrial security
19
2
Flexible NC programming
21
2.1
Variables
21
2.1.1
System data
22
2.1.2
Predefined user variables: Arithmetic parameters
24
2.1.2.1
Channel-specific arithmetic parameters (R)
24
2.1.2.2
Global arithmetic parameters (RG)
25
2.1.3
Predefined user variables: Link variables
27
2.1.4
Definition of user variables (DEF)
29
2.1.5
Redefinition of system data, user data, and NC commands (REDEF)
35
2.1.6
Attribute: Initialization value
38
2.1.7
Attribute: Limit values (LLI, ULI)
41
2.1.8
Attribute: Physical unit (PHU)
43
2.1.9
Attribute: Access rights (APR, APW, APRP, APWP, APRB, APWB)
45
2.1.10
Attribute: Data class (DCM, DCI, DCU) - only SINUMERIK 828D
49
2.1.11
Overview of definable and redefinable attributes
50
2.1.12
Definition and initialization of array variables (DEF, SET, REP)
52
2.1.13
Definition and initialization of array variables (DEF, SET, REP): Further Information
56
2.1.14
Data types
58
2.1.15
Check availability of a variable (ISVAR)
59
2.1.16
Reading attribute values / data type (GETVARPHU, GETVARAP, GETVARLIM,
GETVARDIM, GETVARDFT, GETVARTYP)
60
2.2
Indirect programming
66
2.2.1
Indirectly programming addresses
66
2.2.2
Indirectly programming G commands
68
2.2.3
Indirectly programming position attributes (GP)
69
2.2.4
Indirectly programming part program lines (EXECSTRING)
72
2.3
Arithmetic functions
73
2.4
Comparison and logic operations
76
2.5
Precision correction on comparison errors (TRUNC)
78
2.6
Variable minimum, maximum and range (MINVAL, MAXVAL and BOUND)
80
2.7
Priority of the operations
82
2.8
Possible type conversions
83
2.9
String operations
84
2.9.1
Type conversion to STRING (AXSTRING)
84
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
7
Table of contents
2.9.2
Type conversion from STRING (NUMBER, ISNUMBER, AXNAME)
85
2.9.3
Concatenation of strings (<<)
86
2.9.4
Conversion to lower/upper case letters (TOLOWER, TOUPPER)
87
2.9.5
Determine length of string (STRLEN)
88
2.9.6
Search for character/string in the string (INDEX, RINDEX, MINDEX, MATCH)
89
2.9.7
Selection of a substring (SUBSTR)
90
2.9.8
Reading and writing of individual characters
91
2.9.9
Formatting a string (SPRINT)
92
2.10
Program jumps and branches
101
2.10.1
Return jump to the start of the program (GOTOS)
101
2.10.2
Program jumps to jump markers (GOTOB, GOTOF, GOTO, GOTOC)
102
2.10.3
Program branch (CASE ... OF ... DEFAULT ...)
105
2.11
Repeat program section (REPEAT, REPEATB, ENDLABEL, P)
107
2.12
Check structures
113
2.12.1
Conditional statement and branch (IF, ELSE, ENDIF)
114
2.12.2
Continuous program loop (LOOP, ENDLOOP)
116
2.12.3
Count loop (FOR ... TO ..., ENDFOR)
116
2.12.4
Program loop with condition at start of loop (WHILE, ENDWHILE)
118
2.12.5
Program loop with condition at the end of the loop (REPEAT, UNTIL)
118
2.12.6
Program example with nested check structures
119
2.13
Coordination commands (INIT, START, WAITM, WAITMC, WAITE, SETM, CLEARM)
120
2.14
Interrupt routine (ASUB)
125
2.14.1
Function of an interrupt routine
125
2.14.2
Creating an interrupt routine
126
2.14.3
Assign and start interrupt routine (SETINT, PRIO, BLSYNC)
127
2.14.4
Deactivating/reactivating the assignment of an interrupt routine (DISABLE, ENABLE)
129
2.14.5
Delete assignment of interrupt routine (CLRINT)
129
2.14.6
Fast retraction from the contour (SETINT LIFTFAST, ALF)
130
2.14.7
Traversing direction for fast retraction from the contour
132
2.14.8
Motion sequence for interrupt routines
135
2.15
Axis replacement, spindle replacement (RELEASE, GET, GETD)
137
2.16
Transfer axis to another channel (AXTOCHAN)
142
2.17
Activate machine data (NEWCONF)
144
2.18
Write file (WRITE)
145
2.19
Delete file (DELETE)
149
2.20
Read lines in the file (READ)
150
2.21
Check for presence of file (ISFILE)
152
2.22
Read out file information (FILEDATE, FILETIME, FILESIZE, FILESTAT, FILEINFO)
153
2.23
Roundup (ROUNDUP)
155
2.24
Subprogram technique
156
2.24.1
General information
156
2.24.1.1
Subprogram
156
2.24.1.2
Subprogram names
157
2.24.1.3
Nesting of subprograms
158
2.24.1.4
Search path
159
Job Planning
8
Programming Manual, 12/2018, A5E40869460B AB
Table of contents
2.24.1.5
Formal and actual parameters
159
2.24.1.6
Parameter transfer
160
2.24.2
Definition of a subprogram
162
2.24.2.1
Subprogram without parameter transfer
162
2.24.2.2
Subprogram with call-by-value parameter transfer (PROC)
162
2.24.2.3
Subprogram with call-by-reference parameter transfer (PROC, VAR)
164
2.24.2.4
Save modal G functions (SAVE)
166
2.24.2.5
Suppress single block execution (SBLOF, SBLON)
167
2.24.2.6
Suppress current block display (DISPLOF, DISPLON, ACTBLOCNO)
173
2.24.2.7
Identifying subprograms with preparation (PREPRO)
176
2.24.2.8
Subprogram return M17
176
2.24.2.9
RET subprogram return
177
2.24.2.10
Parameterizable subprogram return jump (RET ...)
178
2.24.2.11
Parameterizable subprogram return jump (RETB ...)
184
2.24.3
Subprogram call
188
2.24.3.1
Subprogram call without parameter transfer
188
2.24.3.2
Subprogram call with parameter transfer (EXTERN)
190
2.24.3.3
Number of program repetitions (P)
192
2.24.3.4
Modal subprogram call (MCALL)
193
2.24.3.5
Indirect subprogram call (CALL)
195
2.24.3.6
Indirect subprogram call with specification of the calling program part (CALL BLOCK ...
TO ...)
196
2.24.3.7
Indirect call of a program programmed in ISO language (ISOCALL)
197
2.24.3.8
Call subprogram with path specification and parameters (PCALL)
198
2.24.3.9
Extend search path for subprogram calls (CALLPATH)
199
2.24.3.10
Execute external subprogram (840D sl) (EXTCALL)
200
2.24.3.11
Execute external subprogram (828D) (EXTCALL)
204
2.25
Macro technique (DEFINE ... AS)
208
3
File and Program Management
211
3.1
Program memory
211
3.1.1
NC program memory
211
3.1.2
External program memory
213
3.1.3
Addressing program memory files
215
3.1.4
Search path for subprogram call
219
3.1.5
Interrogating the path and file name
220
3.2
Working memory (CHANDATA, COMPLETE, INITIAL)
222
4
Protection zones
225
4.1
Defining protection zones (CPROTDEF, NPROTDEF)
225
4.2
Activating/deactivating protection zones (CPROT, NPROT)
229
4.3
Checking for protection zone violation, working area limitation and software limit
switches (CALCPOSI)
233
5
Special motion commands
243
5.1
Approaching coded positions (CAC, CIC, CDC, CACP, CACN)
243
5.2
Spline interpolation (ASPLINE, BSPLINE, CSPLINE, BAUTO, BNAT, BTAN, EAUTO,
ENAT, ETAN, PW, SD, PL)
244
5.3
Spline group (SPLINEPATH)
255
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
9
Table of contents
5.4
Activating/deactivating NC block compression (COMPON, COMPCURV, COMPCAD,
COMPSURF, COMPOF)
257
5.5
Polynomial interpolation (POLY, POLYPATH, PO, PL)
258
5.6
Settable path reference (SPATH, UPATH)
264
5.7
Channel-specific measuring (MEAS, MEAW)
266
5.8
Axis-specific measurement (MEASA, MEAWA, MEAC) (option)
269
5.9
Special functions for OEM users (OMA1 ... OMA5, OEMIPO1, OEMIPO2, G810 ... G829)
278
5.10
Feedrate reduction with corner deceleration (FENDNORM, G62, G621)
279
5.11
Programmable end of motion criteria (FINEA, COARSEA, IPOENDA, IPOBRKA,
ADISPOSA)
280
6
Coordinate transformations (frames)
283
6.1
Coordinate transformation via frame variables
283
6.1.1
Predefined frame variable ($P_CHBFRAME, $P_IFRAME, $P_PFRAME,
$P_ACTFRAME)
285
6.2
Value assignments to frames
289
6.2.1
Assigning direct values (axis value, angle, scale)
289
6.2.2
Reading and changing frame components (TR, FI, RT, SC, MI)
291
6.2.3
Calculating with frames
292
6.2.4
Definition of frame variables (DEF FRAME)
293
6.3
Coarse and fine offsets (CTRANS, CFINE)
295
6.4
External zero offset ($AA_ETRANS)
297
6.5
Set actual value with loss of the referencing status (PRESETON)
299
6.6
Set actual value without loss of the referencing status (PRESETONS)
301
6.7
Frame calculation from three measuring points in space (MEAFRAME)
303
6.8
NCU global frames
307
6.8.1
Channel-specific frames ($P_CHBFR, $P_UBFR)
307
6.8.2
Frames active in the channel
308
7
Transformations
313
7.1
General programming of transformation types
313
7.1.1
Orientation movements for transformations
315
7.1.2
Overview of orientation transformation TRAORI
319
7.2
Three, four and five axis transformation (TRAORI)
321
7.2.1
General relationships of universal tool head
321
7.2.2
Three, four and five axis transformation (TRAORI)
324
7.2.3
Variants of orientation programming and initial setting (ORIRESET)
325
7.2.4
Programming the tool orientation (A..., B..., C..., LEAD, TILT)
327
7.2.5
Face milling (A4, B4, C4, A5, B5, C5)
333
7.2.6
Reference of the orientation axes (ORIWKS, ORIMKS):
334
7.2.7
Programming orientation axes (ORIAXES, ORIVECT, ORIEULER, ORIRPY, ORIRPY2,
ORIVIRT1, ORIVIRT2)
336
7.2.8
Orientation programming along the peripheral surface of a taper (ORIPLANE,
ORICONCW, ORICONCCW, ORICONTO, ORICONIO)
338
Job Planning
10
Programming Manual, 12/2018, A5E40869460B AB
Table of contents
7.2.9
Specification of orientation for two contact points (ORICURVE, PO[XH]=, PO[YH]=,
PO[ZH]=)
341
7.3
Orientation polynomials (PO[angle], PO[coordinate])
344
7.4
Rotations of the tool orientation (ORIROTA, ORIROTR, ORIROTT, ORIROTC, THETA)
346
7.5
Orientations relative to the path
349
7.5.1
Orientation types relative to the path
349
7.5.2
Rotation of the tool orientation relative to the path (ORIPATH, ORIPATHS, angle of
rotation)
350
7.5.3
Interpolation of the tool rotation relative to the path (ORIROTC, THETA)
351
7.5.4
Smoothing of orientation characteristic (ORIPATHS A8=, B8=, C8=)
353
7.6
Compression of the orientation (COMPON, COMPCURV, COMPCAD, COMPSURF)
355
7.7
Activating/deactivating the orientation characteristic (ORISON, ORISOF)
358
7.8
Kinematic transformation
360
7.8.1
Activate face end transformation (TRANSMIT)
360
7.8.2
Activate cylinder surface transformation (TRACYL)
360
7.8.3
Activating an oblique angle transformation with programmable angle (TRAANG)
363
7.8.4
Oblique plunge-cutting on grinding machines (G5, G7)
364
7.9
Activate concatenated transformation (TRACON)
366
7.10
Cartesian PTP travel
368
7.10.1
Activating/deactivating Cartesian PTP travel (PTP, PTPG0, PTPWOC, CP)
368
7.10.2
Specify the position of the joints (STAT)
369
7.10.3
Specify the sign of the axis angle (TU)
373
7.10.4
Example 1: PTP travel of a 6-axis robot with ROBX transformation
376
7.10.5
Example 2: PTP travel for generic 5-axis transformation
377
7.10.6
Example 3: PTPG0 and TRANSMIT
377
7.11
Constraints when selecting a transformation
379
7.12
Deselecting a transformation (TRAFOOF)
380
8
Kinematic chains
381
8.1
Deletion of components (DELOBJ)
381
8.2
Index determination by means of names (NAMETOINT)
384
9
Collision avoidance with kinematic chains
385
9.1
Check for collision pair (COLLPAIR)
386
9.2
Request recalculation of the machine model of the collision avoidance (PROTA)
387
9.3
Setting the protection zone status (PROTS)
388
9.4
Determining the clearance of two protection zones (PROTD)
389
10
Transformation with kinematic chains
391
10.1
Activating a transformation (TRAFOON)
391
10.2
Modifying the orientation transformation after the machine measurement
(CORRTRAFO)
392
11
Tool offsets
399
11.1
Offset memory
399
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
11
Table of contents
11.2
Additive offsets
402
11.2.1
Selecting additive offsets (DL)
402
11.2.2
Specify wear and setup values ($TC_SCPxy[t,d], $TC_ECPxy[t,d])
403
11.2.3
Delete additive offsets (DELDL)
404
11.3
Special handling of tool offsets
406
11.3.1
Mirroring of tool lengths
407
11.3.2
Wear sign evaluation
408
11.3.3
Coordinate system of the active machining operation (TOWSTD, TOWMCS, TOWWCS,
TOWBCS, TOWTCS, TOWKCS)
409
11.3.4
Tool length and plane change
411
11.4
Online tool offset
413
11.4.1
Defining a polynomial function (FCTDEF)
413
11.4.2
Write online tool offset continuously (PUTFTOCF)
414
11.4.3
Write online tool offset, discrete (PUTFTOC)
415
11.4.4
Activate/deactivate online tool offset (FTOCON/FTOCOF)
416
11.5
3D tool radius compensation
417
11.5.1
Selecting 3D tool radius compensation for 3D circumferential milling (CUT3DC,
CUT3DCD, ISD)
417
11.5.2
Selecting 3D tool radius compensation for the 3D face milling (CUT3DF, CUT3DFS,
CUT3DFF, CUT3DFD)
421
11.5.3
3D circumferential milling taking into account a limitation surface (CUT3DCC,
CUT3DCCD)
426
11.6
Tool orientation (ORIC, ORID, OSOF, OSC, OSS, OSSE, ORIS, OSD, OST)
432
11.7
Free assignment of D numbers, cutting edge numbers
438
11.7.1
Free assignment of D numbers, cutting edge numbers (CE address)
438
11.7.2
Free assignment of D numbers: Checking D numbers (CHKDNO)
438
11.7.3
Free assignment of D numbers: Rename D numbers (GETDNO, SETDNO)
439
11.7.4
Free assignment of D numbers: Determine T number to the specified D number
(GETACTTD)
440
11.7.5
Free assignment of D numbers: Invalidate D numbers (DZERO)
440
11.8
Toolholder kinematics
441
11.9
Tool length compensation for orientable toolholders (TCARR, TCOABS, TCOFR,
TCOFRX, TCOFRY, TCOFRZ)
446
11.10
Online tool length compensation (TOFFON, TOFFOF)
449
11.11
Modification of the offset data for rotatable tools
452
11.11.1
Calculating orientations (ORISOLH)
452
11.11.2
Activating the modification of the offset data for rotatable tools (CUTMOD, CUTMODK)
460
11.12
Working with tool environments
467
11.12.1
Save tool environment (TOOLENV)
467
11.12.2
Delete tool environment (DELTOOLENV)
470
11.12.3
Read T, D and DL number (GETTENV)
471
11.12.4
Read information about the saved tool environments ($P_TOOLENVN, ($P_TOOLENV)
472
11.12.5
Read tool lengths and/or tool length components (GETTCOR)
472
11.12.6
Change tool components (SETTCOR)
478
11.13
Read the assignment of the tool lengths L1, L2, L3 to the coordinate axes (LENTOAX)
491
Job Planning
12
Programming Manual, 12/2018, A5E40869460B AB
Table of contents
12
Path traversing behavior
495
12.1
Tangential control
495
12.1.1
Defining coupling (TANG)
495
12.1.2
Activating intermediate block generation (TLIFT)
496
12.1.3
Activating the coupling (TANGON)
497
12.1.4
Deactivating the coupling (TANGOF)
499
12.1.5
Deleting a coupling (TANGDEL)
499
12.2
Feedrate characteristic (FNORM, FLIN, FCUB, FPO)
501
12.3
Acceleration behavior
506
12.3.1
Acceleration mode (BRISK, BRISKA, SOFT, SOFTA, DRIVE, DRIVEA)
506
12.3.2
Influence of acceleration on following axes (VELOLIMA, ACCLIMA, JERKLIMA)
508
12.3.3
Activation of technology-specific dynamic values (DYNNORM, DYNPOS, DYNROUGH,
DYNSEMIFIN, DYNFINISH)
510
12.4
Traversing with feedforward control (FFWON, FFWOF)
512
12.5
Programmable contour accuracy (CPRECON, CPRECOF)
513
12.6
Program sequence with preprocessing memory (STOPFIFO, STARTFIFO, FIFOCTRL,
STOPRE)
515
12.7
Defining a stop delay range (DELAYFSTON, DELAYFSTOF)
518
12.8
Prevent program position for SERUPRO (IPTRLOCK, IPTRUNLOCK)
521
12.9
Repositioning to the contour (REPOSA, REPOSL, REPOSQ, REPOSQA, REPOSH,
REPOSHA, DISR, DISPR, RMIBL, RMBBL, RMEBL, RMNBL)
523
12.10
Influencing the motion control
532
12.10.1
Percentage jerk correction (JERKLIM)
532
12.10.2
Percentage velocity correction (VELOLIM)
533
12.10.3
Program example for JERKLIM and VELOLIM
535
12.11
Programming contour/orientation tolerance (CTOL, OTOL, ATOL)
536
12.12
Block change behavior with active coupling (CPBC)
540
13
Axis couplings
541
13.1
Coupled motion (TRAILON, TRAILOF)
541
13.2
Curve tables (CTAB)
546
13.2.1
Define curve tables (CTABDEF, CATBEND)
546
13.2.2
Check for presence of curve table (CTABEXISTS)
552
13.2.3
Delete curve tables (CTABDEL)
553
13.2.4
Locking curve tables to prevent deletion and overwriting (CTABLOCK, CTABUNLOCK)
554
13.2.5
Curve tables: Determine table properties (CTABID, CTABISLOCK, CTABMEMTYP,
CTABPERIOD)
555
13.2.6
Read curve table values (CTABTSV, CTABTEV, CTABTSP, CTABTEP, CTABSSV,
CTABSEV, CTAB, CTABINV, CTABTMIN, CTABTMAX)
556
13.2.7
Curve tables: Check use of resources (CTABNO, CTABNOMEM, CTABFNO,
CTABSEGID, CTABSEG, CTABFSEG, CTABMSEG, CTABPOLID, CTABPOL,
CTABFPOL, CTABMPOL)
561
13.3
Axial master value coupling (LEADON, LEADOF)
563
13.4
Electronic gear (EG)
569
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
13
Table of contents
13.4.1
Defining an electronic gear (EGDEF)
569
13.4.2
Switch-in the electronic gearbox (EGON, EGONSYN, EGONSYNE)
570
13.4.3
Switching-in the electronic gearbox (EGOFS, EGOFC)
573
13.4.4
Deleting the definition of an electronic gear (EGDEL)
574
13.4.5
Rotational feedrate (G95) / electronic gear (FPR)
574
13.5
Synchronous spindle
575
13.5.1
Synchronous spindle: Programming (COUPDEF, COUPDEL, COUPON, COUPONC,
COUPOF, COUPOFS, COUPRES, WAITC)
575
13.6
Generic coupling (CP...)
586
13.7
Master/slave coupling (MASLDEF, MASLDEL, MASLON, MASLOF, MASLOFS)
593
14
Synchronized actions
597
14.1
Definition of a synchronized action
597
15
Oscillation
599
15.1
Asynchronous oscillation (OS, OSP1, OSP2, OST1, OST2, OSCTRL, OSNSC, OSE,
OSB)
599
15.2
Oscillation controlled by synchronized actions (OSCILL)
604
16
Punching and nibbling
611
16.1
Activation/deactivation
611
16.1.1
Activate/deactivate punching and nibbling (SPOF, SON, PON, SONS, PONS,
PDELAYON, PDELAYOF, PUNCHACC)
611
16.2
Automatic path segmentation
616
16.2.1
Path segmentation for path axes
618
16.2.2
Path segmentation for single axes
620
17
Grinding
623
17.1
Activate/deactivate grinding-specific tool monitoring (TMON, TMOF)
623
18
Additional functions
625
18.1
Axis functions (AXNAME, AX, SPI, AXTOSPI, ISAXIS, AXSTRING, MODAXVAL)
625
18.2
Replaceable geometry axes (GEOAX)
628
18.3
Axis container (AXCTSWE, AXCTSWED, AXCTSWEC)
633
18.4
Wait for valid axis position (WAITENC)
635
18.5
Programmable parameter set changeover (SCPARA)
637
18.6
Check scope of NC language present (STRINGIS)
639
18.7
Interactively call the window from the part program (MMC)
643
18.8
Program runtime/part counter
648
18.8.1
Program runtime
648
18.8.2
Workpiece counter
651
18.9
Process DataShare - Output to an external device/file (EXTOPEN, WRITE,
EXTCLOSE):
653
18.10
Alarms (SETAL)
658
18.11
Extended stop and retract (ESR)
659
Job Planning
14
Programming Manual, 12/2018, A5E40869460B AB
Table of contents
18.11.1
NC-controlled ESR
660
18.11.1.1
NC-controlled retraction (POLF, POLFA, POLFMASK, POLFMLIN)
660
18.11.1.2
NC-controlled stopping
663
18.11.2
Drive-integrated ESR
664
18.11.2.1
Configuring drive-integrated stopping (ESRS)
664
18.11.2.2
Configuring drive-integrated retraction (ESRS)
665
18.12
Define blank (WORKPIECE)
667
18.13
Switch language mode (G290, G291)
671
18.14
Activate/deactivate load adjustment (CADAPTON, CADAPTOF)
673
19
User stock removal programs
677
19.1
Supporting functions for stock removal
677
19.2
Generate contour table (CONTPRON)
678
19.3
Generate coded contour table (CONTDCON)
684
19.4
Determine point of intersection between two contour elements (INTERSEC)
688
19.5
Execute the contour elements of a table block-by-block (EXECTAB)
690
19.6
Calculate circle data (CALCDAT)
691
19.7
Deactivate contour preparation (EXECUTE)
693
20
Programming cycles externally
695
20.1
Technology cycles
695
20.1.1
Introduction
695
20.1.2
Technology-specific overview
696
20.1.3
HOLES1 - row position pattern
698
20.1.4
HOLES2 - circle or pitch circle position pattern
698
20.1.5
POCKET3 - rectangular pocket
700
20.1.6
POCKET4 - circular pocket
703
20.1.7
SLOT1 - longitudinal slot
705
20.1.8
SLOT2 - circumferential slot
708
20.1.9
LONGHOLE - elongated hole
710
20.1.10
CYCLE60 - engraving
712
20.1.11
CYCLE61 - Face milling
715
20.1.12
CYCLE62 - contour call
717
20.1.13
CYCLE63 - contour pocket milling / contour pocket residual material / contour spigot
milling / contour spigot residual material
718
20.1.14
CYCLE64 - Predrilling contour pocket
720
20.1.15
CYCLE70 - thread milling
722
20.1.16
CYCLE72 - Path milling
724
20.1.17
CYCLE76 - rectangular spigot
728
20.1.18
CYCLE77 - circular spigot
730
20.1.19
CYCLE78 - Drill thread milling
732
20.1.20
CYCLE79 - multi-edge
734
20.1.21
CYCLE81 - drilling, centering
736
20.1.22
CYCLE82 - drilling, counterboring
737
20.1.23
CYCLE83 - deep-hole drilling 1
740
20.1.24
CYCLE84 - tapping without compensating chuck
743
20.1.25
CYCLE85 - reaming
746
20.1.26
CYCLE86 - boring
747
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
15
Table of contents
20.1.27
CYCLE92 - cut-off
748
20.1.28
CYCLE95 - contour cutting
750
20.1.29
CYCLE98 - thread chain
752
20.1.30
CYCLE99 - thread turning
756
20.1.31
CYCLE435 - Set dresser coordinate system
761
20.1.32
CYCLE495 - form-truing
761
20.1.33
CYCLE782 - adjust to load
763
20.1.34
CYCLE800 - swivel plane / swivel tool / align tool
765
20.1.35
CYCLE801 - grid or frame position pattern
768
20.1.36
CYCLE802 - arbitrary positions
770
20.1.37
CYCLE830 - deep-hole drilling 2
772
20.1.38
CYCLE832 - High-Speed Settings
778
20.1.39
CYCLE840 - tapping with compensating chuck
781
20.1.40
CYCLE899 - open slot
784
20.1.41
CYCLE930 - groove
787
20.1.42
CYCLE940 - undercut form E and F / undercut thread
789
20.1.43
CYCLE951 - stock removal
792
20.1.44
CYCLE952 - stock removal / residual stock removal / plunge cutting / residual plunge
cutting / plunge turning / residual plunge turning
795
20.1.45
CYCLE4071 - longitudinal grinding with infeed at the reversal point
801
20.1.46
CYCLE4072 - longitudinal grinding with infeed at the reversal point and cancel signal
802
20.1.47
CYCLE4073 - longitudinal grinding with continuous infeed
806
20.1.48
CYCLE4074 - longitudinal grinding with continuous infeed and cancel signal
807
20.1.49
CYCLE4075 - surface grinding with infeed at the reversal point
810
20.1.50
CYCLE4077 - surface grinding with infeed at the reversal point and cancel signal
813
20.1.51
CYCLE4078 - surface grinding with continuous infeed
816
20.1.52
CYCLE4079 - surface grinding with intermittent infeed
818
20.1.53
GROUP_BEGIN - beginning of program block
820
20.1.54
GROUP_END - end of program block
821
20.1.55
GROUP_ADDEND - End of trial cut addition
821
20.1.56
Supplementary conditions
821
20.1.56.1
Technology scaling in cycle screen forms
821
20.2
Measuring cycles
823
21
Tables
825
21.1
Operations
825
21.2
Operations: Availability for SINUMERIK 828D
862
21.2.1
Control version milling / turning
862
21.2.2
Control versions grinding
889
21.3
Currently set language in the HMI
916
A
Appendix
917
A.1
List of abbreviations
917
A.2
Documentation overview
926
Glossary
927
Index
949
Job Planning
16
Programming Manual, 12/2018, A5E40869460B AB
Fundamental safety instructions
1
1.1
General safety instructions
WARNING
Danger to life if the safety instructions and residual risks are not observed
If the safety instructions and residual risks in the associated hardware documentation are not
observed, accidents involving severe injuries or death can occur.
● Observe the safety instructions given in the hardware documentation.
● Consider the residual risks for the risk evaluation.
WARNING
Malfunctions of the machine as a result of incorrect or changed parameter settings
As a result of incorrect or changed parameterization, machines can malfunction, which in turn
can lead to injuries or death.
● Protect the parameterization (parameter assignments) against unauthorized access.
● Handle possible malfunctions by taking suitable measures, e.g. emergency stop or
emergency off.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
17
Fundamental safety instructions
1.2 Warranty and liability for application examples
1.2
Warranty and liability for application examples
Application examples are not binding and do not claim to be complete regarding configuration,
equipment or any eventuality which may arise. Application examples do not represent specific
customer solutions, but are only intended to provide support for typical tasks.
As the user you yourself are responsible for ensuring that the products described are operated
correctly. Application examples do not relieve you of your responsibility for safe handling when
using, installing, operating and maintaining the equipment.
Job Planning
18
Programming Manual, 12/2018, A5E40869460B AB
Fundamental safety instructions
1.3 Industrial security
1.3
Industrial security
Note
Industrial security
Siemens provides products and solutions with industrial security functions that support the
secure operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is
necessary to implement - and continuously maintain - a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems,
machines and networks. Such systems, machines and components should only be connected
to an enterprise network or the Internet if and to the extent such a connection is necessary
and only when appropriate security measures (e.g. firewalls and/or network segmentation) are
in place.
For additional information on industrial security measures that may be implemented, please
visit:
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS
Feed at:
Further information is provided on the Internet:
Industrial Security Configuration Manual (https://support.industry.siemens.com/cs/ww/en/
view/108862708)
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
19
Fundamental safety instructions
1.3 Industrial security
WARNING
Unsafe operating states resulting from software manipulation
Software manipulations (e.g. viruses, trojans, malware or worms) can cause unsafe operating
states in your system that may lead to death, serious injury, and property damage.
● Keep the software up to date.
● Incorporate the automation and drive components into a holistic, state-of-the-art industrial
security concept for the installation or machine.
● Make sure that you include all installed products into the holistic industrial security concept.
● Protect files stored on exchangeable storage media from malicious software by with
suitable protection measures, e.g. virus scanners.
● Protect the drive against unauthorized changes by activating the "know-how protection"
drive function.
Job Planning
20
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2
2.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 35)"
● 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 35)".
- 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 29)"
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
21
Flexible NC programming
2.1 Variables
2.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
Job Planning
22
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
$ + 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.
References
A complete overview of all system variables appears in:
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
23
Flexible NC programming
2.1 Variables
List Manual, System Variables
See also
Variables (Page 21)
2.1.2
Predefined user variables: Arithmetic parameters
2.1.2.1
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.
Job Planning
24
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
<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 expres-
sion can be converted to the INT data type (INT, REAL, BOOL, CHAR).
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 21)
2.1.2.2
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.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
25
Flexible NC programming
2.1 Variables
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_PAR-
AM_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_PAR-
AM_NCK) - 1
<expression>:
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
26
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
<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.
2.1.3
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
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
27
Flexible NC programming
2.1 Variables
$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_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 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(
$/
Job Planning
28
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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)
See also
Variables (Page 21)
2.1.4
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.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
29
Flexible NC programming
2.1 Variables
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 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.
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>
Job Planning
30
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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 45)"
<data class>:
Data class assignment (only SINUMERIK 828D)
DCM:
Data class M (= Manufacturer)
DCI:
Data class I (= Individual)
DCU:
Data class U (= User)
See "Attribute: Data class (DCM, DCI, DCU) - only SINUMERIK 828D
(Page 49)".
<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 58)"
<phys_unit>:
Physical unit (optional)
PHU <unit>:
Physical unit
See "Attribute: Physical unit (PHU) (Page 43)"
<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 41)"
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
31
Flexible NC programming
2.1 Variables
<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 52)"
<init_value>:
Initialization value (optional)
See "Attribute: Initialization value (Page 38)"
For the Initialization of array variables see "Definition and initialization
of array variables (DEF, SET, REP) (Page 52)"
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 STROM_1, STROM_2
;Description
;Definition of two GUD items: STROM_1, STROM_2
;Range of validity: Throughout the channel
;Data type: REAL
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 ZEIT_1=12, ZEIT_2=45
;Description
;Definition of two GUD items: ZEIT_1, ZEIT_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 = end user
;OPI: Write = 0 = Siemens, read = 3 = end user
;Initialization value: ZEIT_1 = 12.0, ZEIT_2 = 45.0
Job Planning
32
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
Program code
Comment
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 = end user
;OPI: Write = 0 = Siemens, read = 3 = end 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
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
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
33
Flexible NC programming
2.1 Variables
Program code
Comment
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
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
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 da-
ta type
1)
For SINUMERIK 828D, MD can only be read!
Job Planning
34
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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 625)") 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 NC program
2.1.5
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.
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 50)".
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>
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
35
Flexible NC programming
2.1 Variables
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 43)".
Note
Cannot be redefined for:
● System variables
● Global user data (GUD) of the data types: BOOL, AXIS,
STRING, FRAME
<limit values>:
Lower/upper limit
LLI <limit value>:
Lower limit value (lower limit)
ULI <limit value>:
Upper limit value (upper limit)
See "Attribute: Limit values (LLI, ULI) (Page 41)".
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 45)".
Job Planning
36
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
<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 38)".
<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 38)".
For the Initialization of array variables, see "Definition and ini-
tialization of array variables (DEF, SET, REP) (Page 52)".
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)
See "Attribute: Data class (DCM, DCI, DCU) - only SINUMER-
IK 828D (Page 49)".
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:
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
37
Flexible NC programming
2.1 Variables
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.
2.1.6
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)
Job Planning
38
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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).
Table 2-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
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
39
Flexible NC programming
2.1 Variables
Number
Identifier
G command 1)
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.
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).
Job Planning
40
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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 21)
2.1.7
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
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
41
Flexible NC programming
2.1 Variables
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
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 21)
Job Planning
42
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
2.1.8
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 ]
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 ]
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
43
Flexible NC programming
2.1 Variables
<unit>
Meaning
Physical unit
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
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.
Conversion 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.
Job Planning
44
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
See also
Variables (Page 21)
2.1.9
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)
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
End 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)
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
45
Flexible NC programming
2.1 Variables
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 the keyword APR in
common for part program and OPI.
The keywords APRP and APRB are not supported by the redefinition of the reading rights,
and lead to the message of interrupt 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
References
Programming Manual, Fundamentals, Section: G commands / preparatory functions
● Predefined functions
References
Programming Manual, Fundamentals, Section: Predefined functions
Job Planning
46
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
● Predefined subprogram calls
References
Programming Manual, Fundamentals, Section: 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.
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 end-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 end 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.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
47
Flexible NC programming
2.1 Variables
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.
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>
Job Planning
48
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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.
References
Operating Manual
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 21)
2.1.10
Attribute: Data class (DCM, DCI, DCU) - only SINUMERIK 828D
To simplify the data handling during the commissioning, series start-up and upgrade of
machines and machine series, all system and user data of the NC is divided into data classes.
Data class
Data
S = System
System data provided by Siemens, such as machine and set-
ting data, standard and measuring cycles, definitions (SGUD)
and macros (SMAC), etc.
M = Manufacturer
Machine series-specific commissioning data such as manufac-
(machine manufacturer)
turer cycles, definitions (MGUD) and macros (MMAC) and ma-
chine data that defines the functional scope of the machine.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
49
Flexible NC programming
2.1 Variables
Data class
Data
I = Individual (machine-specific)
Machine-specific commissioning data such as compensation
data reference point offsets.
U = User
Machine-specific data generated during operation of the ma-
chine such as tool data, setting data, part programs, user cy-
cles, definitions (UGUD) and macros (UMAC).
References:
SINUMERIK 828D Commissioning Manual, Turning and Milling; Section "Introduction and use
of data classes"
Definition (DEF) of user data
The data class of the data item is implicitly specified through the data class of the file or directory
in which the user data is defined. The data class of the data item cannot be changed.
However, for the definition (DEF) of the user data, a different data class to that of the data item
can be specified for the data value.
The following must apply for the data class of the data item:
Priority of the data class of the data value ≤ priority of the data class of the data item
Example:
The definition of the GUD, which defines a probe, should be in data class M (= Manufacturer)
because it is required to run the manufacturer cycles. However, the value of the data item
should belong to data class I (= Individual) because the probe type can differ from machine to
machine.
MGUD.DEF (data class M)
DEF CHAN DCI INT CALIPER
Redefinition (REDEF) of system data
The data class of the system data can be changed through redefinition (REDEF). The
redefinition must be performed in a definition file with data class S or M.
When using ACCESS files, the redefinitions may only be performed with the ACCESS files.
The respective data class of the machine, setting and option data as well as the system
variables can be found in the
● List Manual, Detailed Machine Data Description, parameter: "Class"
● List Manual, System Variables
2.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.
Job Planning
50
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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 capability
---
---
---
REDEF
---
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_...)
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 21)
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
51
Flexible NC programming
2.1 Variables
2.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>]
DEF STRING[<string length>] <variable name>[<n>,<m>]
Job Planning
52
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
53
Flexible NC programming
2.1 Variables
<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 specified
<value>. The following apply to the remaining array ele-
ments, 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
unchanged.
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
unchanged.
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
Job Planning
54
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
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)
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
55
Flexible NC programming
2.1 Variables
$UUD\ LQGH[
1
,QLWLDOL]DWLRQ IRU
1
1
,QLWLDOL]DWLRQ ZLWK
1
1
,QLWLDOL]DWLRQ ZLWK
GHILQLWLRQ
LGHQWLFDO YDOXH
YDULRXV YDOXHV
7KH DUUD\ HOHPHQWV > @ WR
7KH DUUD\ HOHPHQWV > @ WR
>
@ KDYH EHHQ LQLWLDOL]HG
>
@ KDYH EHHQ LQLWLDOL]HG
ZLWK WKH GHIDXOW YDOXH
ZLWK WKH GHIDXOW YDOXH
7KH DUUD\ HOHPHQWV > @ WR
>
@ KDYH QRW EHHQ FKDQJHG
See also
Definition and initialization of array variables (DEF, SET, REP): Further Information
(Page 56)
Variables (Page 21)
2.1.13
Definition and initialization of array variables (DEF, SET, REP): Further
Information
Further information (SET)
initialization during definition
● Starting with the 1st array element, as many array elements are assigned with the values
from the value list as there are elements programmed in the value list.
● A value of 0 is assigned to array elements without explicitly declared values in the value
list (gaps in the value list).
● For variables of the AXIS data type, gaps in the value list are not permitted.
● If the value list contains more values than there are array elements defined, an alarm will
be displayed.
Job Planning
56
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
Value assignment in program execution
In the case of value assignment in program execution, the rules described above for definition
apply. The following options are also supported:
● Expressions are also permitted as elements in the value list.
● Value assignment starts with the programmed array index. Values can be assigned
selectively to subarrays.
Example:
Program code
Comments
DEF INT ARRAY[5,5]
; Array definition
ARRAY[0,0]=SET(1,2,3,4,5)
; Value assignment to the first 5 array ele-
ments [0,0] - [0,4]
FELD[0,0]=SET(1,2, , ,5)
; Value assignment with gap to the first 5 array
elements [0,0] - [0,4], array elements[0,2] and
[0,3] = 0
ARRAY[2,3]=SET(VARIABLE,4*5.6)
; Value assignment with variable and expression
starting at array index [2,3]:
[2,3] = VARIABLE
[2,4] = 4 * 5.6 = 22.4
Further information (REP)
initialization during definition
● All or the optionally specified number of array elements are initialized with the specified
value (constant).
● Variables of the FRAME data type cannot be initialized.
Example:
Program code
Comments
DEF REAL varName[10]=REP(3.5,4)
; Initialize array definition and array ele-
ments [0] to [3] with value 3.5.
Value assignment in program execution
In the case of value assignment in program execution, the rules described above for definition
apply. The following options are also supported:
● Expressions are also permitted as elements in the value list.
● Value assignment starts with the programmed array index. Values can be assigned
selectively to subarrays.
Examples:
Program code
Comments
DEF REAL varName[10]
; Array definition
varName[5]=REP(4.5,3)
; Array elements [5] to [7] = 4.5
R10=REP(2.4,3)
; R-parameters R10 to R12 = 2.4
DEF FRAME FRM[10]
; Array definition
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
57
Flexible NC programming
2.1 Variables
Program code
Comments
FRM[5] = REP(CTRANS (X,5))
; Array elements [5] to [9] = CTRANS(X,5)
See also
Definition and initialization of array variables (DEF, SET, REP) (Page 52)
2.1.14
Data types
The following data types are available in the NC:
Data type
Meaning
Value Range
INT
Integer with sign
-2147483648 ... +2147483647
REAL
Real number (LONG REAL to IEEE)
±(∼2,2*10-308 … ∼1,8*10+308)
BOOL
Truth value TRUE (1) and FALSE (0)
1, 0
CHAR
ASCII character
ASCII code 0 to 255
STRING
Character string of a defined length
Maximum of 200 characters (no special
characters)
AXIS
Axis/spindle identifier
Channel axis identifier
FRAME
Geometric parameters for static coordinate
---
transformation (translation, rotation, scal-
ing, mirroring)
Implicit data type conversions
The following data type conversions are possible and are performed implicitly during
assignments and parameter transfers:
from ↓/ to →
REAL
INT
BOOL
REAL
x
o
&
INT
x
x
&
BOOL
x
x
x
x : Possible without restrictions
o: Data loss possible due to the range of values being overshot ⇒ alarm;
rounding: decimal place value ≥ 0.5 ⇒ round up, decimal place value < 0.5 ⇒ round down
&: value ≠ 0 ⇒ TRUE, value== 0 ⇒ FALSE
See also
Variables (Page 21)
Job Planning
58
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
2.1.15
Check availability of a variable (ISVAR)
The predefined ISVAR function can be used to check whether a system/user variable (e.g.
machine data, setting data, system variable, general variables such as GUD) is known in the
NC.
Variable
The variables to be queried have the following structure:
Dimensionless variable:
<Variable>
One-dimensional variable without array index: <Variable>[ ]
One-dimensional variable with array index n: <Variable>[<n>]
Two-dimensional variable without array index: <Variable>[ , ]
Two-dimensional variable with array indices n <Variable>[<n>,<m>]
and m:
Syntax
<Result>=ISVAR(<Variable>[<n>,<m>])
Meaning
<result>:
Return value
Data type:
BOOL
Range of values:
1
Variable available
0
Variable unknown
ISVAR:
Checks whether the specified system/user variable is known in the NC.
<Variable>:
Name of the system/user variable
Data type:
STRING
<n>:
Array index of the first dimension (optional)
Data type:
INT
<m>:
Array index of the second dimension (optional)
Data type:
INT
The following checks are made in accordance with the transfer parameter:
● Is the name known?
● Is the variable an array?
● Is it a one- or two-dimensional array?
● Is the respective array index in the permissible range?
Only if all checks are positive, TRUE (1) is returned.
If a check is negative or a syntax error has occurred, FALSE (0) is returned.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
59
Flexible NC programming
2.1 Variables
Examples
Program code
Comment
DEF INT VAR1
DEF BOOL IS_VAR=FALSE
N10 IS_VAR=ISVAR("VAR1")
; IS_VAR is in this case TRUE.
Program code
Comment
DEF REAL VARARRAY[10,10]
DEF BOOL IS_VAR=FALSE
N10 IS_VAR=ISVAR("VARARRAY[,]")
; IS_VAR is in this case TRUE, is a two-di-
mensional array.
N20 IS_VAR=ISVAR("VARARRAY")
; IS_VAR is TRUE, variable exists.
N30 IS_VAR=ISVAR("VARARRAY[8,11]")
; IS_VAR is FALSE, array index is not per-
mitted.
N40 IS_VAR=ISVAR("VARARRAY[8,8")
; IS_VAR is FALSE, "]" missing (syntax er-
ror).
N50 IS_VAR=ISVAR("VARARRAY[,8]")
; IS_VAR is TRUE, array index is permitted.
N60 IS_VAR=ISVAR("VARARRAY[8,]")
; IS_VAR is TRUE, array index is permitted.
Program code
Comment
DEF BOOL IS_VAR=FALSE
N100 IS_VAR=ISVAR("$MC_GCODE_RESET_VALUES[1]"
; Transfer parameter is a machine
data item, IS_VAR is TRUE.
Program code
Comment
DEF BOOL IS_VAR=FALSE
N10 IS_VAR=ISVAR("$P_EP")
; IS_VAR is in this case TRUE.
N20 IS_VAR=ISVAR("$P_EP[X]")
; IS_VAR is in this case TRUE.
2.1.16
Reading attribute values / data type (GETVARPHU, GETVARAP, GETVARLIM,
GETVARDIM, GETVARDFT, GETVARTYP)
The attribute values of system/user variables can be read with the predefined GETVARPHU,
GETVARAP, GETVARLIM and GETVARDFT functions, the data type of a system/user
variable with GETVARTYP.
Read physical unit
Syntax:
<Result>=GETVARPHU(<name>)
Job Planning
60
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
Meaning:
<result>:
Numeric value of the physical unit
Data type:
INT
Range of values:
See Table in "Attribute: Physical unit (PHU) (Page 43)"
In case of fault
- 2
The specified <name> has not been assigned to a sys-
tem parameter or a user variable.
GETVARPHU:
Reading of the physical unit of a system/user variable
<name>:
Name of the system/user variables
Data type:
STRING
Example:
The NC contains the following GUD variables:
DEF CHAN REAL PHU 42 LLI 0 ULI 10000 electric
Program code
Comment
DEF INT result=0
result=GETVARPHU("elec-
; Determine the physical unit of the GUD variables.
tric")
IF (result < 0) GOTOF error
The value 42 is returned as result. This corresponds to the physical unit [kW].
Note
GETVARPHU can be used, for example, to check whether both variables have the expected
physical units in a variable assignment a = b.
Read access right
Syntax:
<Result>=GETVARAP(<name>,<access>)
Meaning:
<result>:
Protection level for the specified <access>
Data type:
INT
Range of val-
0 ... 7
See "Attribute: Access rights (APR, APW, APRP, APWP,
ues:
APRB, APWB) (Page 45)".
In case of fault
- 1
Cannot be written (only relevant for <Access> "WP" and
"WB")
- 2
The specified <name> has not been assigned to a system
parameter or a user variable.
- 3
Incorrect value for <access>
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
61
Flexible NC programming
2.1 Variables
GETVARAP:
Reading of the access right to a system/user variable
<name>:
Name of the system/user variables
Data type:
STRING
<access>:
Type of access
Data type:
STRING
Range of val-
"RP"
Read via part program
ues:
"WP"
Write via part program
"RB"
Read via OPI
"WB"
Write via OPI
Example:
Program code
Comment
DEF INT result=0
result=GETVAR-
; Determine the access protection for the system pa-
AP("$TC_MAP8","WB")
rameter "magazine position" with regard to writing via
OPI.
IF (result < 0) GOTOF error
The value 7 is returned as result. This corresponds to the key switch position 0 (= no access
protection).
Note
GETVARAP can be used, for example, to implement a checking program that checks the
access rights expected by the application.
Read limit values
Syntax:
<Status>=GETVARLIM(<name>,<limit value>,<result>)
Meaning:
<Status>:
Function status
Data type:
INT
Range of val-
1
OK
ues:
-1
No limit value defined
(for variables of type AXIS, STRING, FRAME)
-2
The specified <name> has not been assigned to a system
parameter or a user variable.
-3
Incorrect value for <limit value>
GETVARLIM:
Reading of the lower/upper limit value of a system/user variable
<name>:
Name of the system/user variables
Data type:
STRING
Job Planning
62
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
<limit
specifies which limit value should be read out
value>:
Data type:
CHAR
Range of val-
"L"
= lower limit value
ues:
:
"U"
= upper limit value
:
<result>:
Return of the limit value
Data type:
VAR REAL
Example:
Program code
Comment
DEF INT state=0
DEF REAL result=0
state=GETVARLIM("$MA_MAX_AX_VE-
Determine the lower limit value for MD32000
LO","L",result)
$MA_MAX_AX_VELO.
IF (result < 0) GOTOF error
Read attributes / data type
Syntax:
<Result>=GETVARDIM(<Name>, Index)
Meaning:
<Result>:
Dimension / number of array <Index>
Data type:
INT
GETVARDIM:
Reading of the lower/upper limit value of a system/user variable
<Name>:
Reading the number of elements of the array
Data type:
STRING
<Index>:
Number of the array, max. 3.
Data type:
INT
Example:
Program code
Comment
N5 DEF REAL myReal[5,4]
N10 R1 = GETVATDIM("myReal",1)
R1 = 5
N15 R2 = GETVATDIM("myReal",2)
R2 = 4
Read default value
Syntax:
<Status>=GETVARDFT(<name>,<result>[,<index_1>,<index_2>,<index_3>])
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
63
Flexible NC programming
2.1 Variables
Meaning:
<Status>:
Function status
Data type:
INT
Range of val-
1
OK
ues:
-1
No default value available
(e.g. because <result> has the wrong type for <name>)
-2
The specified <name> has not been assigned to a system
parameter or a user variable.
-3
Incorrect value for <index_1>, dimension less than one (=
no array = scalar)
-4
Incorrect value for <index_2>
-5
Incorrect value for <index_3>
GETVARDFT:
Reading of the default value of a system/user variable
<name>:
Name of the system/user variables
Data type:
STRING
<result>:
Return of the default value
Data type:
VAR REAL
(when reading the default value of variables of the types INT, RE-
AL, BOOL, AXIS)
VAR STRING
(when reading the default value of variables of the types STRING
and CHAR)
VAR FRAME
(when reading the default value of variables of the type FRAME)
<index_1>:
Index to the first dimension (optional)
Data type:
INT
Not programmed means = 0
<index_2>:
Index to the second dimension (optional)
Data type:
INT
Not programmed means = 0
<index_3>:
Index to the third dimension (optional)
Data type:
INT
Not programmed means = 0
Example:
Program code
Comment
DEF INT state=0
DEF REAL resultR=0
; Variable to accept the default values
of the types INT, REAL, BOOL, AXIS.
DEF FRAME resultF=0
; Variable to accept the default values
of the type FRAME
IF (GETVARTYP("$MA_MAX_AX_VELO") <> 4)
GOTOF error
state=GETVARDFT("$MA_MAX_AX_VELO",
; Determine the default value of the
resultR, AXTOINT(X))
"X" axis.
Job Planning
64
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.1 Variables
Program code
Comment
IF (result < 0) GOTOF error
IF (GETVARTYP("$TC_TP8") <> 3) GOTOF error
state=GETVARDFT("$TC_TP8", resultR)
IF (GETVARTYP("$P_UBFR")
<> 7) GOTOF error
state=GETVARDFT("$P_UBFR", resultF )
Read data type
Syntax:
<Result>=GETVARTYP(<name>)
Meaning:
<result>:
Data type of the specified system/user variables
Data type:
INT
Range of val-
1
= BOOL
ues:
2
= CHAR
3
= INT
4
= REAL
5
= STRING
6
= AXIS
7
= FRAME
In case of fault
< 0
The specified <name> has not been assigned to a system
parameter or a user variable.
GETVARTYP:
Reading of the data type of a system/user variable
<name>:
Name of the system/user variables
Data type:
STRING
Example:
Program code
Comment
DEF INT result=0
DEF STRING name="R"
result=GETVARTYP(name)
; Determine the type of the R parameter.
IF (result < 0) GOTOF error
The value 4 is returned as result. This corresponds to the REAL data type.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
65
Flexible NC programming
2.2 Indirect programming
2.2
Indirect programming
2.2.1
Indirectly programming addresses
When indirectly programming addresses, the extended address (<index>) is replaced by a
variable with a suitable type.
Note
It is not possible to indirectly program addresses for:
● N (block number)
● L (subprogram)
● Settable addresses
(e.g. X[1] instead of X1 is not permissible)
Syntax
<ADDRESS>[<Index>]
Meaning
<ADDRESS>[...]:
Fixed address with extension (index)
<index>:
Variable, e.g. for spindle number, axis,
Examples
Example 1: Indirectly programming a spindle number
Direct programming:
Program code
Comment
S1=300
; Speed in rpm for the spindle number 1.
Indirect programming:
Program code
Comment
DEF INT SPINU=1
; Defining variables, type INT and value assignment.
S[SPINU]=300
; Speed 300 rpm for the spindle, whose number is saved in
the SPINU variable (in this example 1, the spindle with the
number 1).
Example 2: Indirectly programming an axis
Direct programming:
Program code
Comment
FA[U]=300
; Feedrate 300 for axis "U".
Job Planning
66
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.2 Indirect programming
Indirect programming:
Program code
Comment
DEF AXIS AXVAR2=U
; Defining a variable, type AXIS and value assignment.
FA[AXVAR2]=300
; Feedrate of 300 for the axis whose address name is saved
in the variables with the name AXVAR2.
Example 3: Indirectly programming an axis
Direct programming:
Program code
Comment
$AA_MM[X]
; Read probe measured value (MCS) of axis "X".
Indirect programming:
Program code
Comment
DEF AXIS AXVAR3=X
; Defining a variable, type AXIS and value assignment.
$AA_MM[AXVAR3]
; Read probe measured value (MCS) whose name is saved in
the variables AXVAR3.
Example 4: Indirectly programming an axis
Direct programming:
Program code
X1=100 X2=200
Indirect programming:
Program code
Comment
DEF AXIS AXVAR1 AXVAR2
; Defining two type AXIS variables.
AXVAR1=(X1) AXVAR2=(X2)
; Assigning the axis names.
AX[AXVAR1]=100 AX[AXVAR2]=200
; Traversing the axes whose address names are
saved in the variables with the names AXVAR1
and AXVAR2
Example 5: Indirectly programming an axis
Direct programming:
Program code
G2 X100 I20
Indirect programming:
Program code
Comment
DEF AXIS AXVAR1=X
; Defining a variable, type AXIS and value assignment.
G2 X100 IP[AXVAR1]=20
; Indirect programming the center point data for the axis,
whose address name is saved in the variable with the name
AXVAR1.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
67
Flexible NC programming
2.2 Indirect programming
Example 6: Indirectly programming array elements
Direct programming:
Program code
Comment
DEF INT ARRAY1[4,5]
; Defining array 1
Indirect programming:
Program code
Comment
DEFINE DIM1 AS 4
; For array dimensions, array sizes must be specified as
fixed values.
DEFINE DIM2 AS 5
DEF INT ARRAY[DIM1,DIM2]
ARRAY[DIM1-1,DIM2-1]=5
Example 7: Indirect subprogram call
Program code
Comment
CALL "L" << R10
; Call the program, whose number is located in R10 (string
cascading).
2.2.2
Indirectly programming G commands
Indirect programming of G commands permits cycles to be effectively programmed.
Syntax
G[<group>]=<number>
Meaning
G[...]:
G command with extension (index)
<group>:
Index parameter: G group
Type:
INT
<number>:
Variable for the G command number
Type:
INT or REAL
Note
Generally, only G commands that do not determine the syntax can be indirectly programmed.
Only G group 1 is possible from the G commands that determine the syntax.
The syntax-determining G commands of G groups 2, 3 and 4 are not possible.
Job Planning
68
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.2 Indirect programming
Note
Arithmetic functions are not permitted in the indirect G command programming. If it is
necessary to calculate the G command number, this must be done in a separate part program
line before the indirect G command programming.
Examples
Example 1: Adjustable work offset (G group 8)
Program code
Comment
N1010 DEF INT INT_VAR
N1020 INT_VAR=2
N1090 G[8]=INT_VAR G1 X0 Y0
;G54
N1100 INT_VAR=INT_VAR+1
; G command calculation
N1110 G[8]=INT_VAR G1 X0 Y0
;G55
Example 2: Level selection (G group 6)
Program code
Comment
N2010 R10=$P_GG[6]
; Read active G command of G group 6
N2090 G[6]=R10
References
For information on the G groups, see:
Programming Manual, Fundamentals; Section "G groups"
2.2.3
Indirectly programming position attributes (GP)
Position attributes, e.g. the incremental or absolute programming of the axis position, can be
indirectly programmed as variables in conjunction with the key word GP.
Application
The indirect programming of position attributes is used in replacement cycles, as in this case,
the following advantage exists over programming position attributes as keyword (e.g. IC,
AC, ...):
As a result of the indirect programming as variable, no CASE statement is required, which would
otherwise branch for all possible position attributes.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
69
Flexible NC programming
2.2 Indirect programming
Syntax
<POSITIONING COMMAND>[<axis/spindle>]=
GP(<position>,<position attribute)
<axis/spindle>=BP(<position>,<position attribute)
Meaning
<POSITIONING COMMAND>[]:
The following positioning commands can be programmed to-
gether with the key word GP:
POS, POSA,SPOS, SPOSA
Also possible:
● All axis and spindle identifiers present in the channel:
<axis/spindle>
● Variable axis/spindle identifier AX
<axis/spindle>:
Axis/spindle that is to be positioned
GP():
Key word for positioning
<position>:
Parameter 1
Axis/spindle position as constant or variable
<position attribute>:
Parameter 2
Position attribute (e.g. position approach mode as a variable
(e.g. $P_SUB_SPOSMODE) or as key word (IC, AC, ...)
The values supplied from the variables have the following significance:
Value
Meaning
Permissible for:
0
No change to the position attribute
1
AC
POS, POSA,SPOS, SPOSA,AX, axis address
2
IC
POS, POSA,SPOS, SPOSA,AX, axis address
3
DC
POS, POSA,SPOS, SPOSA,AX, axis address
4
ACP
POS, POSA,SPOS, SPOSA,AX, axis address
5
ACN
POS, POSA,SPOS, SPOSA,AX, axis address
6
OC
-
7
PC
-
8
DAC
POS, POSA,AX, axis address
9
DIC
POS, POSA,AX, axis address
10
RAC
POS, POSA,AX, axis address
11
RIC
POS, POSA,AX, axis address
12
CAC
POS, POSA
13
CIC
POS, POSA
14
CDC
POS, POSA
15
CACP
POS, POSA
16
CACN
POS, POSA
Job Planning
70
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.2 Indirect programming
Example
For an active synchronous spindle coupling between the leading spindle S1 and the following
spindle S2, the following replacement cycle to position the spindle is called using the SPOS
command in the main program.
Positioning is realized using the statement in N2230:
SPOS[1]=GP($P_SUB_SPOSIT,$P_SUB_SPOSMODE) SPOS[2]=GP($P_SUB_SPOSIT,
$P_SUB_SPOSMODE)
The position to be approached is read from the system variable $P_SUB_SPOSIT; the position
approach mode is read from the system variable $P_SUB_SPOSMODE.
Program code
Comment
N1000 PROC LANG_SUB DISPLOF SBLOF
N2100 IF($P_SUB_AXFCT==2)
N2110
; Replacement of the SPOS / SPOSA / M19
command for an active synchronous spindle
coupling
N2185 DELAYFSTON
; Start of stop delay area
N2190 COUPOF(S2,S1)
; Deactivate synchronous spindle coupling
N2200
; Position leading and following spindles
N2210 IF($P_SUB_SPOS==TRUE) OR
($P_SUB_SPOSA==TRUE)
N2220
; Positioning the spindle with SPOS:
N2230
SPOS[1]=GP($P_SUB_SPOSIT,
$P_SUB_SPOSMODE)
SPOS[2]=GP($P_SUB_SPOSIT,
$P_SUB_SPOSMODE)
N2250 ELSE
N2260
; Positioning the spindle using M19:
N2270 M1=19 M2=19
; Position leading and following spindles
N2280 ENDIF
N2285 DELAYFSTOF
; End of stop delay area
N2290 COUPON(S2,S1)
; Activate synchronous spindle coupling
N2410 ELSE
N2420
; Query on further replacements
N3300 ENDIF
N9999 RET
Supplementary conditions
● The indirect programming of position attributes is not possible in synchronized actions.
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
71
Flexible NC programming
2.2 Indirect programming
References
Function Manual Basic Functions; BAG, Channel, Program Operation, Reset Response (K1),
Section: Replacement of NC functions by subprograms
2.2.4
Indirectly programming part program lines (EXECSTRING)
Using the part program command EXECSTRING, it is possible to execute a previously
generated string variable as part program line.
Syntax
EXECSTRING is programmed in a separate part program line:
EXECSTRING (<string_variable>)
Meaning
EXECSTRING:
Command to execute a string variable as part program line
<string variable>:
Type STRING variable, that includes the actual part program line to be
executed
Note
With EXECSTRING, all part program constructions that can be programmed in the program
section of a part program, with the exception of control structures (Page 113), can be extracted.
This means that PROC and DEF statements are excluded as well as the general use in INI and
DEF files.
Example
Program code
Comment
N100 DEF STRING[100] MY_BLOCK
; Definition of string variables to accept the part
program line to be executed.
N110 DEF STRING[10] MFCT1="M7"
N200 EXECSTRING(MFCT1 <<
; Execute part program line "M7 M4711".
"M4711")
N300 R10=1
N310 MY_BLOCK="M3"
N320 IF(R10)
N330 MY_BLOCK = MY_BLOCK <<
MFCT1
N340 ENDIF
N350 EXECSTRING(MY_BLOCK)
; Execute part program line "M3 M7".
Job Planning
72
Programming Manual, 12/2018, A5E40869460B AB
Flexible NC programming
2.3 Arithmetic functions
2.3
Arithmetic functions
Operator / arithmetic function
Meaning
+
Addition
-
Subtraction
*
Multiplication
/ 1)
Division 1)
DIV 1)
Integer number division 1)
MOD 1)
Modulo division (supplies the remainder of the integer number divi-
sion) 1)
:
Chain operator for FRAME variables
SIN()
Sine
COS()
Cosine
TAN()
Tangent
ASIN()
Arc sine
ACOS()
Arc cosine
ATAN2(,) 1)
Arc tangent2 1)
SQRT()
Square root
ABS()
Absolute value
POT()
2nd power (square)
TRUNC()
Integer component
The accuracy for comparison commands can be set using TRUNC
(see "Precision correction on comparison errors (TRUNC)
(Page 78)")
ROUND()
Round to integer
LN()
Natural logarithm
EXP()
Exponential function
MINVAL ()
Lower value of two variables
(see "Variable minimum, maximum and range (MINVAL, MAXVAL
and BOUND) (Page 80)")
MAXVAL ()
Larger value of two variables
(see "Variable minimum, maximum and range (MINVAL, MAXVAL
and BOUND) (Page 80)")
BOUND ()
Variable value within the defined value range
(see "Variable minimum, maximum and range (MINVAL, MAXVAL
and BOUND) (Page 80)")
CTRANS()
Offset
CROT ()
Rotation
CSCALE()
Change of scale
CMIRROR()
Mirroring
1) See the paragraph, "Examples"
Job Planning
Programming Manual, 12/2018, A5E40869460B AB
73
Flexible NC programming
2.3 Arithmetic functions
Programming
The usual mathematical notation is used for arithmetic functions. Priorities for execution are
indicated by parentheses. Angles are specified for trigonometry functions and their inverse
functions (right angle = 90°).
Examples
Division: /
(type REAL) = type INT or type REAL) / (type INT or type REAL);
Example: 3 / 4 = 0.75
Integer number division: DIV
(type INT) = (type INT or REAL) / (type INT or REAL);
Example: 7 DIV 4.1 = 1
Modulo division (supplies the remainder of the integer number division): MOD
(type REAL) = (type INT or REAL) MOD (type INT or REAL);
Example: 7 MOD 4.1 = 2.9
Arc tangent 2: ATAN2
The arithmetic function ATAN2 calculates the angle of the total vector from two mutually
perpendicular vectors.
The result is in one of four quadrants (-180° < 0 < +180°).
The angular reference is always based on the 2nd value in the positive direction.
5
$7$1
$QJOH
r
QG YHFWRU
5
$7$1
$QJOH
r
QG YHFWRU
Job Planning
74
Programming Manual, 12/2018, A5E40869460B AB
|