Tool compensation values can be read and written using system variables. Usable variable numbers depend on the number of compensation pairs, whether a distinction is made between geometric compensation and wear compensation, and whether a distinction is made between tool length compensation and cutter compensation. When the number of compensation is not greater than 200, variables #2001 to #2400 can also be used.
Table 15.2 (b) System variables for tool compensation memory C
Compensation
Tool length compensation (H) Cutter compensation (D)
Compensation number Geometric
compensation Wear
compensation Geomet- ric com-
pensation
Wear com-
pensation
1 :
200 :
400
#11001(#2201) :
#11201(#2400) :
#11400
#10001(#2001) :
#10201(#2200) :
#10400
#13001 :
: #13400
#12001 :
: #12400
Table 15.2 (c) System variable for macro alarms
Variable number
Function
#3000 When a value from 0 to 200 is assigned to variable #3000, the CNC stops with an alarm. After an expression, an alarm message not longer than 26 characters can be described. The CRT screen displays alarm numbers by adding 3000 to the value in variable #3000 along with an alarm message.
Example: #3000=1(TOOL NOT FOUND); → The alarm screen displays “3001 TOOL NOT FOUND.”
Execution of the program can be stopped, and then a message can be displayed.
Variable number
Function
#3006 When “#3006=1 (MESSAGE);” is commanded in the macro, the program executes blocks up to the immediately previous one and then stops.
When a message of up to 26 characters, which is enclosed by a control–in character (“(”) and control–out character (“)”), is programmed in the same block, the message is displayed on the external operator message screen.
� Tool compensation values
� Macro alarms
� Stop with a message
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
310
Time information can be read and written.
Table 15.2 (d) System variables for time information
Variable number
Function
#3001 This variable functions as a timer that counts in 1–millisecond in- crements at all times. When the power is turned on, the value of this variable is reset to 0. When<PHONE_NUMBER> milliseconds is reached, the value of this timer returns to 0.
#3002 This variable functions as a timer that counts in 1–hour incre- ments when the cycle start lamp is on. This timer preserves its value even when the power is turned off. When 9544.371767 hours is reached, the value of this timer returns to 0.
#3011 This variable can be used to read the current date (year/month/ day). Year/month/day information is converted to an apparent decimal number. For example, September 28, 2001 is repre- sented as 20010928.
#3012 This variable can be used to read the current time (hours/minutes/ seconds). Hours/minutes/seconds information is converted to an apparent decimal number. For example, 34 minutes and 56 se- conds after 3 p.m. is represented as 153456.
The control state of automatic operation can be changed.
Table 15.2 (e) System variable (#3003) for automatic operation control
#3003 Single block Completion of an auxiliary function
0 Enabled To be awaited
1 Disabled To be awaited
2 Enabled Not to be awaited
3 Disabled Not to be awaited
When the power is turned on, the value of this variable is 0.
When single block stop is disabled, single block stop operation is not performed even if the single block switch is set to ON.
When a wait for the completion of auxiliary functions (M, S, and T functions) is not specified, program execution proceeds to the next block before completion of auxiliary functions. Also, distribution completion signal DEN is not output.
� Time information
� Automatic operation control
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
311
Table 15.2 (f) System variable (#3004) for automatic operation control
#3004 Feed hold Feedrate Override Exact stop
0 Enabled Enabled Enabled
1 Disabled Enabled Enabled
2 Enabled Disabled Enabled
3 Disabled Disabled Enabled
4 Enabled Enabled Disabled
5 Disabled Enabled Disabled
6 Enabled Disabled Disabled
7 Disabled Disabled Disabled
When the power is turned on, the value of this variable is 0.
When feed hold is disabled:
(1) When the feed hold button is held down, the machine stops in the single block stop mode. However, single block stop operation is not performed when the single block mode is disabled with variable #3003.
(2) When the feed hold button is pressed then released, the feed hold lamp comes on, but the machine does not stop; program execution continues and the machine stops at the first block where feed hold is enabled.
When feedrate override is disabled, an override of 100% is always applied regardless of the setting of the feedrate override switch on the machine operator’s panel.
When exact stop check is disabled, no exact stop check (position check) is made even in blocks including those which do not perform cutting.
O0001 ; N1 G00 G91 X#24 Y#25 ; N2 Z#18 ;
G04 ; N3 #3003=3 ; N4 #3004=7 ; N5 G01 Z#26 F#9 ; N6 M04 ; N7 G01 Z–[ROUND[#18]+ROUND[#26]] ;
G04 ; N8 #3004=0 ; N9 #3003=0 ; N10M03 ;
M99 ;
Fig. 15.2 Example of using variable #3004 in a tapping cycle
N1
N2
N3, N4
N6
N7
N8, N9, N10
N5
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
312
Settings can be read and written. Binary values are converted to decimals.
#9 (FCV) : Whether to use the FS15 tape format conversion capability #5 (SEQ) : Whether to automatically insert sequence numbers #2 (INI) : Millimeter input or inch input #1 (ISO) : Whether to use EIA or ISO as the output code #0 (TVC) : Whether to make a TV check
#15 #14 #13 #12 #11 #10 #9 #8
FCVSetting
#7 #6 #5 #4 #3 #2 #1 #0
SEQ INI ISO TVCSetting
#3005
The mirror–image status for each axis set using an external switch or setting operation can be read through the output signal (mirror–image check signal). The mirror–image status present at that time can be checked. (See III–4.6) The value obtained in binary is converted into decimal notation.
#7 #6 #5 #4 #3 #2 #1 #0
Setting
#3007
4th axis 3th axis 2th axis 1th axis
For each bit, 0 (mirror–image function is disabled)
or 1 (mirror–image function is enabled)
is indicated.
Example : If #3007 is 3, the mirror–image function is enabled for the first and second axes.
When the mirror–image function is set for a certain axis by both the mirror–image signal and setting, the signal value and setting value are ORed and then output.
When mirror–image signals for axes other than the controlled axes are turned on, they are still read into system variable #3007.
System variable #3007 is a write–protected system variable. If an attempt is made to write data in the variable, P/S 116 alarm “WRITE PROTECTED VARIABLE” is issued.
The number (target number) of parts required and the number (completion number) of machined parts can be read and written.
Table 15.2 (g) System variables for the number of parts required and the number of machined parts
Variable number Function
#3901 Number of machined parts (completion number)
#3902 Number of required parts (target number)
� -�����"�
� Mirror image
� Number of machined parts
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
313
NOTE Do not substitute a negative value.
Modal information specified in blocks up to the immediately preceding block can be read.
Table 15.2 (h) System variables for modal information
Variable number Function
#4001
#4002 #4003 #4004 #4005 #4006 #4007 #4008 #4009 #4010 #4011 #4012 #4013 #4014 #4015 #4016 : #4022 #4102 #4107 #4109 #4111 #4113 #4114 #4115 #4119 #4120 #4130
G00, G01, G02, G03, G33, G75, G77, G78, G79 (Group 01) G17, G18, G19 (Group 02) G90, G91 (Group 03) G22, G23 (Group 04) G94, G95 (Group 05) G20, G21 (Group 06) G40, G41, G42 (Group 07) G43, G44, G49 (Group 08) G73, G74, G76, G80–G89 (Group 09) G98, G99 (Group 10) G50, G51 (Group 11) G66, G67 (Group 12) G96,G97 (Group 13) G54–G59 (Group 14) G61–G64 (Group 15) G68, G69 (Group 16) : : G50.1, G51.1 (Group 22) B code D code F code H code M code Sequence number Program number S code T code P code (number of the currently selected addition- al workpiece coordinate system)
Example: When #1=#4002; is executed, the resulting value in #1 is 17, 18, or 19. If the specified system variable for reading modal information corresponds to a G code group which cannot be used, a P/S alarm is issued.
� Modal information
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
314
Position information cannot be written but can be read.
Table 15.2 (i) System variables for position information
Variable number
Position information
Coordinate system
Tool com- pensation
value
Read operation
during movement
#5001–#5004 Block end point Workpiece coordinate system
Not included
Enabled
#5021–#5024 Current position Machine coordinate system
Included Disabled
#5041–#5044 Current position Workpiece coordinate
#5061–#5064 Skip signal position coordinate system Enabled
#5081–#5084 Tool length offset value
Disabled
#5101–#5104 Deviated servo position
The first digit (from 1 to 4) represents an axis number.
The tool length offset value currently used for execution rather than the immediately preceding tool offset value is held in variables #5081 to 5088.
The tool position where the skip signal is turned on in a G31 (skip function) block is held in variables #5061 to #5068. When the skip signal is not turned on in a G31 block, the end point of the specified block is held in these variables.
When read during movement is “disabled,” this means that expected values cannot be read due to the buffering (preread) function.
� Current position
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
315
Workpiece zero point offset values can be read and written.
Table 15.2 (j) System variables for workpiece zero point offset values
Variable number Function
#5201 : #5204
First–axis external workpiece zero point offset value : Fourth–axis external workpiece zero point offset value
#5221 : #5224
First–axis G54 workpiece zero point offset value : Fourth–axis G54 workpiece zero point offset value
#5241 : #5244
First–axis G55 workpiece zero point offset value : Fourth–axis G55 workpiece zero point offset value
#5261 : #5264
First–axis G56 workpiece zero point offset value : Fourth–axis G56 workpiece zero point offset value
#5281 : #5284
First–axis G57 workpiece zero point offset value : Fourth–axis G57 workpiece zero point offset value
#5301 : #5304
First–axis G58 workpiece zero point offset value : Fourth–axis G58 workpiece zero point offset value
#5321 : #5324
First–axis G59 workpiece zero point offset value : Fourth–axis G59 workpiece zero point offset value
#7001 : #7004
First–axis workpiece zero point offset value (G54.1 P1) : Fourth–axis workpiece zero point offset value
#7021 : #7024
First–axis workpiece zero point offset value (G54.1 P2) : Fourth–axis workpiece zero point offset value
: :
#7941 : #7944
First–axis workpiece zero point offset value (G54.1 P48) : Fourth–axis workpiece zero point offset value
� Workpiece coordinate system compensation values (workpiece zero point offset values)
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
316
The following variables can also be used:
Axis Function Variable number
First axis External workpiece zero point offset
G54 workpiece zero point offset
G55 workpiece zero point offset
G56 workpiece zero point offset
G57 workpiece zero point offset
G58 workpiece zero point offset
G59 workpiece zero point offset
#2500
#2501
#2502
#2503
#2504
#2505
#2506
#5201
#5221
#5241
#5261
#5281
#5301
#5321
Second axis
External workpiece zero point offset
G54 workpiece zero point offset
G55 workpiece zero point offset
G56 workpiece zero point offset
G57 workpiece zero point offset
G58 workpiece zero point offset
G59 workpiece zero point offset
#2600
#2601
#2602
#2603
#2604
#2605
#2606
#5202
#5222
#5242
#5262
#5282
#5302
#5322
Third axis External workpiece zero point offset
G54 workpiece zero point offset
G55 workpiece zero point offset
G56 workpiece zero point offset
G57 workpiece zero point offset
G58 workpiece zero point offset
G59 workpiece zero point offset
#2700
#2701
#2702
#2703
#2704
#2705
#2706
#5203
#5223
#5243
#5263
#5283
#5303
#5323
Fourth axis External workpiece zero point offset
G54 workpiece zero point offset
G55 workpiece zero point offset
G56 workpiece zero point offset
G57 workpiece zero point offset
G58 workpiece zero point offset
G59 workpiece zero point offset
#2800
#2801
#2802
#2803
#2804
#2805
#2806
#5204
#5224
#5244
#5264
#5284
#5304
#5324
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
317
The operations listed in Table 15.3 (a) can be performed on variables. The expression to the right of the operator can contain constants and/or variables combined by a function or operator. Variables #j and #K in an expression can be replaced with a constant. Variables on the left can also be replaced with an expression.
Table 15.3 (a) Arithmetic and logic operation
Function Format Remarks
Definition #i=#j
Sum Difference Product Quotient
#i=#j+#k; #i=#j–#k; #i=#j*#k; #i=#j/#k;
Sine Arcsine Cosine Arccosine Tangent Arctangent
#i=SIN[#j]; #i=ASIN[#j]; #i=COS[#j]; #i=ACOS[#j]; #i=TAN[#j]; #i=ATAN[#j]/[#k];
An angle is specified in de- grees. 90 degrees and 30 minutes is represented as 90.5 degrees.
Square root Absolute value Rounding off Rounding down Rounding up Natural logarithm Exponential function
#i=SQRT[#j]; #i=ABS[#j]; #i=ROUND[#j]; #i=FIX[#j]; #i=FUP[#j]; #i=LN[#j]; #i=EXP[#j];
OR XOR AND
#i=#j OR #k; #i=#j XOR #k; #i=#j AND #k;
A logical operation is per- formed on binary numbers bit by bit.
Conversion from BCD to BIN Conversion from BIN to BCD
#i=BIN[#j]; #i=BCD[#j];
Used for signal exchange to and from the PMC
The units of angles used with the SIN, COS, ASIN, ACOS, TAN, and ATAN functions are degrees. For example, 90 degrees and 30 minutes is represented as 90.5 degrees.
The solution ranges are as indicated below: When the NAT bit (bit 0 of parameter 6004) is set to 0: 270� to 90� When the NAT bit (bit 0 of parameter 6004) is set to 1: –90� to 90�
When #j is beyond the range of –1 to 1, P/S alarm No. 111 is issued.
A constant can be used instead of the #j variable.
The solution ranges from 180° to 0°.
When #j is beyond the range of –1 to 1, P/S alarm No. 111 is issued.
A constant can be used instead of the #j variable.
15.3 ARITHMETIC AND LOGIC OPERATION
Explanations
� Angle units
� ARCSIN #i = ASIN[#j];
� ARCCOS #i = ACOS[#j];
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
318
Specify the lengths of two sides, separated by a slash (/).
The solution ranges are as follows:
When the NAT bit (bit 0 of parameter 6004) is set to 0: 0o to 360�
[Example] When #1 = ATAN[–1]/[–1]; is specified, #1 is 225.0.
When the NAT bit (bit 0 of parameter 6004) is set to 1: –180� to 180�
[Example] When #1 = ATAN[–1]/[–1]; is specified, #1 is –135.0.0.
A constant can be used instead of the #j variable.
Note that the relative error may become 10–8 or greater.
When the antilogarithm (#j) is zero or smaller, P/S alarm No. 111 is issued.
A constant can be used instead of the #j variable.
Note that the relative error may become 10–8 or greater.
When the result of the operation exceeds 3.65 � 1047 (j is about 110), an overflow occurs and P/S alarm No. 111 is issued.
A constant can be used instead of the #j variable.
When the ROUND function is included in an arithmetic or logic operation command, IF statement, or WHILE statement, the ROUND function rounds off at the first decimal place.
Example: When #1=ROUND[#2]; is executed where #2 holds 1.2345, the value of variable #1 is 1.0.
When the ROUND function is used in NC statement addresses, the ROUND function rounds off the specified value according to the least input increment of the address.
Example: Creation of a drilling program that cuts according to the values of variables #1 and #2, then returns to the original position Suppose that the increment system is 1/1000 mm, variable #1 holds 1.2345, and variable #2 holds 2.3456. Then, G00 G91 X–#1; Moves 1.235 mm. G01 X–#2 F300; Moves 2.346 mm. G00 X[#1+#2]; Since 1.2345 + 2.3456 = 3.5801, the travel distance
is 3.580, which does not return the tool to the original position.
This difference comes from whether addition is performed before or after rounding off. G00X–[ROUND[#1]+ROUND[#2]] must be specified to return the tool to the original position.
� ARCTAN #i = ATAN[#j]/[#k];
� Natural logarithm #i = LN[#j];
� Exponential function #i = EXP[#j];
� ROUND function
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
319
With CNC, when the absolute value of the integer produced by an operation on a number is greater than the absolute value of the original number, such an operation is referred to as rounding up to an integer. Conversely, when the absolute value of the integer produced by an operation on a number is less than the absolute value of the original number, such an operation is referred to as rounding down to an integer. Be particularly careful when handling negative numbers.
Example: Suppose that #1=1.2 and #2=–1.2. When #3=FUP[#1] is executed, 2.0 is assigned to #3. When #3=FIX[#1] is executed, 1.0 is assigned to #3. When #3=FUP[#2] is executed, –2.0 is assigned to #3. When #3=FIX[#2] is executed, –1.0 is assigned to #3.
When a function is specified in a program, the first two characters of the function name can be used to specify the function (See III–9.7).
Example: ROUND → RO FIX → FI
� Functions Operations such as multiplication and division (*, /, AND) Operations such as addition and subtraction (+, –, OR, XOR)
Example) #1=#2+#3*SIN[#4];
and indicate the order of operations.
�
� ,
Brackets are used to change the order of operations. Brackets can be used to a depth of five levels including the brackets used to enclose a function. When a depth of five levels is exceeded, P/S alarm No. 118 occurs.
Example) #1=SIN [ [ [#2+#3] *#4 +#5] *#6] ;
� to � indicate the order of operations. �
�
�
� Rounding up and down to an integer
� Abbreviations of arithmetic and logic operation commands
� Priority of operations
� Bracket nesting
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
320
Brackets ([, ]) are used to enclose an expression. Note that parentheses are used for comments.
Errors may occur when operations are performed.
Table 15.3 (b) Errors involved in operations
Operation Average error
Maximum error
Type of error
a = b*c 1.55×10–10 4.66×10–10
a = b / c 4.66×10–10 1.88×10–9
1.24×10–9 3.73×10–9
a = b + c a = b – c
2.33×10–10 5.32×10–10
a = SIN [ b ] a = COS [ b ]
5.0×10–9 1.0×10–8
a = ATAN [ b ] / [ c ] (*4)
1.8×10–6 3.6×10–6
NOTE 1 The relative error depends on the result of the operation. 2 Smaller of the two types of errors is used. 3 The absolute error is constant, regardless of the result of the
operation. 4 Function TAN performs SIN/COS. 5 When parameter No.6004#1 is set to 1, if the operation
result of an SIN, COS, or TAN function is less than 1.0 � 10–8 or does not fall to 0 due to the restraints of operation precision, the operation result can be normalized to 0.
The precision of variable values is about 8 decimal digits. When very large numbers are handled in an addition or subtraction, the expected results may not be obtained.
Example: When an attempt is made to assign the following values to variables #1 and #2: #1=9876543210123.456 #2=9876543277777.777 the values of the variables become: #1=9876543200000.000 #2=9876543300000.000 In this case, when #3=#2–#1; is calculated, #3=100000.000 results. (The actual result of this calculation is slightly different because it is performed in binary.)
;� �� �����
� Brackets
� Operation error
� a
a � b�
Relative error(*1)
�
b Min
� c”
(*2)
ε
Absolute error(*3)
degrees
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
321
Also be aware of errors that can result from conditional expressions using EQ, NE, GE, GT, LE, and LT.
Example: IF[#1 EQ #2] is effected by errors in both #1 and #2, possibly resulting in an incorrect decision. Therefore, instead find the difference between the two variables with IF[ABS[#1–#2]LT0.001]. Then, assume that the values of the two variables are equal when the difference does not exceed an allowable limit (0.001 in this case).
Also, be careful when rounding down a value.
Example: When #2=#1*1000; is calculated where #1=0.002;, the resulting value of variable #2 is not exactly 2 but 1.99999997. Here, when #3=FIX[#2]; is specified, the resulting value of variable #1 is not 2.0 but 1.0. In this case, round down the value after correcting the error so that the result is greater than the expected number, or round it off as follows: #3=FIX[#2+0.001] #3=ROUND[#2]
When a divisor of zero is specified in a division or TAN[90], P/S alarm No. 112 occurs.
� Divisor
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
322
The following blocks are referred to as macro statements: Blocks containing an arithmetic or logic operation (=) Blocks containing a control statement (such as GOTO, DO, END) Blocks containing a macro call command (such as macro calls by
G65, G66, G67, or other G codes, or by M codes) Any block other than a macro statement is referred to as an NC statement.
Even when single block mode is on, the machine does not stop. Note, however, that the machine stops in the single block mode when bit 5 of parameter SBM No. 6000 is 1.
Macro blocks are not regarded as blocks that involve no movement in the cutter compensation mode (see II–15.7).
NC statements that include a subprogram call command (such as subprogram calls by M98 or other M codes, or by T codes) and not include other command addresses except an O,N or L address have the same property as macro statements.
The blocks not include other command addresses except an O,N,P or L address have the same property as macro statements.
15.4 MACRO STATEMENTS AND NC STATEMENTS
��� � �����
� Differences from NC statements
� NC statements that have the same property as macro statements
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
323
In a program, the flow of control can be changed using the GOTO statement and IF statement. Three types of branch and repetition operations are used:
Branch and repetition GOTO statement (unconditional branch)
IF statement (conditional branch: if ..., then...)
WHILE statement (repetition while ...)
A branch to sequence number n occurs. When a sequence number outside of the range 1 to 99999 is specified, P/S alarm No. 128 occurs. A sequence number can also be specified using an expression.
GOTO n ; n: Sequence number (1 to 99999)
Example: GOTO1; GOTO#10;
15.5 BRANCH AND REPETITION
15.5.1 Unconditional Branch (GOTO Statement)
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
324
Specify a conditional expression after IF.
If the specified conditional expression is satisfied, a branch to sequence number n occurs. If the specified condition is not satisfied, the next block is executed.
IF [#1 GT 10] GOTO 2 ;
N2 G00 G91 X10.0 ; :
If the value of variable #1 is greater than 10, a branch to sequence number N2 occurs.
If the condi- tion is not sa- tisfied Processing If the condition is satisfied
If the specified conditional expression is satisfied, a predetermined macro statement is executed. Only a single macro statement is executed.
IF [#1 EQ #2] THEN#3=0 ;
If the values of #1 and #2 are the same, 0 is assigned to #3.
A conditional expression must include an operator inserted between two variables or between a variable and constant, and must be enclosed in brackets ([, ]). An expression can be used instead of a variable.
Operators each consist of two letters and are used to compare two values to determine whether they are equal or one value is smaller or greater than the other value. Note that the inequality sign cannot be used.
Table 15.5.2 Operators
Operator Meaning
EQ Equal to(=)
NE Not equal to( )
GT Greater than(>)
GE Greater than or equal to(�)
LT Less than(<)
LE Less than or equal to(�)
15.5.2 Conditional Branch (IF Statement)
IF[<conditional expression>]GOTOn
IF[<conditional expression>]THEN
��� � �����
� Conditional expression
� Operators
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
325
The sample program below finds the total of numbers 1 to 10.

Specify a conditional expression after WHILE. While the specified condition is satisfied, the program from DO to END is executed. If the specified condition is not satisfied, program execution proceeds to the block after END.
WHILE [conditional expression] DO m ; (m=1,2,3)
END m ; :
ProcessingIf the condi- tion is not sa- tisfied
If the condi- tion is satis- fied
While the specified condition is satisfied, the program from DO to END after WHILE is executed. If the specified condition is not satisfied, program execution proceeds to the block after END. The same format as for the IF statement applies. A number after DO and a number after END are identification numbers for specifying the range of execution. The numbers 1, 2, and 3 can be used. When a number other than 1, 2, and 3 is used, P/S alarm No. 126 occurs.
Sample program
15.5.3 Repetition (While Statement)
��� � �����
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
326
The identification numbers (1 to 3) in a DO–END loop can be used as many times as desired. Note, however, when a program includes crossing repetition loops (overlapped DO ranges), P/S alarm No. 124 occurs.
1. The identification numbers (1 to 3) can be used as many times as required.
WHILE [ … ] DO 1 ;
END 1 ; :
WHILE [ … ] DO 1 ;
END 1 ;
WHILE [ … ] DO 1 ;
END 1 ; :
WHILE [ … ] DO 2 ;
END 2 ;
WHILE [ … ] DO 1 ;
WHILE [ … ] DO 2 ; :
WHILE [ … ] DO 3 ; :
END 3 ; :
END 2 ; :
END 1 ;
WHILE [ … ] DO 1 ;
END 1 ;
IF [ … ] GOTO n ;
Nn
WHILE [ … ] DO 1 ;
END 1 ;
IF [ … ] GOTO n ;
Nn … ;
:
2. DO ranges cannot overlap.
Processing
Processing
Processing
Processing
Processing
3. DO loops can be nested to a maximum depth of three lev- els.
4. Control can be transferred to the outside of a loop.
5. Branches cannot be made to a location within a loop.
When DO m is specified without specifying the WHILE statement, an infinite loop ranging from DO to END is produced.
When a branch to the sequence number specified in a GOTO statement occurs, the sequence number is searched for. For this reason, processing in the reverse direction takes a longer time than processing in the forward direction. Using the WHILE statement for repetition reduces processing time.
In a conditional expression that uses EQ or NE, a <vacant> and zero have different effects. In other types of conditional expressions, a <vacant> is regarded as zero.
� Nesting
;� �� �����
� Infinite loops
� Processing time
� Undefined variable
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
327
The sample program below finds the total of numbers 1 to 10.
O0001; #1=0; #2=1; WHILE[#2 LE 10]DO 1; #1=#1+#2; #2=#2+1; END 1; M30;
Sample program
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
328
A macro program can be called using the following methods:
Macro call Simple call (G65) modal call (G66, G67) Macro call with G code Macro call with M code Subprogram call with M code Subprogram call with T code
Macro call (G65) differs from subprogram call (M98) as described below.
With G65, an argument (data passed to a macro) can be specified. M98 does not have this capability.
When an M98 block contains another NC command (for example, G01 X100.0 M98Pp), the subprogram is called after the command is executed. On the other hand, G65 unconditionally calls a macro.
When an M98 block contains another NC command (for example, G01 X100.0 M98Pp), the machine stops in the single block mode. On the other hand, G65 does not stops the machine.
With G65, the level of local variables changes. With M98, the level of local variables does not change.
15.6 MACRO CALL
;� �� �����
� Differences between macro calls and subprogram calls
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
329
When G65 is specified, the custom macro specified at address P is called. Data (argument) can be passed to the custom macro program.
G65 P p L � <argument–specification> ;
P : Number of the program to call � : Repetition count (1 by default) Argument : Data passed to the macro
O0001 ; : G65 P9010 L2 A1.0 B2.0 ; : M30 ;
O9010 ; #3=#1+#2 ; IF [#3 GT 360] GOTO 9 ; G00 G91 X#3 ; N9 M99 ;
After G65, specify at address P the program number of the custom macro to call.
When a number of repetitions is required, specify a number from 1 to 9999 after address L. When L is omitted, 1 is assumed.
By using argument specification, values are assigned to corresponding local variables.
Two types of argument specification are available. Argument specification I uses letters other than G, L, O, N, and P once each. Argument specification II uses A, B, and C once each and also uses I, J, and K up to ten times. The type of argument specification is determined automatically according to the letters used.
Argument specification I
A B C D E F H
#1 #2 #3 #7 #8 #9 #11
I J K M Q R S
#4 #5 #6 #13 #17 #18 #19
T U V W X Y Z
#20 #21 #22 #23 #24 #25 #26
Address Address AddressVariable number
Variable number
Variable number
Addresses G, L, N, O, and P cannot be used in arguments.
Addresses that need not be specified can be omitted. Local variables corresponding to an omitted address are set to null.
Addresses do not need to be specified alphabetically. They conform to word address format. I, J, and K need to be specified alphabetically, however.
Example
B_A_D_ … J_K_ Correct B_A_D_ … J_I_ Incorrect
15.6.1 Simple Call (G65)
��� � �����
� Call
� Argument specification
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
330
Argument specification II Argument specification II uses A, B, and C once each and uses I, J, and K up to ten times. Argument specification II is used to pass values such as three–dimensional coordinates as arguments.
A B C I1 J1 K1 I2 J2 K2 I3 J3
#1 #2 #3 #4 #5 #6 #7 #8 #9 #10 #11
K3 I4 J4 K4 I5 J5 K5 I6 J6 K6 I7
#12 #13 #14 #15 #16 #17 #18 #19 #20 #21 #22
J7 K7 I8 J8 K8 I9 J9 K9 I10 J10 K10
#23 #24 #25 #26 #27 #28 #29 #30 #31 #32 #33
Address Variable number
Address Variable number
Address Variable number
Subscripts of I, J, and K for indicating the order of argument specification are not written in the actual program.
G65 must be specified before any argument.
The CNC internally identifies argument specification I and argument specification II. If a mixture of argument specification I and argument specification II is specified, the type of argument specification specified later takes precedence.
Example
G65 A1.0 B2.0 I–3.0 I4.0 D5.0 P1000;
<Variables> #1:1.0 #2:2.0 #3: #4:–3.0 #5: #6: #7:
When both the I4.0 and D5.0 arguments are commanded for variable #7 in this example, the latter, D5.0, is valid.
5.0
The units used for argument data passed without a decimal point correspond to the least input increment of each address. The value of an argument passed without a decimal point may vary according to the system configuration of the machine. It is good practice to use decimal points in macro call arguments to maintain program compatibility.
Calls can be nested to a depth of four levels including simple calls (G65) and modal calls (G66). This does not include subprogram calls (M98).
Local variables from level 0 to 4 are provided for nesting.
;� �� �����
� Format
� Mixture of argument specifications I and II
� Position of the decimal point
� Call nesting
� Local variable levels
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
331
The level of the main program is 0.
Each time a macro is called (with G65 or G66), the local variable level is incremented by one. The values of the local variables at the previous level are saved in the CNC.
When M99 is executed in a macro program, control returns to the calling program. At that time, the local variable level is decremented by one; the values of the local variables saved when the macro was called are restored.
O0001 ; : #1=1 ; G65 P2 A2 ; : : M30 ;
O0002 ; : #1=2; G65 P3 A3 ; : : M99 ;
O0003 ; : #1=3; G65 P4 A4 ; : : M99 ;
O0004 ; : #1=4; G65 P5 A5 ; : : M99 ;
O0005 ; : #1=5; : : : M99 ;
#1 1
::
#33
#1 2
::
#33
#1 3
::
#33
#1 4
::
#33
#1 5
::
#33
#100–, #500–
Main program (level 0) Macro (level 1) Macro (level 2) Macro (level 3)
Macro (level 4)
Local variables (level 0) (Level 1) (Level 2) (Level 3) (Level 4)
Common variables
Variables that can be read from and written to by macros at different levels
A macro is created which drills H holes at intervals of B degrees after a start angle of A degrees along the periphery of a circle with radius I. The center of the circle is (X,Y). Commands can be specified in either the absolute or incremental mode. To drill in the clockwise direction, specify a negative value for B.
ÉÉÉ ÉÉÉ ÉÉÉ
ÉÉ ÉÉ ÉÉ
ÉÉ ÉÉ ÉÉ
H=3
H=4
H=2 H=1
A
BB
Center (X,Y) Radius I
Sample program (bolt hole circle)
PROGRAMMING15.

   M99;
Meaning of variables:
#3: Stores the G code of group 3. #5: X coordinate of the next hole to drill #6: Y coordinate of the next hole to drill
� Calling format
� Program calling a macro program
� Macro program (called program)
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
333
Once G66 is issued to specify a modal call a macro is called after a block specifying movement along axes is executed. This continues until G67 is issued to cancel a modal call.
O0001 ; : G66 P9100 L2 A1.0 B2.0 ; G00 G90 X100.0 ; Y200.0 ; X150.0 Y300.0 ; G67 ; : M30 ;
O9100 ; : G00 Z–#1 ; G01 Z–#2 F300 ; : : : : M99 ;
G66 P p L � <argument–specification> ;
P : Number of the program to call � : Repetition count (1 by default) Argument : Data passed to the macro
After G66, specify at address P a program number subject to a modal call.
When a number of repetitions is required, a number from 1 to 9999 can be specified at address L.
As with a simple call (G65), data passed to a macro program is specified in arguments.
When a G67 code is specified, modal macro calls are no longer performed in subsequent blocks.
Calls can be nested to a depth of four levels including simple calls (G65) and modal calls (G66). This does not include subprogram calls (M98).
Modal calls can be nested by specifying another G66 code during a modal call.
In a G66 block, no macros can be called.
G66 needs to be specified before any arguments.
No macros can be called in a block which contains a code such as a miscellaneous function that does not involve movement along an axis.
Local variables (arguments) can only be set in G66 blocks. Note that local variables are not set each time a modal call is performed.
15.6.2 Modal Call (G66)
��� � �����
� Call
� Cancellation
� Call nesting
� Modal call nesting
;� �� �����
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
334
The same operation as the drilling canned cycle G81 is created using a custom macro and the machining program makes a modal macro call. For program simplicity, all drilling data is specified using absolute values.
Z=0
R
Z
The canned cycle consists of the following basic operations:
Operation 1: Positioning along the X–axis and Y–axis
Operation 2: Rapid traverse to point R
Operation 3: Cutting feed to point Z
Operation 4: Rapid traverse to point R or I
Rapid traverse
Cutting feed
Operation 1 Position I
Operation 2 Operation 4
Position R
Operation 3
Position Z
G65 P9110 X x Y y Z z R r F f L l ;
X: X coordinate of the hole (absolute specification only) (#24). . . . Y: Y coordinate of the hole (absolute specification only) (#25). . . . Z : Coordinates of position Z (absolute specification only) (#26). . . R: Coordinates of position R (absolute specification only) (#18). . .
M99;
Sample program
� Calling format
� Program that calls a macro program
� Macro program (program called)
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
335
By setting a G code number used to call a macro program in a parameter, the macro program can be called in the same way as for a simple call (G65).
O0001 ; : G81 X10.0 Y20.0 Z–10.0 ; : M30 ;
O9010 ; : : : N9 M99 ;
Parameter No.6050 = 81
By setting a G code number from 1 to 9999 used to call a custom macro program (O9010 to O9019) in the corresponding parameter (N0.6050 to No.6059), the macro program can be called in the same way as with G65. For example, when a parameter is set so that macro program O9010 can be called with G81, a user–specific cycle created using a custom macro can be called without modifying the machining program.
O9010 O9011 O9012 O9013 O9014 O9015 O9016 O9017 O9018 O9019
6050 6051 6052 6053 6054 6055 6056 6057 6058 6059
Program number Parameter number
As with a simple call, a number of repetitions from 1 to 9999 can be specified at address L.
As with a simple call, two types of argument specification are available: Argument specification I and argument specification II. The type of argument specification is determined automatically according to the addresses used.
In a program called with a G code, no macros can be called using a G code. A G code in such a program is treated as an ordinary G code. In a program called as a subprogram with an M or T code, no macros can be called using a G code. A G code in such a program is also treated as an ordinary G code.
15.6.3 Macro Call Using G Code
��� � �����
� Correspondence between parameter numbers and program numbers
� Repetition
� Argument specification
;� �� �����
� Nesting of calls using G codes
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
336
By setting an M code number used to call a macro program in a parameter, the macro program can be called in the same way as with a simple call (G65).
O0001 ; : M50 A1.0 B2.0 ; : M30 ;
O9020 ; : : : M99 ;
Parameter No.6080 = 50
By setting an M code number from 1 to 99999999 used to call a custom macro program (9020 to 9029) in the corresponding parameter (No.6080 to No.6089), the macro program can be called in the same way as with G65.
O9020 O9021 O9022 O9023 O9024 O9025 O9026 O9027 O9028 O9029
6080 6081 6082 6083 6084 6085 6086 6087 6088 6089
Program number Parameter number
As with a simple call, a number of repetitions from 1 to 9999 can be specified at address L.
As with a simple call, two types of argument specification are available: Argument specification I and argument specification II. The type of argument specification is determined automatically according to the addresses used.
An M code used to call a macro program must be specified at the start of a block.
In a macro called with a G code or in a program called as a subprogram with an M or T code, no macros can be called using an M code. An M code in such a macro or program is treated as an ordinary M code.
15.6.4 Macro Call Using an M Code
��� � �����
� Correspondence between parameter numbers and program numbers
� Repetition
� Argument specification
;� �� �����
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
337
By setting an M code number used to call a subprogram (macro program) in a parameter, the macro program can be called in the same way as with a subprogram call (M98).
O0001 ; : M03 ; : M30 ;
O9001 ; : : : M99 ;
Parameter No.6071 = 03
By setting an M code number from 1 to 99999999 used to call a subprogram in a parameter (No.6071 to No. 6079), the corresponding custom macro program (O9001 to O9009) can be called in the same way as with M98.
O9001 O9002 O9003 O9004 O9005 O9006 O9007 O9008 O9009
6071 6072 6073 6074 6075 6076 6077 6078 6079
Program number Parameter number
As with a simple call, a number of repetitions from 1 to 9999 can be specified at address L.
Argument specification is not allowed.
An M code in a macro program that has been called is treated as an ordinary M code.
In a macro called with a G code or in a program called with an M or T code, no subprograms can be called using an M code. An M code in such a macro or program is treated as an ordinary M code.
15.6.5 Subprogram Call Using an M Code
��� � �����
� Correspondence between parameter numbers and program numbers
� Repetition
� Argument specification
� M code
;� �� �����
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
338
By enabling subprograms (macro program) to be called with a T code in a parameter, a macro program can be called each time the T code is specified in the machining program.
O0001 ; : T23 ; : M30 ;
O9000 ; : : : M99 ;
Bit 5 of parameter 6001 = 1
By setting bit 5 of parameter TCS No.6001 to 1, the macro program O9000 can be called when a T code is specified in the machining program. A T code specified in a machining program is assigned to common variable #149.
In a macro called with a G code or in a program called with an M or T code, no subprograms can be called using a T code. A T code in such a macro or program is treated as an ordinary T code.
15.6.6 Subprogram Calls Using a T Code
��� � �����
� Call
;� �� �����
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
339
By using the subprogram call function that uses M codes, the cumulative usage time of each tool is measured.
The cumulative usage time of each of tools T01 to T05 is measured. No measurement is made for tools with numbers greater than T05.
The following variables are used to store the tool numbers and measured times:
#501
#502
#503
#504
#505
Cumulative usage time of tool number 1
Cumulative usage time of tool number 2
Cumulative usage time of tool number 3
Cumulative usage time of tool number 4
Cumulative usage time of tool number 5
Usage time starts being counted when the M03 command is specified and stops when M05 is specified. System variable #3002 is used to measure the time during which the cycle start lamp is on. The time during which the machine is stopped by feed hold and single block stop operation is not counted, but the time used to change tools and pallets is included.
Set 3 in parameter No.6071, and set 05 in parameter No.6072.
Set 0 in variables #501 to #505.
     M30;
15.6.7 Sample Program
Conditions
Operation check
� Parameter setting
� Variable value setting
� Program that calls a macro program
PROGRAMMING15.

 M99;
Macro program (program called)
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
341
For smooth machining, the CNC prereads the NC statement to be performed next. This operation is referred to as buffering. During AI advanced preview control mode, the CNC prereads not only the next block but also the multiple blocks. And in the cutter compensation mode (G41, G42), the CNC prereads the NC statements two or three blocks ahead to find intersections even if the CNC is not in AI advanced preview control mode. Macro statements for arithmetic expressions and conditional branches are processed as soon as they are read into the buffer. Therefore, the timing of the macro statement execution is not always the specified order. At the blocks containing M00, M01, M02 or M30, blocks containing M–codes for which buffering is suppressed by setting parameter (No.3411–3432), and blocks containing prevention buffering G codes such as G53, the CNC stops to preread the NC statement after that. Then, the stop of the macro statement execution is guaranteed until such M codes or G codes complete its execution.
N1 G31 X100.0 ; N2 #100=1 :
>
> :Block being executed
NC statement execution
Macro statement execution
Buffer
N1
N2
NOTE In case that you need to execute the macro statement after completing the block just before the macro statement, specify M code or G code that are not buffered just before the macro statement. Specially, in case of reading / writing the system variables to control signals, coordinates, offset value, etc., it may different system variable data by the timing of the NC statement execution. To avoid this phenomenon, specify such M codes or G codes before the macro statement, if necessary.
15.7 PROCESSING MACRO STATEMENTS
15.7.1 Details of NC statements and macro statements execution
� When the next block is not buffered (M codes that are not buffered, G53, G31, etc.)
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
342
N1 X100.0 ;>
> : Block being executed � : Block read into the buffer
NC statement execution
Macro statement execution
Buffer
N1
N2 N3
N4
N2 #1=100 ; N3 #2=200 ; N4 Y200.0 ; :
N4
When N1 is being executed, the next NC statement (N4) is read into the buffer.The macro statements (N2, N3) between N1 and N4 are processed during execution of N1.
N1 G01 G41 G91 X50.0 Y30.0 F100 Dd ;>
> : Block being executed � : Blocks read into the buffer
NC statement execution
Macro statement execution
Buffer
N1
N2
N3
N2 #1=100 ; N3 X100.0 ; N4 #2=200 ; N5 Y50.0 ; :
N4
N5
N3
When N1 is being executed, the NC statements in the next two blocks (up to N5) are read into the buffer. The macro statements (N2, N4) between N1 and N5 are processed during execution of N1.
� Buffering the next block in other than cutter compensation mode (G41, G42) (normally prereading one block)
� Buffering the next block in cutter compensation mode (G41, G42)
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
343
N1 G01 G41 X100.0 G100 Dd ;>
> : Block being executed � : Blocks read into the buffer
N1
N2
N3
N2 #1=100 ; N3 Y100.0 ; N4 #2=200 ; N5 M08 ; N6 #3=300 ; N7 X200.0 ; :
N4
N3
N5
N6
N7
NC statement execution
Macro statement execution
Buffer
When the N1 is being executed, the NC statements in the next two blocks (up to N5) are read into the buffer. Since N5 is a block that involves no movement, an intersection cannot be calculated. In this case, the NC statements in the next three blocks (up to N7) are read. The macro statements (N2, N4, and N6) between N1 and N7 are processed during execution of N1.
In case of using the following system variables (Table 15.7.2) in macro program and you need to execute the macro program after completing the block execution just before the macro program, M code which can prevent buffering (parameter No.3411–3432) or G53 command block is necessary just before the macro program.
Table 15.7.2
Meaning Read Write
Number of Variable
Note (In case not to
command M code preventing buffering or
G53 block.)
Interface sig- nals
Read #1000 – #1015 , #1032
The data is read at buffering a macro program.
Write #1100 – #1115 , #1132
The data is written at buffering a macro program.
Tool com- pensation val- ues
Write #10001 – The data is written at buffering a macro program.
Macro alarms Write #3000 Macro alarm is generated at maximum 2 blocks before a macro program.
� When the next block involves no movement in cutter compensation C (G41, G42) mode
15.7.2 Caution for using system variables
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
344
Table 15.7.2
Meaning Note (In case not to
command M code preventing buffering or
G53 block.)
Number of Variable
Read Write
Program stop with message
Write #3006 Program stops at maximum 2 blocks before a macro program.
Time informa- tion
Read Write
#3001,#3002 The data is read / written at buffering a macro program.
Read #3011,#3012 The data is read at buffering a macro program.
Automatic op- eration control
Write #3003, #3004 Setting data is available at maximum 2 blocks before a macro program.
Settings Write #3005 The data is written at buffering a macro program.
Mirror image Read #3007 The data is read at buffering a macro program.
Currently se- lected additional workpiece coordinate system
Read #4130(P) #4014 (G54 – G59)
The data is read at maximum 3 blocks before a macro program.
Current posi- tion (Machine coordinate system)
Read #5021 – #5028 The uncertain position in moving is read.
Current posi- tion (Workpiece coordinate system)
Read #5041 – #5048 The uncertain position in moving is read.
Tool length offset value
Read #5081 – #5088 The offset value of current execution block is read.
Deviated ser- vo position
Read #5101 – #5108 The uncertain deviation in moving is read.
Workpiece zero point off- set value
Write #5201 – #5328 #7001 – #7948
The data is written at buffering a macro program.
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
345
Example)
O0001 O2000 N1 X10.Y10.; (Mxx ;) Specify preventing buffering M code or G53 N2 M98P2000; N100 #1=#5041; (Reading X axis current position) N3 Y200.0; N101 #2=#5042; (Reading Y axis current position) : :
M99;
In above case, the buffering of N2 block is done and the macro program of O2000 is read and executed during N1 block of main program O1000 execution. Therefore, the current position readings are executed during axes movements at N1 block. So the unexpected position data can be read to #1 and #2 because of axes movements. In this case, please specify M code preventing buffering Mxx ; (or G53 ;) just before N100 block of O2000. By this, the position data at completing the execution of N1 block can be read to #1 and #2 because O2000 is executed after completing the execution of N1 block of O0001.
NOTE G53 can not be specified during the canned cycle mode. (In this case, the P/S alarm No.44 is generated.) Therefore, in order to prevent buffering during the canned cycle mode, please specify preventing buffering M code.
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
346
Custom macro programs are similar to subprograms. They can be registered and edited in the same way as subprograms. The storage capacity is determined by the total length of tape used to store both custom macros and subprograms.
15.8 REGISTERING CUSTOM MACRO PROGRAMS
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
347
The macro call command can be specified in MDI mode. During automatic operation, however, it is impossible to switch to the MDI mode for a macro program call.
A custom macro program cannot be searched for a sequence number.
Even while a macro program is being executed, blocks can be stopped in the single block mode. A block containing a macro call command (G65, G66, or G67) does not stop even when the single block mode is on. Blocks containing arithmetic operation commands and control commands can be stopped in single block mode by setting SBM (bit 5 of parameter 6000) to 1. Single block stop operation is used for testing custom macro programs. Note that when a single block stop occurs at a macro statement in cutter compensation C mode, the statement is assumed to be a block that does not involve movement, and proper compensation cannot be performed in some cases. (Strictly speaking, the block is regarded as specifying a movement with a travel distance 0.)
A / appearing in the middle of an <expression> (enclosed in brackets [ ] on the right–hand side of an arithmetic expression) is regarded as a division operator; it is not regarded as the specifier for an optional block skip code.
By setting NE8 (bit 0 of parameter 3202) and NE9 (bit 4 of parameter 3202) to 1, deletion and editing are disabled for custom macro programs and subprograms with program numbers 8000 to 8999 and 9000 to 9999. This prevents registered custom macro programs and subprograms from being destroyed by accident. When the entire memory is cleared (by
pressing the RESET and DELETE keys at the same time to turn on the power),
the contents of memory such as custom macro programs are deleted.
With a reset operation, local variables and common variables #100 to #149 are cleared to null values. They can be prevented from clearing by setting, CLV and CCV (bits 7 and 6 of parameter 6001). System variables #1000 to #1133 are not cleared. A reset operation clears any called states of custom macro programs and subprograms, and any DO states, and returns control to the main program.
As with M98, the M and T codes used for subprogram calls are not displayed.
When a feed hold is enabled during execution of a macro statement, the machine stops after execution of the macro statement. The machine also stops when a reset or alarm occurs.
+0.0000001 to +99999999 –99999999 to –0.0000001 The number of significant digits is 8 (decimal). If this range is exceeded, P/S alarm No. 003 occurs.
15.9 LIMITATIONS
� MDI operation
� Sequence number search
� Single block
� Optional block skip
� Operation in EDIT mode
� Reset
� Display of the PROGRAM RESTART
� Feed hold
� Constant values that can be used in <expression>
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
348
In addition to the standard custom macro commands, the following macro commands are available. They are referred to as external output commands. – BPRNT – DPRNT – POPEN – PCLOS These commands are provided to output variable values and characters through the reader/punch interface.
Specify these commands in the following order:
Open command: POPEN Before specifying a sequence of data output commands, specify this command to establish a connection to an external input/output device.
Data output command: BPRNT or DPRNT Specify necessary data output.
Close command: PCLOS When all data output commands have completed, specify PCLOS to release a connection to an external input/output device.
POPEN POPEN establishes a connection to an external input/output device. It must be specified before a sequence of data output commands. The CNC outputs a DC2 control code.
BPRNT [ a #b [ c ] … ]
Number of significant decimal places Variable
Character
The BPRNT command outputs characters and variable values in binary.
(i) Specified characters are converted to the codes according to the setting data (ISO) that is output at that time. Specifiable characters are as follows: – Letters (A to Z) – Numbers – Special characters (*, /, +, –, etc.) An asterisk (*) is output by a space code.
(ii) All variables are stored with a decimal point. Specify a variable followed by the number of significant decimal places enclosed in brackets. A variable value is treated as 2–word (32–bit) data, including the decimal digits. It is output as binary data starting from the highest byte.
(iii) When specified data has been output, an EOB code is output according to the setting code (ISO).
(iv) Null variables are regarded as 0.
15.10 EXTERNAL OUTPUT COMMANDS
��� � �����
� Open command POPEN
� Data output command BPRNT
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
349
Example )
LF 12 (0000000C) M –1638400(FFE70000)
�
410 (0000019A) X Space �
BPRNT [ C** X#100 [3] Y#101 [3] M#10 [0] ] Variable value #100=0.40956 #101=–1638.4 #10=12.34
DPRNT [ a #b [ c d ] … ]
Number of significant decimal places
Number of significant digits in the integer part
Variable
Character
The DPRNT command outputs characters and each digit in the value of a variable according to the code set in the settings (ISO).
(i) For an explanation of the DPRNT command, see Items (i), (iii), and (iv) for the BPRNT command.
(ii) When outputting a variable, specify # followed by the variable number, then specify the number of digits in the integer part and the number of decimal places enclosed in brackets. One code is output for each of the specified number of digits, starting with the highest digit. For each digit, a code is output according to the settings (ISO). The decimal point is also output using a code set in the settings (ISO). Each variable must be a numeric value consisting of up to eight digits. When high–order digits are zeros, these zeros are not output if PRT (bit1 of parameter 6001) is 1. If parameter PRT is 0, a space code is output each time a zero is encountered. When the number of decimal places is not zero, digits in the decimal part are always output. If the number of decimal places is zero, no decimal point is output. When PRT (bit 1 of parameter 6001) is 0, a space code is output to indicate a positive number instead of +; if parameter PRT is 1, no code is output.
� Data output command DPRNT
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
350
Example )
sp
spspsp
sp
sp
DPRNT [ X#2 [53] Y#5 [53] T#30 [20] ] Variable value #2=128.47398 #5=–91.2 #30=123.456
(1) Parameter PRT(No.6001#1)=0
L F
T
Y –
X
91200
128474
23
sp
LF
T23
Y–91.200
X128.474
(2) Parameter PRT(No.6001#1)=0
PCLOS ; The PCLOS command releases a connection to an external input/output device. Specify this command when all data output commands have terminated. DC4 control code is output from the CNC.
Specify the channel use for setting data (I/O channel). According to the specification of this data, set data items (such as the baud rate) for the reader/punch interface. I/O channel 0 : Parameters (No.101, No.102 and No.103) I/O channel 1 : Parameters (No.111, No.112 and No.113) I/O channel 2 : Parameters (No.112, No.122 and No.123) Never specify the output device FANUC Cassette or Floppy for punching. When specifying a DPRNT command to output data, specify whether leading zeros are output as spaces (by setting PRT (bit 1 of parameter 6001) to 1 or 0). To indicate the end of a line of data in ISO code, specify whether to use only an LF (CRO, of bit 4 of parameter 6001 is 0) or an LF and CR (CRO of bit 4 of parameter 6001 is 1).
� Close command PCLOS
� Required setting
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
351
NOTE 1 It is not necessary to always specify the open command
(POPEN), data output command (BPRNT, DPRNT), and close command (PCLOS) together. Once an open command is specified at the beginning of a program, it does not need to be specified again except after a close command was specified.
2 Be sure to specify open commands and close commands in pairs. Specify the close command at the end of the program. However, do not specify a close command if no open command has been specified.
3 When a reset operation is performed while commands are being output by a data output command, output is stopped and subsequent data is erased. Therefore, when a reset operation is performed by a code such as M30 at the end of a program that performs data output, specify a close command at the end of the program so that processing such as M30 is not performed until all data is output.
4 Abbreviated macro words enclosed in brackets [ ] remains unchanged. However, note that when the characters in brackets are divided and input several times, the second and subsequent abbreviations are converted and input.
5 O can be specified in brackets [ ]. Note that when the characters in brackets [ ] are divided and input several times, O is omitted in the second and subsequent inputs.
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
352
When a program is being executed, another program can be called by inputting an interrupt signal (UINT) from the machine. This function is referred to as an interruption type custom macro function. Program an interrupt command in the following format:
M96 P���� ;
M97 ;
Enables custom macro interrupt
Disables custom macro interrupt
Use of the interruption type custom macro function allows the user to call a program during execution of an arbitrary block of another program. This allows programs to be operated to match situations which vary from time to time.
(1)When a tool abnormality is detected, processing to handle the abnormality is started by an external signal.
(2)A sequence of machining operations is interrupted by another machining operation without the cancellation of the current operation.
(3)At regular intervals, information on current machining is read. Listed above are examples like adaptive control applications of the interruption type custom macro function.
Interrupt signal (UINT)**
Interrupt signal (UINT)
Interrupt signal (UINT)*
M96 Pxxxx;
N����;
M97 ;
M99 (P����);
O xxxx;
Fig. 15.11 Interruption type custom macro function
When M96Pxxxx is specified in a program, subsequent program operation can be interrupted by an interrupt signal (UINT) input to execute the program specified by Pxxxx.
15.11 INTERRUPTION TYPE CUSTOM MACRO
��� �
��� � �����
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
353
CAUTION When the interrupt signal (UINT, marked by * in Fig. 15.11) is input after M97 is specified, it is ignored. And the interrupt signal must not be input during execution of the interrupt program.
A custom macro interrupt is available only during program execution. It is enabled under the following conditions – When memory operation or MDI operation is selected – When STL (start lamp) is on – When a custom macro interrupt is not currently being processed
Generally, the custom macro interrupt function is used by specifying M96 to enable the interrupt signal (UINT) and M97 to disable the signal. Once M96 is specified, a custom macro interrupt can be initiated by the input of the interrupt signal (UINT) until M97 is specified or the NC is reset. After M97 is specified or the NC is reset, no custom macro interrupts are initiated even when the interrupt signal (UINT) is input. The interrupt signal (UINT) is ignored until another M96 command is specified.
1 0
M96 M97 M96
Interrupt signal (UINT)
Effective interrupt input signal
When UINT is kept on
The interrupt signal (UINT) becomes valid after M96 is specified. Even when the signal is input in M97 mode, it is ignored. When the signal input in M97 mode is kept on until M96 is specified, a custom macro interrupt is initiated as soon as M96 is specified (only when the status–triggered scheme is employed); when the edge–triggered scheme is employed, the custom macro interrupt is not initiated even when M96 is specified.
15.11.1 Specification Method
��� � �����
� Interrupt conditions
� Specification
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
354
NOTE For the status–triggered and edge–triggered schemes, see Item “Custom macro interrupt signal (UINT)” of II– 15.11.2.
There are two types of custom macro interrupts: Subprogram–type interrupts and macro–type interrupts. The interrupt type used is selected by MSB (bit 5 of parameter 6003).
(a) Subprogram–type interrupt An interrupt program is called as a subprogram. This means that the levels of local variables remain unchanged before and after the interrupt. This interrupt is not included in the nesting level of subprogram calls.
(b) Macro–type interrupt An interrupt program is called as a custom macro. This means that the levels of local variables change before and after the interrupt. The interrupt is not included in the nesting level of custom macro calls. When a subprogram call or a custom macro call is performed within the interrupt program, this call is included in the nesting level of subprogram calls or custom macro calls. Arguments cannot be passed from the current program even when the custom macro interrupt is a macro–type interrupt.
In general, custom macro interrupts are controlled by M96 and M97. However, these M codes, may already being used for other purposes (such as an M function or macro M code call) by some machine tool builders. For this reason, MPR (bit 4 of parameter 6003) is provided to set M codes for custom macro interrupt control. When specifying this parameter to use the custom macro interrupt control M codes set by parameters, set parameters 6033 and 6034 as follows: Set the M code to enable custom macro interrupts in parameter 6033, and set the M code to disable custom macro interrupts in parameter 6034. When specifying that parameter–set M codes are not used, M96 and M97 are used as the custom macro control M codes regardless of the settings of parameters 6033 and 6034. The M codes used for custom macro interrupt control are processed internally (they are not output to external units). However, in terms of program compatibility, it is undesirable to use M codes other than M96 and M97 to control custom macro interrupts.
When performing a custom macro interrupt, the user may want to interrupt the NC statement being executed, or the user may not want to perform the interrupt until the execution of the current block is completed. MIN (bit 2 of parameter 6003)is used to select whether to perform interrupts even in the middle of a block or to wait until the end of the block.
15.11.2 Details of Functions
��� � �����
� Subprogram–type interrupt and macro–type interrupt
� M codes for custom macro interrupt control
� Custom macro interrupts and NC statements
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
355
(i) When the interrupt signal (UINT) is input, any movement or dwell being performed is stopped immediately and the interrupt program is executed.
(ii) If there are NC statements in the interrupt program, the command in the interrupted block is lost and the NC statement in the interrupt program is executed. When control is returned to the interrupted program, the program is restarted from the next block after the interrupted block.
(iii) If there are no NC statements in the interrupt program, control is returned to the interrupted program by M99, then the program is restarted from the command in the interrupted block.
ÉÉÉÉ ÉÉÉÉ ÉÉÉÉ
Execution in progress
Normal program
Interrupted by macro interrupt
Execution in progress
Interrupt signal (UINT) input
CNC command restart; when there are no NC state- ments in the interrupt pro- gram
Custom macro interrupt
(i) If the block being executed is not a block that consists of several cycle operations such as a drilling canned cycle and automatic reference position return (G28), an interrupt is performed as follows: When an interrupt signal (UINT) is input, macro statements in the interrupt program are executed immediately unless an NC statement is encountered in the interrupt program. NC statements are not executed until the current block is completed.
(ii) If the block being executed consists of several cycle operations, an interrupt is performed as follows: When the last movement in the cycle operations is started, macro statements in the interrupt program are executed unless an NC statement is encountered. NC statements are executed after all cycle operations are completed.
ÉÉÉ ÉÉÉ ÉÉÉ
Execution in progress
Normal program
Execution in progress
Interrupt signal (UINT) input
Custom macro interrupt
NC statement in the interrupt program
Type I (when an interrupt is performed even in the middle of a block)
Type II (when an interrupt is performed at the end of the block)
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
356
The interrupt signal becomes valid after execution starts of a block that contains M96 for enabling custom macro interrupts. The signal becomes invalid when execution starts of a block that contains M97. While an interrupt program is being executed, the interrupt signal becomes invalid. The signal become valid when the execution of the block that immediately follows the interrupted block in the main program is started after control returns from the interrupt program. In type I, if the interrupt program consists of only macro statements, the interrupt signal becomes valid when execution of the interrupted block is started after control returns from the interrupt program.
Even when cycle operation is in progress, movement is interrupted, and the interrupt program is executed. If the interrupt program contains no NC statements, the cycle operation is restarted after control is returned to the interrupted program. If there are NC statements, the remaining operations in the interrupted cycle are discarded, and the next block is executed.
When the last movement of the cycle operation is started, macro statements in the interrupt program are executed unless an NC statement is encountered. NC statements are executed after cycle operation is completed.
� Conditions for enabling and disabling the custom macro interrupt signal
� Custom macro interrupt during execution of a block that involves cycle operation
For type I
For type II
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
357
There are two schemes for custom macro interrupt signal (UINT) input: The status–triggered scheme and edge– triggered scheme. When the status–triggered scheme is used, the signal is valid when it is on. When the edge triggered scheme is used, the signal becomes valid on the rising edge when it switches from off to on status. One of the two schemes is selected with TSE (bit 3 of parameter 6003). When the status–triggered scheme is selected by this parameter, a custom macro interrupt is generated if the interrupt signal (UINT) is on at the time the signal becomes valid. By keeping the interrupt signal (UINT) on, the interrupt program can be executed repeatedly. When the edge–triggered scheme is selected, the interrupt signal (UINT) becomes valid only on its rising edge. Therefore, the interrupt program is executed only momentarily (in cases when the program consists of only macro statements). When the status–triggered scheme is inappropriate, or when a custom macro interrupt is to be performed just once for the entire program (in this case, the interrupt signal may be kept on), the edge–triggered scheme is useful. Except for the specific applications mentioned above, use of either scheme results in the same effects. The time from signal input until a custom macro interrupt is executed does not vary between the two schemes.
1
0
Interrupt signal (UINT)
Interrupt execution
Interrupt execution
Interrupt execution
Interrupt execution
Interrupt execution
Status–triggered scheme
Edge–triggered scheme
In the above example, an interrupt is executed four times when the status triggered scheme is used; when the edge– triggered scheme is used, the interrupt is executed just once.
� Custom macro interrupt signal (UINT)
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
358
To return control from a custom macro interrupt to the interrupted program, specify M99. A sequence number in the interrupted program can also be specified using address P. If this is specified, the program is searched from the beginning for the specified sequence number. Control is returned to the first sequence number found. When a custom macro interrupt program is being executed, no interrupts are generated. To enable another interrupt, execute M99. When M99 is specified alone, it is executed before the preceding commands terminate. Therefore, a custom macro interrupt is enabled for the last command of the interrupt program. If this is inconvenient, custom macro interrupts should be controlled by specifying M96 and M97 in the program. When a custom macro interrupt is being executed, no other custom macro interrupts are generated; when an interrupt is generated, additional interrupts are inhibited automatically. Executing M99 makes it possible for another custom macro interrupt to occur. M99 specified alone in a block is executed before the previous block terminates. In the following example, an interrupt is enabled for the Gxx block of O1234. When the signal is input, O1234 is executed again. O5678 is controlled by M96 and M97. In this case, an interrupt is not enabled for O5678 (enabled after control is returned to O1000).
M99;
GxxXxxx;
O1234
O1000;
M96P1234;
M96P5678
M97
O5678
GxxXxxx; M96; M99;
M97
Interrupt
Interrupt
Interrupt
Interrupt
� Return from a custom macro interrupt
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
359
NOTE When an M99 block consists only of address O, N, P, L, or M, this block is regarded as belonging to the previous block in the program. Therefore, a single–block stop does not occur for this block. In terms of programming, the following � and are basically the same. (The difference is whether G�� is executed before M99 is recognized.) � G�� X��� ;
M99 ; G�� X��� M99 ;
A custom macro interrupt is different from a normal program call. It is initiated by an interrupt signal (UINT) during program execution. In general, any modifications of modal information made by the interrupt program should not affect the interrupted program. For this reason, even when modal information is modified by the interrupt program, the modal information before the interrupt is restored when control is returned to the interrupted program by M99. When control is returned from the interrupt program to the interrupted program by M99 Pxxxx, modal information can again be controlled by the program. In this case, the new continuous information modified by the interrupt program is passed to the interrupted program. Restoration of the old modal information present before the interrupt is not desirable. This is because after control is returned, some programs may operate differently depending on the modal information present before the interrupt. In this case, the following measures are applicable:
(1)The interrupt program provides modal information to be used after control is returned to the interrupted program.
� Custom macro interrupt and modal information
PROGRAMMING15. CUSTOM MACRO B–64124EN/01
360
(2)After control is returned to the interrupted program, modal information is specified again as necessary.
O∆∆∆∆
M96Pxxx
N����;
M99(P����);
Oxxx;
Interrupt signal (UINT)
(Without P specification)
Modify modal information
Modal information remains unchanged before and after the interrupt.
(With P specification)
The new modal information modified by the interrupt program is present.
The modal information present before the interrupt becomes valid. The new modal information modified by the interrupt program is made invalid.
The new modal information modified by the interrupt program remains valid even after control is returned. The old modal information which was valid in the interrupted block can be read using custom macro system variables #4001 to #4120. Note that when modal information is modified by the interrupt program, system variables #4001 to #4120 are not changed.
The coordinates of point A can be read using system variables #5001 and up until the first NC statement is encountered.
The coordinates of point A’ can be read after an NC statement with no move specifications appears.
The machine coordinates and workpiece coordinates of point B’ can be read using system variables #5021 and up and #5041 and up.
B’
B
A’
A
Interrupt generated Tool center path
Offset vector
Programmed tool path
Modal information when control is returned by M99
Modal information when control is returned by M99 P����
� System variables (position information values) for the interrupt program
PROGRAMMINGB–64124EN/01 15. CUSTOM MACRO
361
When the interrupt signal (UINT) is input and an interrupt program is called, the custom macro modal call is canceled (G67). However, when G66 is specified in the interrupt program, the custom macro modal call becomes valid. When control is returned from the interrupt program by M99, the modal call is restored to the state it was in before the interrupt was generated. When control is returned by M99Pxxxx;, the modal call in the interrupt program remains valid.
When the interrupt signal (UINT) is input while a return operation is being performed in the dry run mode after the search operation for program restart, the interrupt program is called after restart operation terminates for all axes. This means that interrupt type II is used regardless of the parameter setting.
“Interruption type custom macro” cannot be done during DNC operation or executing a program with an external input–output device.
� Custom macro interrupt and custom macro modal call
� Custom macro interrupt and program restart
� DNC operation and Interruption type custom macro
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
362
16 PATTERN DATA INPUT FUNCTION This function enables users to perform programming simply by extracting numeric data (pattern data) from a drawing and specifying the numerical values from the MDI panel. This eliminates the need for programming using an existing NC language.
With the aid of this function, a machine tool builder can prepare the program of a hole machining cycle (such as a boring cycle or tapping cycle) using the custom macro function, and can store it into the program memory. This cycle is assigned pattern names, such as BOR1, TAP3, and DRL2.
An operator can select a pattern from the menu of pattern names displayed on the screen. Data (pattern data) which is to be specified by the operator should be created in advance with variables in a drilling cycle. The operator can identify these variables using names such as DEPTH, RETURN RELIEF, FEED, MATERIAL or other pattern data names. The operator assigns values (pattern data) to these names.
PROGRAMMINGB–64124EN/01 16. PATTERN DATA INPUT
FUNCTION
363
Pressing the OFFSETSETTING key and [MENU] is displayed on the following
pattern menu screen.
1. BOLT HOLE 2. GRID 3. LINE ANGLE 4. TAPPING 5. DRILLING 6. BORING 7. POCKET 8. PECK 9. TEST PATRN 10. BACK
MENU : HOLE PATTERN O0000 N00000
> _ MDI **** *** *** 16:05:59 [ MACRO ] [ MENU ] [ OPR ] [ ] [(OPRT)]
HOLE PATTERN : This is the menu title. An arbitrary character string consisting of up to 12 characters can be specified.
BOLT HOLE : This is the pattern name. An arbitrary character string consisting of up to 10 characters can be specified, including katakana.
The machine tool builder should specify the character strings for the menu title and pattern name using the custom macro, and load the character strings into program memory as a subprogram of program No. 9500.
16.1 DISPLAYING THE PATTERN MENU
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
364
Menu title : C1 C2 C3 C4 C5 C6 C7 C8 C9C10 C11 C12 C1,C2, ,C12 : Characters in the menu title (12 characters) Macro instruction G65 H90 Pp Qq Rr Ii Jj Kk : H90:Specifies the menu title p : Assume a1 and a2 to be the codes of characters C1 and C2. Then,
P��� ���
Code a2 of character C2
Code a1 of character C1
q : Assume a3 and a4 to be the codes of characters C3 and C4. Then, q=a3103+a4
r : Assume a5 and a6 to be the codes of characters C5 and C6. Then, r=a5103+a6
i : Assume a7 and a8 to be the codes of characters C7 and C8. Then, i=a7103+a8
j : Assume a9 and a10 to be the codes of characters C9 and C10. Then, j=a9103+a10
k : Assume a11 and a12 to be the codes of characters C11 and C12.Then, k=a11103+a12
Example) If the title of the menu is�HOLE PATTERN” then the macro instruction is as follows:
G65 H90 P072079 Q076069 R032080 HO LE P
I065084 J084069 K082078; AT TE RN
For codes corresponding to these characters, refer to the Table 16.3 (a) in II–16.3.
� . ��� �� ���
������!��" ��� ���
�����
PROGRAMMINGB–64124EN/01 16. PATTERN DATA INPUT
FUNCTION
365
Pattern name: C1 C2 C3 C4 C5 C6 C7 C8 C9C10 C1, C2, ,C10: Characters in the pattern name (10 characters) Macro instruction G65 H91 Pn Qq Rr Ii Jj Kk ; H91: Specifies the menu title n : Specifies the menu No. of the pattern name
n=1 to 10 q : Assume a1 and a2 to be the codes of characters C1 and C2. Then,
q=a1�103+a2 r : Assume a3 and a4 to be the codes of characters C3 and C4. Then,
r=a3�103+a4 i : Assume a5 and a6 to be the codes of characters C5 and C6. Then,
i=a5�103+a6 j : Assume a7 and a8 to be the codes of characters C7 and C8. Then,
j=a7�103+a8 k : Assume a9 and a10 to be the codes of characters C9 and C10. Then,
k=a9�103+a10 Example) If the pattern name of menu No. 1 is �BOLT HOLE ” then the
macro instruction is as follows. G65 H91 P1 Q066079 R076084 I032072 J079076 K069032 ;
BO LT H OL E For codes corresponding to these characters, refer to the Table 16.3 (a) in II–16.3.
To select a pattern from the pattern menu screen, enter the corresponding pattern No. The following is an example.
1 INPUT
The selected pattern No. is assigned to system variable #5900. The custom macro of the selected pattern can be started by starting a fixed program (external program No. search) with an external signal then referring to the system variable #5900 in the program.
NOTE If each characters of P, Q, R, I, J, and K are not specified in a macro instruction, two spaces are assigned to each omitted character.
� . ��� �����������
���������" ��� � �����
� �
� * ����� 8�< ���������
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
366
Custom macros for the menu title and hole pattern names.
1. BOLT HOLE 2. GRID 3. LINE ANGLE 4. TAPPING 5. DRILLING 6. BORING 7. POCKET 8. PECK 9. TEST PATRN 10. BACK
MENU : HOLE PATTERN O0000 N00000
> _ MDI **** *** *** 16:05:59 [ MACRO ] [ MENU ] [ OPR ] [ ] [ (OPRT) ]
O9500 ; N1 G65 H90 P072079 Q076069 R032080 I065084 J084069 K082078 ; HOLE PATTERN
N2 G65 H91 P1 Q066079 R076084 I032072 J079076 K069032 ; 1.BOLT HOLE
N3 G65 H91 P2 Q071082 R073068 ; 2.GRID
N4 G65 H91 P3 Q076073 R078069 I032065 J078071 K076069 ; 3.LINE ANGLE
N5 G65 H91 P4 Q084065 R080080 I073078 J071032 ; 4.TAPPING
N6 G65 H91 P5 Q068082 R073076 I076073 J078071 ; 5.DRILLING
N7 G65 H91 P6 Q066079 R082073 I078071 ; 6.BORING
N8 G65 H91 P7 Q080079 R067075 I069084 ; 7.POCKET
N9 G65 H91 P8 Q080069 R067075 ; 8.PECK
N10 G65 H91 P9 Q084069 R083084 I032080 J065084 K082078 ; 9.TEST PATRN
N11 G65 H91 P10 Q066065 R0670750 ; 10.BACK
N12 M99 ;
� ���
PROGRAMMINGB–64124EN/01 16. PATTERN DATA INPUT
FUNCTION
367
When a pattern menu is selected, the necessary pattern data is displayed.
NO. NAME DATA COMMENT 500 TOOL 0.000 501 STANDARD X 0.000 *BOLT HOLE 502 STANDARD Y 0.000 CIRCLE* 503 RADIUS 0.000 SET PATTERN 504 S. ANGL 0.000 DATA TO VAR. 505 HOLES NO 0.000 NO.500–505. 506 0.000 507 0.000
ACTUAL POSITION (RELATIVE) X 0.000 Y 0.000 Z 0.000
VAR. : BOLT HOLE O0001 N00000
> _ MDI **** *** *** 16:05:59 [ MACRO ] [ MENU ] [ OPR ] [ ] [(OPRT)]
BOLT HOLE : This is the pattern data title. A character string consisting of up to 12 characters can be set.
TOOL : This is the variable name. A character string consisting of up to 10 characters can be set.
*BOLT HOLE CIRCLE* : This is a comment statement. A character string can be displayed consisting of up to 8 lines, 12 characters per line.
(It is permissible to use katakana in a character string or line.) The machine tool builder should program the character strings of pattern data title, pattern name, and variable name using the custom macro, and load them into the program memory as a subprogram whose No. is 9500 plus the pattern No. (O9501 to O9510).
16.2 PATTERN DATA DISPLAY
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
368
Menu title : C1 C2 C3 C4 C5 C6 C7 C8 C9C10C11C12 C1 ,C2,…, C12 : Characters in the menu title (12 characters) Macro instruction G65 H92 Pp Qq Rr Ii Jj Kk ; H92 : Specifies the pattern name p : Assume a1 and a2 to be the codes of characters C1 and C2. Then,
p=a1�103+a2 q : Assume a3 and a4 to be the codes of characters C3 and C4. Then,
q=a3�103+a4 r : Assume a5 and a6 to be the codes of characters C5 and C6. Then,
r=a5�103+a6 i : Assume a7 and a8 to be the codes of characters C7 and C8. Then,
i=a7�103+a8 j : Assume a9 and a10 to be the codes of characters C9 and C10. Then,
j=a9�103+a10 k : Assume a11 and a12 to be the codes of characters C11 and C12. Then,
k=a11�103+a12 Example) Assume that the pattern data title is �BOLT HOLE .” The
macro instruction is given as follows:
G65 H92 P066079 Q076084 R032072 I079076 J069032; BO LT H OL E
For codes corresponding to these characters, refer to the Table 16.3 (a) in II–16.3.
Variable name : C1 C2 C3 C4 C5 C6 C7 C8 C9C10 C1, C2,…, C10 : Characters in the variable name (10 characters) Macro instruction G65 H93 Pp Qq Rr Ii Jj Kk ; H93 : Specifies the variable name p : Specifies the No. of the variable
p=100 to 149 (199), 500 to 531 (999) q : Assume a1 and a2 to be the codes of characters C1 and C2. Then,
q=a1�103+a2 r : Assume a3 and a4 to be the codes of characters C3 and C4. Then,
r=a3�103+a4 i : Assume a5 and a6 to be the codes of characters C5 and C6. Then,
i=a5�103+a6 j : Assume a7 and a8 to be the codes of characters C7 and C8. Then,
j=a7�103+a8 k : Assume a9 and a10 to be the codes of characters C9 and C10. Then,
k=a9�103a+a10 Example) Assume that the variable name of the variable No. 503 is
“RADIUS.” The macro instruction is given as follows:
G65 H93 P503 Q082065 R068073 I085083 ; RA DI US
For codes corresponding to these characters, refer to the Table 16.3 (a) in II–16.3.
. ��� �����������
������!��" ��� � �����
� � �����
(the menu title)
� . ��� �����������
������!��" ��� � �� ���
� �
PROGRAMMINGB–64124EN/01 16. PATTERN DATA INPUT
FUNCTION
369
One comment line: C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C1, C2,…, C12 : Character string in one comment line (12 characters) Macro instruction G65 H94 Pp Qq Rr Ii Jj Kk ; H94 : Specifies the comment p : Assume a1 and a2 to be the codes of characters C1 and C2. Then,
p=a1�103+a2 q : Assume a3 and a4 to be the codes of characters C3 and C4. Then,
q=a3�103+a4 r : Assume a5 and a6 to be the codes of characters C5 and C6. Then,
r=a5�103+a6 i : Assume a7 and a8 to be the codes of characters C7 and C8. Then,
i=a7�103+a8 j : Assume a9 and a10 to be the codes of characters C9 and C10. Then,
j=a9�103+a10 k : Assume a11 and a12 to be the codes of characters C11 and C12. Then,
k=a11�103+a12 A comment can be displayed in up to eight lines. The comment consists of the first line to the eighth line in the programmed sequence of G65 H94 for each line. Example) Assume that the comment is “BOLT HOLE.” The macro
instruction is given as follows:
G65 H94 P042066 Q079076 R084032 I072079 J076069; *B OL T HO LE
For codes corresponding to these characters, refer to the Table 16.3 (a) in II–16.3.
� . ��� ����������� ��
�������� �� ���
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
370
Macro instruction to describe a parameter title , the variable name, and a comment.
NO. NAME DATA COMMENT 500 TOOL 0.000 501 STANDARD X 0.000 *BOLT HOLE 502 STANDARD Y 0.000 CIRCLE* 503 RADIUS 0.000 SET PATTERN 504 S. ANGL 0.000 DATA TO VAR. 505 HOLES NO 0.000 NO.500–505. 506 0.000 507 0.000
ACTUAL POSITION (RELATIVE) X 0.000 Y 0.000 Z 0.000
VAR. : BOLT HOLE O0001 N00000
> _ MDI **** *** *** 16:05:59 [ MACRO ] [ MENU ] [ OPR ] [ ] [(OPRT)]
O9501 ; N1 G65 H92 P066079 Q076084 R032072 I079076 J069032 ; VAR : BOLT HOLE
N2 G65 H93 P500 Q084079 R079076 ; #500 TOOL
N3 G65 H93 P501 Q075073 R074085 I078032 J088032 ; #501 KIJUN X
N4 G65 H93 P502 Q075073 R074085 I078032 J089032 ; #502 KIJUN Y
N5 G65 H93 P503 Q082065 R068073 I085083 ; #503 RADIUS
N6 G65 H93 P504 Q083046 R032065 I078071 J076032 ; #504 S.ANGL
N7 G65 H93 P505 Q072079 R076069 I083032 J078079 K046032 ; #505 HOLES NO
N8 G65 H94 ; Comment
N9 G65 H94 P042066 Q079076 R084032 I072079 J076069 ; *BOLT HOLE
N10 G65 H94 R032067 I073082 J067076 K069042 ; CIRCLE*
N11 G65 H94 P083069 Q084032 080065 I084084 J069082 K078032 ; SET PATTERN
N12 G65 H94 P068065 Q084065 R032084 I079032 J086065 K082046 ; DATA NO VAR.
N13 G65 H94 P078079 Q046053 R048048 I045053 J048053 K046032; No.500–505
N14 M99 ;
Examples
PROGRAMMINGB–64124EN/01 16. PATTERN DATA INPUT
FUNCTION
371
Table. 16.3 (a) Characters and codes to be used for the pattern data input function
Char- acter Code Comment
Char- acter Code Comment
A 065 6 054 B 066 7 055 C 067 8 056 D 068 9 057 E 069 032 Space F 070 ! 033 Exclama–
tion mark G 071 ” 034 Quotation
mark H 072 # 035 Hash sign I 073 $ 036 Dollar sign J 074 % 037 Percent K 075 & 038 Ampersand L 076 ’ 039 Apostrophe M 077 ( 040 Left
parenthesis N 078 ) 041 Right
parenthesis O 079 * 042 Asterisk P 080 + 043 Plus sign Q 081 , 044 Comma R 082 – 045 Minus sign S 083 . 046 Period T 084 / 047 Slash U 085 : 058 Colon V 086 ; 059 Semicolon W 087 < 060 Left angle
bracket X 088 = 061 Equal sign Y 089 > 062 Right angle
bracket Z 090 ? 063 Question
mark 0 048 @ 064 HAt”mark 1 049 [ 091 Left square
bracket 2 050 ^ 092 3 051 ¥ 093 Yen sign 4 052 ] 094 Right squar
bracket 5 053 _ 095 Underscore
NOTE Right and left parentheses cannot be used.
16.3 CHARACTERS AND CODES TO BE USED FOR THE PATTERN DATA INPUT FUNCTION
PROGRAMMING 16. PATTERN DATA INPUT
FUNCTION B–64124EN/01
372
Table 16.3 (b) Numbers of subprograms employed in the pattern data input function
Subprogram No. Function
O9500 Specifies character strings displayed on the pattern data menu.
O9501 Specifies a character string of the pattern data corresponding to pattern No.1
O9502 Specifies a character string of the pattern data corresponding to pattern No.2
O9503 Specifies a character string of the pattern data corresponding to pattern No.3
O9504 Specifies a character string of the pattern data corresponding to pattern No.4
O9505 Specifies a character string of the pattern data corresponding to pattern No.5
O9506 Specifies a character string of the pattern data corresponding to pattern No.6
O9507 Specifies a character string of the pattern data corresponding to pattern No.7
O9508 Specifies a character string of the pattern data corresponding to pattern No.8
O9509 Specifies a character string of the pattern data corresponding to pattern No.9
O9510 Specifies a character string of the pattern data corresponding to pattern No.10
Table. 16.3 (c) Macro instructions used in the pattern data input function
G code H code Function
G65 H90 Specifies the menu title.
G65 H91 Specifies the pattern name.
G65 H92 Specifies the pattern data title.
G65 G93 Specifies the variable name.
G65 H94 Specifies the comment.
Table. 16.3 (d) System variables employed in the pattern data input function
System variable Function
#5900 Pattern No. selected by user.
PROGRAMMINGB–64124EN/01 17. PROGRAMMABLE PARAMETER
ENTRY (G10)
373
17 PROGRAMMABLE PARAMETER ENTRY (G10) The values of parameters can be entered in a lprogram. This function is used for setting pitch error compensation data when attachments are changed or the maximum cutting feedrate or cutting time constants are changed to meet changing machining conditions.
G10L50; Parameter entry mode setting N_R_; For parameters other than the axis type N_P_R_; For axis type parameters
G11; Parameter entry mode cancel
N_: Parameter No. (4digids) or compensation position No. for pitch errors compensation +10,000 (5digid)
R_: Parameter setting value (Leading zeros can be omitted.) P_: Axis No. 1 to 8 (Used for entering axis type parameters)
.� ���" �� �� ��
��� �
Do not use a decimal point in a value set in a parameter (R_). a decimal point cannot be used in a custom macro variable for R_either.
Specify an axis number (P_) from 1 to 8 (up to eight axes) for an axis type parameter. The control axes are numbered in the order in which they are displayed on theCNC display. For example, specity P2 for the control axis which is displayed second.
WARNING 1 Do not fail to perform reference point return manually after
changing the pitch error compensation data or backlash compensation data. Without this, the machine position can deviate from the correct position.
2 The canned–cycle mode must be cancelled before entering of parameters. When not cancelled, the drilling motion may be activated.
NOTE Other NC statements cannot be specified while in parameter input mode.
General
Format
Explanations � * � ���� ������"
� ��� (R_)
� ���� 8�<�*��
PROGRAMMING 17. PROGRAMMABLE PARAMETER
ENTRY (G10) B–64124EN/01
374
1. Set bit 2 (SBP) of bit type parameter No. 3404
G10L50 ; Parameter entry mode N3404 R 00000100 ; SBP setting G11 ; cancel parameter entry mode
2. Change the values for the Z–axis (3rd axis) and A–axis (4th axis) in axis type parameter No. 1322 (the coordinates of stored stroke limit 2 in the positive direction for each axis).
G10L50 ; Parameter entry mode N1322P3R4500 ; Modify Z axis N1322P4R12000 ; Modify A axis G11 ; cancel parameter entry mode
Examples
PROGRAMMINGB–64124EN/01 18. MEMORY OPERATION USING
FS10/11 TAPE FORMAT
375
18 MEMORY OPERATION USING FS10/11 TAPE FORMAT Memory operation of the program registered by FS10/11 tape format is possible with setting of the setting parameter (No. 0001#1).
Data formats for cutter compensation, subprogram calling, and canned cycles are different between this Series and Series 10/11. The Series 10/11 data formats can be processed for memory operation.Other data formats must comply with this Series. When a value out of the specified range for this Series is registered, an alarm occurs. Functions not available in this Series cannot be registered or used for memory operation.
Offset numbers are specified by address D in the Series 10/11. When an offset number is specified by address D, the modal value specified by address H is replaced with the offset number specified by address D.
If a subprogram number of more than four digits is specified, the four low–order digits are regarded as the subprogram number. If no repeat count is specified, 1 is assumed.
Table 18 (a) Subprogram call data format
CNC Data format
Series 10/11 M98 P����� L���� ; P : Subprogram number L : Repetition count
Series 0i
The Series 10/11 and Series 16/18/21 use different addresses for the repeat count for canned cycles as listed in Table 18 (b).
Table 18 (b) Address for times of repetition of canned cycle
CNC Address
Series 10/11 L
Series 0i K
General
Explanations
� Address for the cutter compensation offset number
� Subprogram call
M98 P���� ���� ;
Repetition count Subprogram number
� Address for the canned cycle repetition count
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
376
19 HIGH SPEED CUTTING FUNCTIONS
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
377
When an arc is cut at a high speed in circular interpolation, a radial error exists between the actual tool path and the programmed arc. An approximation of this error can be obtained from the following expression:
0
�
r
∆��Error
∆r : Maximum radial error (mm) v : Feedrate (mm/s) r : Arc radius (mm) T1 : Time constant (s) for exponential acceleration/deceleration of
cutting feed T2 : Time constant of the servo motor (s)
∆r= (T12+T22)2 1
�
3�
Programmed path
Actual path
When actual machining is performed, radius r of the arc to be machined and permissible error ∆r are given. Then, maximum allowable feedrate v (mm/min) is determined from the above expression.
The function for clamping the feedrate by the arc radius automatically clamps the feedrate of arc cutting to the value set in a parameter. This function is effective when the specified feedrate may cause the radial error for an arc with a programmed radius to exceed the permissible degree of error.
For details, refer to the relevant manual published by the machine tool builder.
19.1 � ���#
;�.*68� => ��
���69-
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
378
This function is designed for high–speed precise machining. With this function, the delay due to acceleration/deceleration and the delay in the servo system which increase as the feedrate becomes higher can be suppressed. The tool can then follow specified values accurately and errors in the machining profile can be reduced. This function becomes effective when advanced preview control mode is entered. For details, refer to the relevant manual published by the machine tool builder.
P1 : Turn on advanced preview control mode. P0 : Turn off advanced preview control mode.
G08 P_
In advanced preview control mode, the following functions are available: (1) Linear acceleration/deceleration before interpolation (2) Automatic corner deceleration function For details on the above functions, see the Connection Manual (Function) (B-64113EN-1). Each function, specific parameters are provided.
Advanced preview control mode is canceled by reset.
Specify G08 code only in a block.
In the advanced preview control mode, the functions listed below can be specified.
NOTE To use a function other than the following functions, turn the advanced preview control mode off, specify the desired function, then turn the mode on again.
⋅ Inverse time feed ⋅ Axis control by the PMC
(Bits 4 (G8R) and 3 (G8C) of parameter No. 8004 can be set to also use this function in the advanced preview control mode.)
⋅ Single direction positioning ⋅ Polar coordinate command ⋅ Helical interpolation ⋅ Rigid tapping
(Bit 5 (G8S) of parameter No. 1602 can be set to also use this function in the look–ahead control mode. The serial spindle parameters must also be set.)
19.2 ��?�8 � *� ?6 $
08#�0; ��)'�
Format
Explanations
� �� �� ��� ���������
� �����
Limitations
� G08 command
� Functions that can be specified
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
379
⋅ Program restart ⋅ External deceleration ⋅ Simple synchronous control ⋅ Sequence number comparison and stop ⋅ Position switch
(Bit 3 (PSF) of parameter No. 6901 can be set to also use this function in the advanced preview control mode. Setting this parameter to 1 changes the timing when the signal is output. So, it may become necessary to change the ladder.)
⋅ Cs contour control (Bit 5 (G8S) of parameter No. 1602 can be set to also use this function in the advanced preview control mode. The serial spindle parameters must also be set.)
⋅ Constant surface speed control ⋅ Spindle synchronous control ⋅ Custom macro B ⋅ Arbitrary angle chamfering/corner rounding ⋅ Inch/metric conversion ⋅ Programmable mirror image ⋅ Canned cycle ⋅ Automatic corner override
(Only the internal circular cutting feedrate change is valid.) ⋅ Scaling ⋅ Coordinate system rotation ⋅ Workpiece coordinate system ⋅ Workpiece coordinate system preset ⋅ Cutter compensation C ⋅ Corner circular interpolation ⋅ Tool offset ⋅ Tool life management ⋅ Tool length measurement ⋅ Graphic display ⋅ Dynamic graphic display ⋅ Feed per revolution
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
380
The AI advanced preview control/AI contour control function is provided for high–speed, high–precision machining. This function enables suppression of acceleration/deceleration delays and servo delays that become larger with increases in the feedrate and reduction of machining profile errors. Look–ahead acceleration/deceleration before interpolation is enabled for up to 20 blocks in AI advanced preview control or for up to 40 blocks in AI contour control. This enables execution of smooth acceleration/ deceleration extending over multiple blocks and higher machining.
This function is enabled by setting the AI advanced preview control or AI contour control mode.
G05.1 Q _ ; Q1 : AI advanced preview control/AI contour control mode on Q0 : AI advanced preview control/AI contour control mode off
NOTE 1 Always specify G05.1 in an independent block. 2 The AI advanced preview control/AI contour control mode
is also canceled by a reset. 3 When the AI contour control option is installed, the AI
contour control mode is enabled.
19.3 AI ADVANCED PREVIEW CONTROL FUNCTION/ AI CONTOUR CONTROL FUNCTION
Overview
Explanation
� Format
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
381
The functions listed below are valid in the AI advanced preview control/AI contour control mode:
⋅ Look–ahead linear acceleration/deceleration before interpolation ⋅ Look–ahead bell–shaped acceleration/deceleration before interpolation
(The option of look–ahead bell–shaped acceleration/deceleration before interpolation is required.)
⋅ Automatic corner deceleration ⋅ Feedrate clamping by acceleration ⋅ Feedrate clamping by arc radius ⋅ Block overlap ⋅ Advanced preview feed forward
For a cutting feed command in the feed per minute mode, linear acceleration/deceleration can be applied before interpolation, that is, for the specified feedrate by reading up to 20 blocks (in the AI advanced preview control mode) or 40 blocks (in the AI contour control mode) in advance. With acceleration/deceleration after interpolation, the interpolated data is changed because acceleration/deceleration is applied to the data. With acceleration/deceleration before interpolation, the interpolated data cannot be changed by acceleration/deceleration because acceleration/ deceleration is applied to the feedrate data before interpolation. For this reason, the interpolated data can always be applied to the specified straight line or curve to eliminate machining profile errors caused by acceleration/deceleration delays.
Linear interpolation, circular interpolation, etc.
Distribution pulse
Specified feedrate
Linear accelera- tion/deceleration
before interpolation
Feedrate calculation
Servo control
Acceleration/ deceleration
after interpolation
Interpolation calculation
� Functions valid in the AI advanced preview control/AI contour control mode
� Look–ahead linear acceleration/deceleration before interpolation
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
382
(Example of deceleration)
Deceleration is started in a prior block so that the feedrate specified for the target block is reached at the execution.
Feedrate
N1
F2
F1
Point1
Point2
Specified feedrate
Feedrate determined by acceleration/deceleration before interpolation
F3
N2 Time
To decelerate from feedrate F3 to F2, deceleration must start with point 1. To decelerate from feedrate F2 to F1, deceleration must start with point 2.
Multiple blocks can be read in advance to perform deceleration extending over several blocks.
(Example of acceleration)
Acceleration is performed so that the feedrate specified for the target block is reached at the execution.
Time
Feedrate determined by acceleration/deceleration before interpolation
Feedrate
N1
F3
F2
F1 N2
Specified feedrate
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
383
Linear acceleration/deceleration before interpolation for cutting feed in the AI advanced preview control/AI contour control mode can be changed to bell–shaped acceleration/deceleration before interpolation. With bell–shaped acceleration/deceleration before interpolation, smooth acceleration/deceleration can be applied to the cutting feedrate to reduce the shock on the machine by fluctuations in acceleration that are involved in changes in the cutting feedrate. To use this function, the option of look–ahead bell–shaped acceleration/ deceleration before interpolation is required.
Time
Acceleration
tbtb
tbtb
ta ta
tc tc
tbtbtbtb
tata
tctc
Feedrate
Time
Linear acceleration/ deceleration
Bell–shaped acceleration/ deceleration
ta Depends on the linear acceleration. tb Time constant for bell–shaped
acceleration/deceleration tc Bell–shaped acceleration/
deceleration time
tc = ta + tb ta is not constant and depends on the specified feedrate.
ta = Specified feedrate
Linear acceleration
tb is constant.
tc = ta + tb12.
Linear acceleration/ deceleration
Bell–shaped acceleration/ deceleration
ta Depends on the linear acceleration. tb Time constant for bell–shaped
acceleration/deceleration tc Bell–shaped acceleration/
deceleration time
� Look–ahead bell–shaped acceleration/deceleration before interpolation
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
384
When the feedrate is changed, deceleration and acceleration are performed as follows:
For deceleration: Bell–shaped deceleration is started in the preceding block so that deceleration terminates by the beginning of the block in which the feedrate is changed. For acceleration: Bell–shaped acceleration is started after the beginning of the block in which the feedrate is changed.
Deceleration
Fa
Fb
Time N2N1
Acceleration
Feedrate
Fb
Fa
Time N2N1
Between contiguous two blocks, the feedrate difference for an axis may exceed the setting (parameter No. 1783). In this case, the feedrate at the corner is calculated as follows based on the axis for which the ratio of the actual feedrate difference to the allowable feedrate difference is the largest. Deceleration is performed so that the feedrate is reached at the interface of the blocks. The change in the feedrate for each axis (Vx, Vy, ...) during movement at the specified feedrate F is compared with the setting of parameter No. 1783 (Vprm–x, Vprm–y, ...). If the change in the feedrate for any axis exceeds the setting of the parameter, the following expression is used:
Rmax � max� Vx Vprm � x
, Vy
Vprm � y , , ,�
The required feedrate (Fc) is obtained as follows and deceleration is performed at the corner:
Fc � F � 1 Rmax
For example, assume that the tool move direction changes by 90 degrees from movement along the X–axis to that along the Y–axis. Also assume that the specified feedrate is 1000 mm/min and the allowable feedrate difference (parameter No. 1783) is 500 mm/min. Deceleration is performed as shown in the figure below:
� Automatic corner deceleration
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
385
F ee
dr at
e al
on g
th e
X –a
xi s
N1
N2
N2N1
F1000
F500
F1000
F500
F1000
F500
N2
N1
Tool path when deceleration is not performed at the corner
Tool path when deceleration is performed at the corner
N1 G01 G91 X100. F1000 ; N2 Y100. ;
Feedrate
Feedrate
Feedrate
When deceleration is not performed at the corner
When deceleration is performed at the corner
Time
Time
Time
F ee
dr at
e al
on g
th e
Y –a
xi s
Ta ng
en tia
l fe ed
ra te
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
386
When continuous minute straight lines form curves as shown in the example in the figure below, the feedrate difference for each axis at each corner is not so large. For this reason, deceleration according to the feedrate difference is not effective. Continuous small feedrate differences make a large acceleration for each axis as a whole, however.
In this case, deceleration is performed to suppress the shock on the machine and machining errors caused by too large acceleration. The feedrate is decreased so that the acceleration for each axis that is obtained using the expression below does not exceed the allowable acceleration setting for all axes.
The allowable acceleration is set based on the maximum cutting feedrate (parameter No. 1432) and time required to reach the feedrate (parameter No. 1785).
Acceleration for each axis =
Feedrate difference for each axis at each corner
max�Travel distance in preceding blockF , Travel distance in following blockF �
The decreased feedrate is obtained for each corner. The decreased feedrate obtained at the start or end point of the block, whichever is lower, is used as the actual feedrate.
(Example) In the example below, deceleration is performed because the acceleration (gradient of each dotted line in the feedrate graphs) from N2 to N4 and from N6 to N8 is too large.
N9
N5
N1
N2 N3
N4
N6
N7
N8
� Feedrate clamping by acceleration
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
387
N9N5N1N9N5N1
The maximum allowable feedrate v for an arc of radius r specified in a program is calculated using the arc radius R and maximum allowable feedrate V (setting of a parameter) for the radius as follows so that the acceleration in an arc block does not exceed the allowable value. If the specified feedrate exceeds the feedrate v, the feedrate is automatically clamped to the feedrate v.
Maximum allowable feedrate � V 2
R R : Arc radius V : Feedrate for arc radius R
then, the maximum allowable feedrate v for an arc of radius r can be obtained using the following expression:
v � (r�R) � V�
NOTE As the specified arc radius becomes smaller, the maximum allowable feedrate v becomes lower. If the maximum allowable feedrate v is lower than the setting of parameter No. 1732 (lower feedrate limit for feedrate clamping by arc radius), it can be assumed to be the setting of the parameter to prevent the maximum allowable feedrate from becoming too low.
� Feedrate clamping by arc radius
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
388
By setting the corresponding parameter, the linear or non–linear interpolation type can be selected. (In the AI nano contour control mode, the non–linear interpolation type cannot be selected.) When the linear interpolation type is selected, acceleration/deceleration is performed before interpolation and linear interpolation type positioning is used for movement. For acceleration/deceleration, linear or bell–shaped acceleration/deceleration can be selected by setting the corresponding parameter. The feedrate during movement and acceleration for acceleration/deceleration before interpolation are obtained as follows:
(1) Feedrate during movement
The minimum value obtained using the following expression for each axis along which movement is done is used as the feedrate during movement:
Rapid traverse rate for each axis (parameter No. 1420) = Amount of travel in block
Amount of travel for each axis
(2) Acceleration for acceleration/deceleration before interpolation
� For linear acceleration/deceleration
The minimum value obtained using the following expression for each axis along which movement is done is used as the acceleration for linear acceleration/deceleration before interpolation during movement:
Rapid traverse rate for each axis (parameter No. 1420) Time constant for each axis (parameter No. 1620)
�
Amount of travel in block Amount of travel for each axis
� For bell–shaped acceleration/deceleration
The time constant set in parameter No. 1621 (time constant for bell–shaped acceleration/deceleration for rapid traverse for each axis) for the axis for which the minimum value is obtained using the above expression is applied to the feedrate obtained using the above acceleration.
� Rapid traverse
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
389
tc = ta + tb The value of ta is not constant and depends on the rapid traverse rate and the time constant of the rapid traverse rate for the specified axis. The value of tb depends on the axis.tbtbtbtb
tata
tctc
Feedrate
Time
Linear acceleration/ deceleration
Bell–shaped acceleration/ deceleration
ta Depends on the linear acceleration. tb Time constant for bell–shaped
acceleration/deceleration tc Bell–shaped acceleration/
deceleration time
If the feedrate during movement is F, the acceleration for linear acceleration/deceleration is A, the time constant for bell–shaped acceleration/deceleration is T, the time required for acceleration/ deceleration can be obtained as follows:
Time required for acceleration/deceleration = F/A (linear acceleration/deceleration) = F/A+T (bell–shaped acceleration/deceleration)
Feedrate
F
Time T/2T/2 F/A
TT
F/A : Time required for linear acceleration
T : Time required for rounding the corner
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
390
When the non–linear interpolation type is selected, movement is performed at the feedrate set in parameter No. 1420 with acceleration/deceleration set in parameter No. 1620. The corresponding value can be set in parameter No. 1621 to select bell–shaped acceleration/deceleration.
NOTE Rapid traverse block overlap is disabled.
In the following tables, AI control means the AI advanced preview control/AI contour control mode.
(1)Parameters related to linear acceleration/deceleration before interpolation
Parameter
Parameter number
Parameter Normal
Ad- vanced preview control
AI contour
Acceleration/deceleration type (A or B) FWB/1602#0 None
Parameter 1 for setting the acceleration 1630 1770
Parameter 2 for setting the acceleration 1631 1771
Feedrate at which an overtravel alarm occurs 1784
(2)Parameters related to automatic corner deceleration
Parameter
Parameter number
Parameter Normal
Ad- vanced preview control
AI contour
Method for determining whether to perform automatic corner deceleration (angle/fee- drate difference)
CSD/1602#4 None
Lower feedrate limit (control according to the angle)
1778 1777 None
Angle at which automatic corner deceleration is performed (control according to the angle)
1740 1779 None
Allowable feedrate difference for all axes (control according to the feedrate difference)
1780 None
Allowable feedrate difference for each axis (control according to the feedrate difference)
1783
Acceleration/deceleration type (Type A/Type B)
FWB/1602#0 None
(3) Parameter related to feedrate clamping by acceleration
Parameter
Parameter number
Parameter Normal
Ad- vanced preview control
AI contour
Parameter for determining the allowable ac- celeration
None 1785
� Corresponding parameter numbers in the normal mode, advanced preview control mode, and AI advanced preview control/AI contour control mode
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
391
(4)Parameters related to feedrate clamping by arc radius
Parameter
Parameter number
Parameter Normal
Ad- vanced preview control
AI contour
Arc radius corresponding to the upper fee- drate limit
1731
Upper feedrate limit at arc radius R 1730
Lower clamped feedrate limit 1732
(5)Other parameters
Parameter
Parameter number
Parameter Normal
Ad- vanced preview control
AI contour
Precision of radius errors in circular interpola- tion
PCIR1/3403#0 None
Maximum cutting feedrate (common to all axes)
1422 1431 1422
Maximum cutting feedrate (for each axis) 1430 1432
Rapid traverse movement type* LRP/1401#1 AIR/ 7054#1
LRP/ 1401#1
Time constant for bell–shaped acceleration/ deceleration for rapid traverse
1621 RBL/ 1603#6
1621
Arc radius corresponding to the upper fee- drate limit
1731
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
392
Num- ber
Message Description
5110 IMPROPER G CODE
(G05.1 Q1 MODE)
An unspecifiable G code was specified in the AI advanced preview control/AI con- tour control mode.
5111 IMPROPER MODAL G CODE
(G05.1 Q1)
An unavailable modal G code was found when the AI advanced preview control/AI contour control mode was specified.
5112 G08 CAN NOT BE COMMANDED
(G05.1 Q1)
The look–ahead control command (G08) was specified in the AI advanced preview control/AI contour control mode.
5114 CAN NOT ERROR IN MDI MODE
(G05.1 Q1)
Intervention by manual operation was per- formed during execution of the G28, G30, or G53 command (linear interpolation type) in the AI advanced preview control/ AI contour control mode. After that, auto- matic operation was restarted at a position other than the stop position.
5156 ILLEGAL AXIS OPERATION
(AICC)
In the AI advanced preview control/AI con- tour control mode, the controlled axis selection signal (PMC axis control) changed.
In the AI advanced preview control/AI con- tour control mode, the simple synchronous axis selection signal changed.
5157 PARAMETER 0
(AICC)
The setting of the parameter for specifying the maximum cutting feedrate (No. 1422, 1432, or 1420) is 0.
The setting of the parameter for specifying acceleration/deceleration before interpola- tion (No. 1770 or 1771) is 0.
1) The advanced preview control function (G08P1) can also be specified.
2) When the total distance of blocks read in advance reaches the distance for decelerating from the current feedrate, deceleration is started. When look–ahead operation proceeds and the total distance of blocks increases by termination of deceleration, acceleration is started again. If a series of blocks with a small amount of travel are specified, the deceleration and acceleration may be alternated, which prevents the feedrate from being constant. In this case, specify a lower feedrate.
3) When the dry run signal is inverted from ”0” to ”1” or from ”1” to ”0” during movement along an axis, acceleration/deceleration is performed to the specified feedrate without deceleration to feedrate 0.
4) If a non–movement block or one–shot G code command such as G04 is found in the AI advanced preview control/AI contour control mode, the movement is decelerated and temporarily stopped in the preceding block.
5) For acceleration/deceleration after interpolation, use linear or bell–shaped acceleration/deceleration. Exponential acceleration/ deceleration cannot be used.
Alarms
Notes
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
393
Axis control � : Can be specified. � : Cannot be specified.
Name Function
Number of controlled axes 3 to 4
Number of simultaneously con- trolled axes
Up to 4
Axis name The basic three axes are fixed to X, Y, and Z. Other axes are any of U, V, W, A, B, and C.
Least input increment 0.001 mm, 0.001 deg, 0.0001 inch
One–tenth input increment 0.0001 mm, 0.0001 deg, 0.00001 inch One–tenth input increment for each axis cannot be used.
Simple synchronous control � However, switching between synchronous and normal operation cannot be performed during automatic operation (when the automatic op- eration signal (OP) is set to 1) regardless of whether the AI advanced preview control/AI contour control mode is set. In this case, switching causes a PS213 alarm.
Angular axis control �
Tandem control � However, full preloading is not allowed.
Inch/metric conversion (G20, G21)
� (*1)
Interlock �
Interlock for each axis � Movement along all axes stops. To stop movement only along the interlock axis in non–linear interpolation type positioning, set bit 5 (AIL) of parameter No. 7054 to 1 and bit 4 (XIK) of parameter No. 1002 to 0.
Machine lock � When the machine lock signal for each axis (MLK1 to MLK8) is turned on or off, accelera- tion/deceleration is not applied to the axis for which machine lock is performed.
Stroke limit check before move �
Mirror image �
Stored pitch error compensation �
Position switch � Set bit 3 (PSF) of parameter No. 6901 to 1. When this parameter is set to 1, the signal out- put timing changes.
Abnormal load detection �
Manual handle interruption � Manual handle interruption is disabled during switching to the AI advanced preview control/AI contour control mode.
External pulse synchronization �
Interpolation functions � : Can be specified. � : Cannot be specified.
Name Function
Positioning (G00) �
Single direction positioning (G60) � To perform single direction positioning in the AI advanced preview control/AI contour control mode, set bit 4 (ADP) of parameter No. 7055 to 1.
Exact stop (G09) �
Exact stop mode (G61) �
Tapping mode (G63) �
Linear interpolation (G01) �
Circular interpolation (G02, G03) � (Circular interpolation for multiple quadrants is enabled.)
� Specifications
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
394
Name Function
Dwell (G04) � (Dwell with the time in seconds or speed speci- fied) For dwell with the speed specified, anoth- er option is required.
Cylindrical interpolation (G07.1) �
Helical interpolation (G02, G03) � (Circular interpolation + linear interpolation for up to two axes) Specify the feedrate including the helical axis in the feedrate command.
Threading and synchronous feed (G33)
�
Skip function (G31) � (*2)
High–speed skip function (G31) � (*2)
Multistage skip function (G31 Px) � (*2)
Reference position return (G28) � (*2)
To execute G28 in the status in which the refer- ence position is not established, set bit 2 (ALZ) of parameter No. 7055 to 1.
Reference position return check (G27)
� (*2)
2nd, 3rd, and 4th reference posi- tion return (G30)
� (*2)
Normal direction control (G41.1, G42.1)
� Set bit 2 (ANM) of parameter No. 5484 to 1.
Continuous dressing �
In–feed control (G161) �
Index table indexing � (*2)
To set follow–up of the index table indexing axis (fourth axis), set bit 7 (NAH4) of parameter No. 1819 and bit 0 (NMI4) of parameter No. 7052 to 1.
Feed functions � : Can be specified. � : Cannot be specified.
Name Function
Rapid traverse rate Up to 240 m/min (0.001 mm)Rapid traverse rate
Up to 100 m/min (0.0001 mm)
Rapid traverse rate override F0, 25, 50, 100 %
Rapid traverse rate override in in- crements of 1%
0 to 100 %
Feed per minute (G94) �
Feed per revolution (G95) �
Cutting feedrate clamp �
Bell–shaped acceleration/decel- eration for rapid traverse
�
Linear acceleration/deceleration after cutting feed interpolation
�
Bell–type acceleration/decelera- tion after cutting feed interpolation
�
Linear acceleration/deceleration before cutting feed interpolation
� (Up to 20 blocks are read in advance in the AI advanced preview control mode.) (Up to 40 blocks are read in advance in the AI contour control mode.)
Feedrate override 0 to 254 %
Single–digit F code feed � To enable feedrate change using a manual handle, set bit 1 (AF1) of parameter No. 7055 to 1.
Inverse time feed (G93) �
Override cancel �
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
395
Name Function
External deceleration �
Look–ahead bell–shaped accel- eration/deceleration before inter- polation
�
Program input � : Can be specified. � : Cannot be specified.
Name Function
Control in/control out command () �
Optional block skip command (/n: n is a number.)
�
Absolute command (G90)/ incremental command (G91)
�
Decimal point programming/pock- et calculator type decimal point programming
�
10–fold input unit �
Plane selection (G17, G18, G19) �
Rotation axis specification �
Rotation axis roll over �
Polar coordinate command (G16) �
Local coordinate system (G52) � (*2)
Machine coordinate system (G53) � (*2)
Workpiece coordinate system (G54 to G59) (G54.1Pxx)
�
Workpiece coordinate system (G92)
� (*2)
Workpiece coordinate system pre- set (G92.1)
� (*2)
Arbitrary angle chamfering/corner rounding
�
Programmable data input (G10) � (*2)
Only the tool offset value, workpiece origin off- set, and parameter can be changed.
Custom macro B � See the description of ”Notes on using custom macros.”
Addition of custom macro com- mon variables
�
Pattern data input �
Interruption type custom macro �
Canned cycle (G73 to G89) � (*2)
Initial level return (G98)/ point R level return (G99)
� (*2)
Small hole peck drilling cycle (G83)
�
Arc radius R programming �
Automatic corner override (G62) � Set bit 0 (ACO) of parameter No. 7055 to 1.
Automatic corner deceleration �
Feedrate clamping by arc radius �
Scaling (G51) �
Coordinate system rotation (G68) �
Programmable mirror image (G51.1)
�
F10/11 tape format �
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
396
Auxiliary functions/spindle–speed functions � : Can be specified. � : Cannot be specified.
Name Function
Miscellaneous function (Mxxxx) � The function code and function strobe signals are output only.
Second auxiliary function (Bxxxx) � The function code and function strobe signals are output only.
High–speed M/S/T/B interface �
Multiple miscellaneous function specification
�
Spindle–speed function (Sxxxx) �
Spindle synchronous control �
Rigid tapping � (*2)
Set bit 5 (G8S) of parameter No. 1602 or bit 3 (ACR) of parameter No. 7051 to 1.
Tool compensation functions � : Can be specified. � : Cannot be specified.
Name Function
Tool function (Txxxx) � The function code and function strobe signals are output only.
Tool length compensation (G43, G44, G49)
�
Tool offset (G45 to G48) �
Cutter compensation C (G40, G41, G42)
�
Tool life management �
Automatic tool length measure- ment
�
Other functions � : Can be specified. � : Cannot be specified.
Name Function
Cycle start/feed hold �
Dry run �
Single block �
Sequence number comparison and stop
�
Program restart � For the time constant for acceleration/decelera- tion during movement to the restart position, the following parameters are used: When exponential acceleration/deceleration is used: Parameter Nos. 1624 and 1625 When linear/bell–shaped acceleration/decel- eration is used: Parameter No. 1622 To set the acceleration/deceleration type, use bits 0 and 1 of parameter No. 1610.
Rigid tapping return �
Macro executor (execution macro)
�
MDI operation �
Manual intervention �
NOTE The above tables include a function that another option is required for specifying.
1 Multiple blocks are not read in advance.
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
397
When G05.1 Q1 is specified, the modal G codes must be set as listed below. If one of these conditions is satisfied, a PS5111 alarm occurs.
G code(s) Description
G00 G01 G02 G03
Positioning Linear interpolation Circular interpolation (CW) Circular interpolation (CCW)
G15 Polar coordinate command cancel
G40 Cutter compensation cancel
G40.1 Normal direction control cancel mode
G49 Tool length compensation cancel
G50 Scaling cancel
G50.1 Programmable mirror image cancel
G64 Cutting mode
G67 Macro modal call cancel
G69 Coordinate system rotation cancel
G80 Canned cycle cancel
G94 Feed per minute
G97 Constant surface speed control cancel
G160 In–feed control function cancel
� ��������� ��� ������" ���
�6 �� ���� ������3
�������@�6 �������
������� ���
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
398
In Look–ahead bell–shaped acceleration/deceleration before interpolation, the speed during acceleration/deceleration is as shown in the figure below.
Specified speed
Speed
Non–linear acceleration/deceleration
Non–linear acceleration/deceleration
Linear acceleration/deceleration
T1
T2 T2
Time
T1: Time determined from the specified speed and the specified acceleration Specified acceleration:
In case of AI contour control Parameter No.1770/Parameter No.1771
T2: Acceleration change time In case of AICC : Parameter No.1772
Fig.19.4 (a)
The time T1, shown above, varies with the specified speed. If the specified speed is low, the speed will be as shown below, causing linear acceleration/deceleration not reaching the specified acceleration.
19.4 LOOK–AHEAD BELL–SHAPED ACCELERATION/DEC ELERATION BEFORE INTERPOLATION TIME CONSTANT CHANGE FUNCTION
General
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
399
Linear acceleration/deceleration not reaching specified acceleration/deceleration
Specified speed
Speed
Time
T1T1
T2
Fig.19.4 (b)
If linear acceleration/deceleration not reaching the specified acceleration occurs in AI contour control mode as shown above, this function shortens the acceleration/deceleration time by changing the internal acceleration for acceleration/deceleration before interpolation and the bell–shaped time constant in order to generate an acceleration/deceleration pattern as close as possible to that permits optimum bell–shaped acceleration/deceleration before interpolation for the specified speed. Optimum bell–shaped acceleration/deceleration before interpolation, as mentioned here, refers to bell–shaped acceleration/deceleration before interpolation in which if T2 > T1, T1 and T2 are changed to T1’ and T2’ as shown in the figure below so that linear acceleration/deceleration not reaching the specified acceleration/deceleration does not occur. This function becomes effective for the Acceleration /deceleration before look–ahead interpolation in AI contour control mode.
Non–linear acceleration/deceleration
Specified speed
Speed
T1’
T2’ T2’
Time
Fig.19.4 (c)
PROGRAMMING 19. HIGH SPEED CUTTING
FUNCTIONS B–64124EN/01
400
The acceleration/deceleration reference speed is the feedrate used as the reference for calculating optimum acceleration. In Fig.19.4 (c), it is equivalent to the specified speed used to determine T1’ and T2’. There are three methods for specifying the acceleration/deceleration reference speed.
(1) Specifying the speed using an F in a G05.1 Q1 block
(2) Setting the speed on Parameter
(3) Setting the speed specified with the F command issued at the start of cutting as the reference speed
NOTE This function is effective if BCG (No. 7055 bit 3) is 1.
If an F command is used in a G05.1 Q1 block, the speed specified with the F command is assumed the acceleration/deceleration reference speed. This acceleration/deceleration reference speed is cleared upon a reset. After the acceleration/deceleration reference speed is cleared upon a reset or after the power is turned off and then on again, the acceleration/deceleration reference speed specified for parameter No. 7066 will be used. (Method (2), described later) If the acceleration/deceleration reference speed specified for the parameter is 0, the feedrate assumed at the start of cutting will be assumed the acceleration/deceleration reference speed. (Method (3), described later)
(Program example)
G05.1 Q1 F5000 ; ··· Sets the reference speed to 5000 mm/min.
The F command used in a G05.1 block is used to specify the acceleration/deceleration reference speed, and is also used as a normal F command.
Even if the feedrate is changed during the execution of the machining program, the acceleration/deceleration reference speed specified with the above command remains in effect. If this occurs, the machining time may become longer because machining is performed at the feedrate different from the acceleration/deceleration reference speed. For this reason, the acceleration/deceleration reference speed to be specified with the above command should be as close as possible to the actual machining speed.
NOTE The G05.1Q1Fxxxx command must be issued in feed per minute (G94) mode. If this command is issued in another mode, the speed specified with this command will be generated the alarm (PS5111).
Description
� Methods of specifying the acceleration/deceleration reference speed
(1) Specifying the speed in a G05.1 Q1 block
PROGRAMMINGB–64124EN/01 19. HIGH SPEED CUTTING
FUNCTIONS
401
the acceleration/deceleration reference speed is set in parameter No. 7066. Because these parameters must be set in input unit, when the input unit is changed, these parameters must be changed.
This method is used if the G05.1Q1 block does not have an F command.
The speed specified with the F command issued when a cutting block group (such as G01 and G02) starts is assumed the acceleration/deceleration reference speed, This method is used if the G05.1Q1 block does not have an F command and the parameter of the acceleration/deceleration reference speed is set to 0.
(G00) G01 X––– Y––– Z––– F*** ; X––– Y––– Z––– X––– Y––– Z––– X––– Y––– Z––– G00 ;
Cutting block group
Even if an F command is issued before a cutting block group and the F command is effective to the cutting block group modally, the speed specified with the modal F effective at the start of cutting will be assumed the acceleration/deceleration reference speed.