Custom Macro Sample Programming Manual (En)
Custom Macro Sample Programming Manual (En)
(V1231I-P4E-XD)
SAMPLE CUSTOM MACROS
-i-
V1231I-P4E-XD
- ii -
CONTENTS
1. GENERAL ……………………………………………………………………………………….. 1
6. APPENDIX ……………………………………………………………………………………. 34
-i-
1. GENERAL
This manual describes practical examples for cutting circles, squares, etc. using the custom macro
(macro program) which is an optional program for the NC units listed below.
In addition, it provides description helpful for the user to make up an own custom macro.
For details, see the “Custom Macro (Macro Program)” in Instruction Manual for each NC unit.
Applicable NC units
FANUC Series 0-MB (with macro B)
FANUC Series 0-MC (with macro B)
FANUC SYSTEM 6M-B (with macro B)
FANUC SYSTEM 11M
FANUC Series 15-M
COMMAND Ⅲ N (Refer to FANUC SYSTEM 11M )
COMMAND 5N (Refer to FANUC Series 15-M )
PROFESSIONAL 1 (Refer to FANUC Series 0-MC )
PROFESSIONAL 2 (Refer to FANUC Series 15-M )
PROFESSIONAL A (Refer to FANUC Series 16-M
FANUC Series 16i-M )
PROFESSIONAL 3 (Refer to FANUC Series 16-M
FANUC Series 16i-M )
PROFESSIONAL 5 (Refer to FANUC Series 16-M
FANUC Series 16i-M
FANUC Series 300is
FANUC Series 310is )
PROFESSIONAL P / S (Refer to FANUC Series 0i-MD/0i-MF)
SNC 43/64 NC UNIT (Refer to YASNAC MX3 )
YASNAC MX3
-1-
2. PRECAUTIONS IN USING CUSTOM MACRO
Before using this document, the set value of #100 in O9100 must be modified according to the
NC units used and offset memory type.
The system tape for macro sample programs presets #100=99. Running the macro with this
set value causes the alarm “NC UNIT DATA ERROR #100”.
-2-
Contents of O9100
O9100(CALC OFFSET &ABSIO Z POS )
#100=99( SELECT OF NC/UNIT & OFFSET TYPE )
G53
#103=ROUND[[#100-FIX[#100]]*10]/10(0.0001)
G53
#100=ROUND[#100]
#101=#100-ROUND[FIX[#100/100]*100]-ROUND[#100-FIX[#100/10]*10]( NC/UNIT )
#102=ROUND[#100-FIX[#100/10]*10]( OFST TYPE )
IF[#102EQ0]GOTO98
IF[#102EQ1]GOTO98
IF[#102EQ2]GOTO98
#3000=143(NC UNIT DATA ERROR #100)
N98IF[#7EQ#0]GOTO94
IF[#102EQ0]GOTO1( TYPE A )
IF[#102EQ1]GOTO2( TYPE B )
IF[#102EQ2]GOTO3( TYPE C )
N1( TYPE A )
IF[#100GE200]GOTO11
#30=#[2000+#7]
GOTO91
N11#30=#[10000+#7]
GOTO91
N2( TYPE B )
IF[#100GE200]GOTO12
#30=#[2000+#7]+#[2200+#7]
GOTO91
N12#30=#[10000+#7]+#[11000+#7]
GOTO91
N3( TYPE C )
IF[#100EQ12]GOTO13
IF[#100GE200]GOTO13
#30=#[2400+#7]+#[2600+#7]
GOTO91
N13#30=#[13000+#7]+#[12000+#7]
N91IF[#30NE0]GOTO94
#3000=141( OFFSET ERROR )
N94( READ Z ABSIO )
IF[#101EQ60]GOTO21( C5 )
( ABSIO )
N20( EXCEPT HD )
#33=#5003
GOTO99
N21( HD )
#33=#5005
N99M99
-3-
2.2 Restriction
(1) This document is not applicable to programs in use of the local coordinate system (G52).
(2) This document is applicable to even the NC units of least input increment 0.0001 mm,
specification of PROFESSIONAL A , 3 and 5.
Set #100 of O9100 of this macro with reference to List of Set Values.
(3) Set parameters to clear common variable #100 to #199 with the reset operation.
(Common variables are cleared at shipment.)
(4) This document is not applicable to the NC units with additional work coordinate system
functions (G54 to 59).
(5) This document is applicable to the only NC units of millimeter specification, but not to the NC
units of inch specification.
2.3 Notice
(1) Use the ISO code when punching this program on a tape, a floppy disk, etc. Take care of the
use of parentheses ( ), brackets [ ], O (alphabet) and 0 (zero). The parentheses are used
for a comment and an alarm message. Os of DO and GOTO are alphabet.
(3) Those arguments shadowed at the upper right corner cannot be omitted in the command
format. Omission causes the alarm No. 140 (alarm No. 640 for the FANUC Series 0-MB,
0-MC and PROFESSIOINAL 1, and alarm No. 3140 for PROFESSIONAL A , 3, 5, P and S).
(4) For the relationship between address specifying an argument and local variable number, see
Section 7.
-4-
3. ALARM DISPLAY
A programming error causes an alarm. Then, the alarm number and alarm message are displayed on
the screen and the machine stops.
Notes: Alarm numbers are 640, 641, 642, and 643 respectively for FANUC Series 0-MB, FANUC
Series 0-MC, and PROFESSIONAL 1.
Alarm numbers are 3140, 3141, 3142, and 3143 respectively for PROFESSIONAL A ,3 5,
P and S.
Reset of Alarm
The above alarms can be reset by pressing the RESET button on the NC operation panel, as in the case
of usual NC alarms.
-5-
4. MACRO CALL USING G CODES
The macro is, in general, called in the form of G65P program number argument assignment; and it can
also be called in the form of G××× argument assignment;. For this purpose, G code ××× that
calls a macro to a parameter number listed below, and program number △△△△ of a macro to be
called must be set according to the following procedure.
4.1 Change the program numbers of a macro to be used to O9010 through O9019.
4.2 Set G code to the parameter corresponding to that program number (See table below).
Notes:
(1) Use G codes of G01 to G255 oher than those specified by the NC manufacturer. (G01 to
G199 for SNC43/64 and YASNAC MX3 NC units)
(2) The above method cannot be used for the program that uses G66 (modal calling of
macro).
Parameter No.
Professional A
Program No. FS 0-MB FS 15M, 11M, Professional 3 SNC43/64
to be called FS 0-MC FS 6M-B COMMAND Ⅲ Professional 5 YASNAC MX3
PRO. 1 N, 5N
Professional P / S
O9010 220 323 7050 6050 #6120
O9011 221 324 7051 6051 #6121
O9012 222 325 7052 6052 #6122
O9013 223 326 7053 6053 #6123
O9014 224 327 7054 6054 #6124
O9015 225 328 7055 6055 #6125
O9016 226 329 7056 6056 #6126
O9017 227 330 7057 6057 #6127
O9018 228 331 7058 6058 #6128
O9019 229 332 7059 6059 #6129
G112I D R Z F ;
-6-
5. MACRO PROGRAM
Command format G△△; ← Select work coordinate system G54-G59, G54.1 P1-P48
G65 P9005;
Example:
(a) Move the machine spindle to the reference point of X and Y (work coordinate origin), in
the specified manner.
O program No.;
G△△;
G65 P9005;
M30;
(c) Execute the above program in the MEMORY mode. Then, a desired coordinate system
is automatically made.
-7-
O9005(SE074-0008 WORK ZERO SET)
G53 #[#2+#6*#10]=#11( WK/OFST SET X )
M98P9100 #[#3+#6*#10]=#12( WK/OFST SET Y )
G53 GOTO99
IF[#101EQ0]GOTO1 N202( ADD WK/OFST )
IF[#101EQ10]GOTO1 #13=ROUND[[#4130-1]*1000]/1000
IF[#101EQ20]GOTO1 G53
IF[#101EQ30]GOTO30 #[7001+20*#13]=#11
IF[#101EQ40]GOTO40 #[7002+#7+20*#13]=#12
IF[#101EQ50]GOTO50 N99M99
IF[#101EQ60]GOTO50
N1( FS15,16,11 )
#1=4014( WORK OFST NO ) O9100(CALC OFFSET & ABSIO Z POS )
#2=5221( WK/OFST X ) #100=99( SELECT OF NC/UNIT & OFFSET
#3=5222( WK/OFST Y ) TYPE )
#4=5021( MCHN POS X ) G53
#5=5022( MCHN POS Y ) #103=ROUND[[#100-FIX[#100]]*10]/10(0.0001)
#6=20( COEFFI. WK/OFST ) G53
GOTO201 #100=ROUND[#100]
N30( FS0,6 ) #101=#100-ROUND[FIX[#100/100]*100]-ROUND[
#1=4014 #100-FIX[#100/10]*10]( NC/UNIT )
#2=2501 #102=ROUND[#100-FIX[#100/10]*10]( OFST
#3=2601 TYPE )
#4=5021 IF[#102EQ0]GOTO98
#5=5022 IF[#102EQ1]GOTO98
#6=1 IF[#102EQ2]GOTO98
GOTO201 #3000=143(NC UNIT DATA ERROR #100)
N40( MX3 ) N98IF[#7EQ#0]GOTO94
#1=4012 IF[#102EQ0]GOTO1( TYPE A )
#2=2501 IF[#102EQ1]GOTO2( TYPE B )
#3=2601 IF[#102EQ2]GOTO3( TYPE C )
#4=5021 N1( TYPE A )
#5=5022 IF[#100GE200]GOTO11
#6=1 #30=#[2000+#7]
GOTO201 GOTO91
N50( HDNC C3,C5 ) N11#30=#[10000+#7]
#1=4014 GOTO91
#2=5221 N2( TYPE B )
#3=5224 IF[#100GE200]GOTO12
#4=5021 #30=#[2000+#7]+#[2200+#7]
#5=5024 GOTO91
#6=20 N12#30=#[10000+#7]+#[11000+#7]
#7=2 GOTO91
N201#10=ROUND[[#[#1]-54]*1000]/1000 N3( TYPE C )
IF[#103GE0.1]GOTO300(0.0001) IF[#100EQ12]GOTO13
#11=#[#4]-0.0001 IF[#100GE200]GOTO13
#12=#[#5]-0.0001 #30=#[2400+#7]+#[2600+#7]
G53 GOTO91
#11=ROUND[#11*1000]/1000( MCHN POS X ) N13#30=#[13000+#7]+#[12000+#7]
#12=ROUND[#12*1000]/1000( MCHN POS Y ) N91IF[#30NE0]GOTO94
G53 #3000=141( OFFSET ERROR )
GOTO301 N94( READ Z ABSIO )
N300#11=#[#4]-0.00001 IF[#101EQ60]GOTO21( C5 )
#12=#[#5]-0.00001 ( ABSIO )
G53 N20( EXCEPT HD )
#11=ROUND[#11*10000]/10000 #33=#5003
#12=ROUND[#12*10000]/10000 GOTO99
G53 N21( HD )
N301 #33=#5005
IF[#10EQ0.1]GOTO202 N99M99
-8-
(2) Inside circle finishing O9110
Point R
Point Z
G65 P9110 I D R Z F C S Q M ;
Argu-
Meaning If omitted
ment
I Cutting hole radius Alarm 140
D Tool radius offset No. Alarm 140
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
F Feedrate Alarm 140
C Approach circle radius 1/2 of I
S Approach feedrate 3 times of F
Q Cutting direction CCW (down-cut)
M Setting mode for R & Z Absolute
-8-
Example:
X0 Y0 M05;
M30;
X0 Y0 M05;
M30;
-9-
O9110(CIRCLE FINISH)
G53
IF[[#4*#7*#9]EQ0]GOTO990
IF[#18EQ#0]GOTO990
IF[#26EQ#0]GOTO990
#32=#4001
#31=#4003
M98P9100
G53
IF[#4LE#30]GOTO991
IF[#3NE#0]GOTO10
#3=#4/2
N10IF[#3LE#30]GOTO991
IF[#3GT#4]GOTO992
IF[#19NE#0]GOTO20
#19=#9*3
N20IF[#13EQ1]GOTO30
IF[#18LT#26]GOTO992
IF[#33LT#18]GOTO992
#5=[#33-#18]
#6=ABS[#18-#26]
GOTO40
N30#5=ABS[#18]
#6=ABS[#26]
N40G91G00G17Z-#5
G01Z-#6F[#9/2]
IF[#17EQ1]GOTO50
G41X-[#4-#3]Y#3D#7F#19
G03X-#3Y-#3J-#3F#9
I#4
X#3Y-#3I#3
G01G40X[#4-#3]Y#3F#19
GOTO60
N50G42X-[#4-#3]Y-#3D#7F#19
G02X-#3Y#3J#3F#9
I#4
X#3Y#3I#3
G01G40X[#4-#3]Y-#3F#19
N60G00Z[#5+#6]
GOTO999
N990#3000=140(DATA LACK)
N991#3000=141(OFFSET ERROR)
N992#3000=142(DATA ERROR)
N999G#32G#31F#9M99
- 10 -
(3) Deep circular pocket cutting O9120
Point R
Point Z
G65 P9120 I D H R Z F S Q M ;
Argu-
Meaning If omitted
ment
I Cutting hole radius Alarm 140
D Tool radius offset No. Alarm 140
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
F Feedrate in X, Y axes Alarm 140
H Width of cut per pass 60% of tool radius
S Feedrate in Z axis 1/2 of F
Q Amount of cut Up to Z at a time
M Setting mode for R and Z Absolute
Notes:
- 11 -
Example:
O102;
G90 G00 G54 X100.0 Y120.0;
S230 M03;
G43 Z100.0H ;
X0 Y0 M05;
M30;
O202;
G91 G00 X70.0 Y80.0;
S250 M03;
G65 P9120 I40. D22. H12. R-48. Z-12. F50. S30. Q4. M1.;
- 12 -
O9120(CIRCLE POCKET)
IF[[#4*#7*#9]EQ0]GOTO990 GOTO999
IF[#18EQ#0]GOTO990 N990#3000=140(DATA LACK)
IF[#26EQ#0]GOTO990 N991#3000=141(OFFSET ERROR)
#32=#4001 N992#3000=142(DATA ERROR)
#31=#4003 N999G#32G#31F#9M99
M98P9100
IF[#4LE#30]GOTO991
IF[#11NE#0]GOTO120
#11=#30*1.2
N120IF[#19NE#0]GOTO10
#19=#9/2
N10IF[#13EQ1]GOTO20
IF[#18LT#26]GOTO992
IF[#33LT#18]GOTO992
#5=[#33-#18]
#6=ABS[#18-#26]
GOTO30
N20#5=ABS[#18]
#6=ABS[#26]
N30IF[#17NE#0]GOTO40
#17=#6
N40#17=ABS[#17]
#8=#4-#30
#10=#6
G91G00G17Z-#5
IF[#10LE#17]GOTO50
DO1
#12=#11
G01Z-#17F#19
WHILE[#12LT#8]DO2
G01X#11F[#9/2]
G03I-#12F#9
#12=#12+#11
END2
#14=#8-[#12-#11]
G01X#14F[#9/2]
G03I-#8F#9
G01X-#8F#9
#10=#10-#17
IF[#103GE0.1]GOTO300
#10=ROUND[#10*1000]/1000
GOTO301
N300#10=ROUND[#10*10000]/10000
N301
IF[#10LE#17]GOTO50
END1
N50G01Z-#10F#19
#12=#11
WHILE[#12LT#8]DO1
G01X#11F[#9/2]
G03I-#12F#9
#12=#12+#11
END1
#14=#8-[#12-#11]
G01X#14F[#9/2]
G03I-#8F#9
G01X-#8F#9
N60G00Z[#5+#6]
- 13 -
(4) Inside box pocket finishing O9130
Point R
Point Z
G65 P9130 U V C D R Z F S I Q M ;
Argu-
Meaning If omitted
ment
U Lateral side length Alarm 140
V Longitudinal side length Alarm 140
C Approach circle radius Alarm 140
D Tool radius offset No. Alarm 140
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
F Feedrate Alarm 140
S Approach feedrate 3 times of F
I Radius of corner arc No corner arc
Q Cutting direction CCW (down-cut)
M Setting mode for R and Z Absolute
Notes:
- 14 -
Example:
O103;
G91 G00 X – 120.0 Y –100.0;
S220 M03;
G65 P9130 U100.V80.C30. D13. R-68. Z-2. F80. I15. Q1. M1.;
O203;
G90 G00 G54 X0 Y0;
S700 M03;
G43 Z100.0 H ;
X0 Y0 M05;
M30;
- 15 -
O9130(SQUARE FINISH)
IF[[#21*#22*#3*#7*#9]EQ0]GOTO990 G01X-[#21-#2-#4]
IF[#18EQ#0]GOTO990 G02X-#3Y#3J#3
IF[#26EQ#0]GOTO990 G90G01G40X#28Y#29F#19
#32=#4001 N60G91G00Z[#24+#25]
#31=#4003 GOTO999
M98P9100 N990#3000=140(DATA LACK)
IF[#3LE#30]GOTO991 N991#3000=141(OFFSET ERROR)
IF[#4EQ#0]GOTO10 N992#3000=142(DATA ERROR)
IF[#4LT#30]GOTO991 N999G#32G#31F#9M99
N10IF[#19NE#0]GOTO20
#19=#9*3
N20IF[#13EQ1]GOTO30
IF[#18LT#26]GOTO992
IF[#33LT#18]GOTO992
#24=[#33-#18]
#25=ABS[#18-#26]
GOTO40
N30#24=ABS[#18]
#25=ABS[#26]
N40#2=#21/2
#5=#22/2
IF[#4GT#2]GOTO992
IF[#4GT#5]GOTO992
IF[#3GE#2]GOTO992
IF[#3GE#5]GOTO992
#28=#5001
IF[#101EQ50]GOTO100
IF[#101EQ60]GOTO100
#29=#5002
GOTO101
N100#29=#5004
N101G91G00G17Z-#24
G01Z-#25F[#9/2]
IF[#17EQ1]GOTO50
G41X-#3Y-[#5-#3]D#7F#19
G03X#3Y-#3I#3F#9
G01X[#2-#4]
G03X#4Y#4J#4
G01Y[#22-2*#4]
G03X-#4Y#4I-#4
G01X-[#21-2*#4]
G03X-#4Y-#4J-#4
G01Y-[#22-2*#4]
G03X#4Y-#4I#4
G01X[#21-#2-#4]
G03X#3Y#3J#3
G90G01G40X#28Y#29F#19
GOTO60
N50G42X#3Y-[#5-#3]D#7F#19
G02X-#3Y-#3I-#3F#9
G01X-[#2-#4]
G02X-#4Y#4J#4
G01Y[#22-2*#4]
G02X#4Y#4I#4
G01X[#21-2*#4]
G02X#4Y-#4J-#4
G01Y-[#22-2*#4]
G02X-#4Y-#4I-#4
- 16 -
(5) Deep box pocket cutting O9140
Point R
Point Z
G65 P9140 U V D R Z F S I H Q M ;
Argu-
Meaning If omitted
ment
U Lateral side length Alarm 140
V Longitudinal side length Alarm 140
D Tool radius offset No. Alarm 140
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
F Feedrate in X, Y axes Alarm 140
S Feedrate in Z axis 1/2 of F
I Radius of corner arc No corner arc
H Width of cut per pass 60% of tool radius
Q Depth of cut per pass in Z axis Up to Z at a pass
M Setting mode for R and Z Absolute
Notes:
(1) The H, if larger than (0.85 tool diameter), allows a certain part to be unmachined.
(2) Only down-cut (CCW) is used.
- 17 -
Example:
O104;
G90 G00 G54 X-120. Y-100.;
S200 M03;
G43 Z50.0 H
G65 P9140 U100.V80. I16. H15. D23. R2. Z-10. F60. S30.;
X0 Y0 M05;
O204;
G90 G00 G54 X-120. Y-100.;
S200 M03;
G43 Z50.0 H ;
G65 P9140 U100. V80. I20. H15. D23. R2. Z-20. F60. S30. Q8.;
X0 Y0 M05;
- 18 -
O9140(SQUARE POCKET)
IF[[#21*#22]EQ0]GOTO990 G91X#5Y#6F#9
IF[[#7*#9]EQ0]GOTO990 X-[2*#10]Y[2*#8]
IF[#18EQ#0]GOTO990 X-[2*#5]Y-[2*#6]
IF[#26EQ#0]GOTO990 X[2*#10]Y-[2*#8]
IF[#4GT[#21/2]]GOTO992 X#5Y#6
IF[#4GT[#22/2]]GOTO992 #5=#5+#23
IF[#17EQ0]GOTO991 #6=#6+#20
#17=ABS[#17*1.] #8=#8+#23
#32=#4001 #10=#10+#20
#31=#4003 #12=#12+#11
M98P9100 END2
#24=#5001 #5=[#21/2-#4]*COS[#1]
IF[#101EQ50]GOTO200 #6=[#21/2-#4]*SIN[#1]
IF[#101EQ60]GOTO200 #8=[#22-2*#4]*COS[#1]
#25=#5002 #10=[#22-2*#4]*SIN[#1]
GOTO201 #27=#12-[#22/2-#4]
N200#25=#5004 IF[#27LE[#4-#30]]GOTO80
N201IF[#11NE#0]GOTO120 #27=#4-#30
#11=#30*1.2 #12=[#22/2-#30]
N120IF[#4NE#0]GOTO10 N80WHILE[#12LE[#22/2-#30]]DO3
#4=#30 #2=#27*SIN[#1]
N10IF[#4LT#30]GOTO991 #3=#27*COS[#1]
IF[#19NE#0]GOTO20 G90G01F[#9/2]
#19=#9/2 X[#24+#12*SIN[#1]]Y[#25-#12*COS[#1]]
N20IF[#13EQ1]GOTO30 G91X#5Y#6F#9
IF[#18LT#26]GOTO992 G03X[#3-#2]Y[#3+#2]I-#2J#3
IF[#33LT#18]GOTO992 G01X-#10Y#8
#29=#18 G03X-[#3+#2]Y[#3-#2]I-#3J-#2
#28=#26 G01X-[2*#5]Y-[2*#6]
GOTO40 G03X-[#3-#2]Y-[#3+#2]I#2J-#3
N30#29=#33-ABS[#18] G01X#10Y-#8
#28=#29-ABS[#26] G03X[#3+#2]Y-[#3-#2]I#3J#2
N40IF[#17NE0]GOTO50 G01X#5Y#6
#17=ABS[#29-#28] IF[#12EQ[#22/2-#30]]GOTO100
N50IF[#21GE#22]GOTO60 #12=#12+#11
#27=#21 #27=#27+#11
#21=#22 IF[#12LE[#22/2-#30]]GOTO90
#22=#27 #12=#22/2-#30
#1=#1+90. #27=#4-#30
N60#27=[#21-#22+#11]/2 N90END3
#23=#11*COS[#1] N100G90G01X#24Y#25F#9
#20=#11*SIN[#1] IF[#103GE0.1]GOTO300
#15=#27*COS[#1] #14=ROUND[#14*1000]/1000
#16=#27*SIN[#1] #28=ROUND[#28*1000]/1000
G90G00Z#29 GOTO301
#14=#29 N300#14=ROUND[#14*10000]/10000
DO1 #28=ROUND[#28*10000]/10000
#14=#14-#17 N301
IF[#14GE#28]GOTO70 IF[#14EQ#28]GOTO110
#14=#28 END1
N70G90G01Z#14F#19 N110G90G00Z#33
#5=#15 GOTO999
#6=#16 N990#3000=140(DATA LACK)
#8=#23/2 N991#3000=141(OFFSET ERROR)
#10=#20/2 N992#3000=142(DATA ERROR)
#12=#11/2 N999G#32G#31F#9M99
WHILE[#12LE[#22/2-#4]]DO2
G90G01X[#24+#10]Y[#25-#8]F[#9/2]
- 19 -
(6) Special pecking cycle (A) O9150 <Cycle in combination of G73 and G83 canned cycles>
Initial point
Point Z
Point Z
Hole position
Argu-
Meaning If omitted
ment
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
Q Amount of cut per pass Alarm 140
S Peck cycle pattern distance Alarm 140
F Feedrate Alarm 140
M Setting mode for R and Z Absolute
- 20 -
Example:
ø9.8 drill
Feedrate: 90 mm/min
Amount of cut per pass: 3 mm
Pattern distance: 15 mm
Absolute: (G90) is used.
O105;
G90 G00 G54 S580 M03;
G43 Z100.0 H
X0 Y0 M05;
M30;
- 21 -
O9150(DEEP HOLE CYCLE A)
IF[[#17*#19]EQ0]GOTO990
IF[#18EQ#0]GOTO990
IF[#26EQ#0]GOTO990
IF[#9EQ#0]GOTO990
#32=#4001
#31=#4003
M98P9100
IF[#13EQ1]GOTO10
IF[#18LT#26]GOTO992
#1=#18
#2=#26
GOTO20
N10#1=#33-ABS[#18]
#2=#1-ABS[#26]
N20#17=ABS[#17]
#19=ABS[#19]
G90G00Z#1
#3=#1-#19
#4=#1-#17
#3003=1
WHILE[#4GT#2]DO1
G01Z#4F#9
#5=#4+0.2
IF[#4GT#3]GOTO30
#3=#3-#19
G00Z#1
N30G00Z#5
#4=#4-#17
END1
G01Z#2F#9
G00Z#33
#3003=0
GOTO999
N990#3000=140(DATA LACK)
N992#3000=142(DATA ERROR)
N999G#32G#31M99
- 22 -
(7) Special pecking cycle (B) O9160
Initial point
Point R
Drilled hole
Point K
Hole to be
drilled
Point Z
Hole position
Argu-
Meaning If omitted
ment
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
Q Amount of cut per pass Alarm 140
F Feedrate Alarm 140
K Drilled hole depth point K Depth 0
M Setting mode for R, Z and K Absolute
- 23 -
Example:
ø10 drill
Feedrate: 90 mm/min
Amount of cut per pass: 2 mm
Depth of drilled hole: 10 mm
Absolute: (G90) is used.
O106;
G90 G00 G54 S580 M03;
G43 Z100.0 H
X0 Y0 M05;
M30;
- 24 -
(8) Reaming cycle O9170
<Cutting feed is used even when the drill returns to R point from Z point>
Initial point
Point R
Point Z
Hole position
Argu-
Meaning If omitted
ment
R Rapid traverse approach point R Alarm 140
Z Hole bottom point Z Alarm 140
F Feedrate Alarm 140
S Return feedrate 2 times of F
M Setting mode for R and Z Absolute
- 25 -
Example:
ø10 reamer
Advance ccumula: 50 mm/min
Return ccumula: 80 mm/min
Incremental: (G91) is used.
X, Y start point X0, Y0 (workpiece zero point)
Z start point 100 mm above workpiece
O107;
G91 G00 S300 M03;
G66 P9170 R-98. Z-47. F50. S80. M1.;
X10. Y20.; ·············①
X-25. Y10.; ·············②
X-15. Y-15.;·············③
G67;
X30. Y-15. M05;
M30;
O9170(REAMER CYCLE)
IF[#18EQ#0]GOTO990
IF[#26EQ#0]GOTO990
IF[#9EQ#0]GOTO990
#32=#4001
#31=#4003
M98P9100
IF[#19NE#0]GOTO10
#19=#9*2
N10IF[#13EQ1]GOTO20
IF[#18LT#26]GOTO992
IF[#33LT#18]GOTO992
#1=[#33-#18]
#2=ABS[#18-#26]
GOTO30
N20#1=ABS[#18]
#2=ABS[#26]
N30G91G00Z-#1
G01Z-#2F#9
G01Z#2F#19
G00Z#1
GOTO999
N990#3000=140(DATA LACK)
N992#3000=142(DATA ERROR)
N999G#32G#31F#9M99
- 26 -
(9) Circumferential positioning of holes O9180
3rd hole
4th hole 2nd hole
1st hole
Argu-
Meaning If omitted
ment
X X coordinate value of circular center Alarm 140
Y Y coordinate value of circular center Alarm 140
I Radius of circle Alarm 140
D Number of holes equally spaced Alarm 140
A Starting angle of 1st hole Starting angle = 0
S Subprogram No. to be called Not called
Notes:
- 27 -
Example: (Drilling):
ø8 drill
Feedrate: 60 mm/min
Absolute: (G90) is used.
O108;
G90 G00 G54 S800 M03;
G43 Z50.0 H
M30;
O9180(BOLT HOLE)
IF[[#4*#7]EQ0]GOTO990
IF[#24EQ#0]GOTO990
IF[#25EQ#0]GOTO990
IF[#4009EQ80]GOTO10
IF[#19NE#0]GOTO992
N10#31=#4003
#10=1
WHILE[#10LE#7]DO1
#11=#1+360*[#10-1]/#7
#12=#24+#4*COS[#11]
#13=#25+#4*SIN[#11]
G90X#12Y#13
IF[#19EQ#0]GOTO20
G#31
G65P#19
N20#10=#10+1
END1
GOTO999
N990#3000=140(DATA FUSOKU)
N992#3000=142(DATA ERROR)
N999G#31M99
- 28 -
(10) Positioning of holes on arc O9190
Argu-
Meaning If omitted
ment
X X coordinate value of circular center Alarm 140
Y Y coordinate value of circular center Alarm 140
I Radius of circle Alarm 140
B Pitch angle Alarm 140
D Quantity Alarm 140
A Starting angle of 1st hole Starting angle = 0
S Subprogram No. to be called Not called
Notes:
- 29 -
Example: (Drilling):
ø6.5 drill
Feedrate: 60 mm/min
Absolute: (G90) is used.
O109;
G90 G00 G54 S800 M03;
G43 Z50.0 H ;
M30;
O9190(ARC)
IF[[#4*#2*#7]EQ0]GOTO990
IF[#24EQ#0]GOTO990
IF[#25EQ#0]GOTO990
IF[#4009EQ80]GOTO10
IF[#19NE#0]GOTO992
N10#31=#4003
#10=0
#27=#7-1
#27=ROUND[#27*1000]/1000
WHILE[#10LE#27]DO1
#11=#1+#10*#2
#12=#24+#4*COS[#11]
#13=#25+#4*SIN[#11]
G90X#12Y#13
IF[#19EQ#0]GOTO20
G#31
G65P#19
N20#10=#10+1
END1
GOTO999
N990#3000=140(DATA LACK)
N992#3000=142(DATA ERROR)
N999G#31M99
- 30 -
(11) Positioning of holes in matrix O9200
H holes
Start point
D holes
Argu-
Meaning If omitted
ment
X X coordinate value of 1st hole Alarm 140
Y Y coordinate value of 1st hole Alarm 140
(4)
U Pitch in X direction Alarm 140
D Number of holes in X direction Alarm 140
(4)
V Pitch in Y direction Alarm 140
H Number of holes in Y direction Alarm 140
S Subprogram No. to be called Not called
Notes:
(1) Use the absolute value (G90) for positioning.
(2) Do not specify S if a canned cycle is used.
(3) Subprogram must be made in the incremental value (G91).
(4) Machining sequence varies to ①, ②, ③, and ④ above from the start point shown
above, depending on positive or negative sign of U and V.
- 31 -
Example:
Main program
O110;
G90 G00 G54 X-120.0 Y-100.0;
S2000 M03;
G43 Z50.0 H
X0 Y0 M05;
M30;
Subprogram
O120;
G91;
G65 P9140 U20. V15. H3. D14. R-69. Z-6. F30. S10. Q2. M1.;
G90 M99;
O9200(MATRIX)
IF[[#21*#7*#22*#11]EQ0]GOTO990 END2
IF[#24EQ#0]GOTO990 IF[#10EQ#11]GOTO999
IF[#25EQ#0]GOTO990 G91X-[#21*[#7-1]]Y#22
IF[#4009EQ80]GOTO10 #10=#10+1
IF[#19NE#0]GOTO992 END1
N10#31=#4003 GOTO999
G90X#24Y#25 N990#3000=140(DATA LACK)
#10=1 N992#3000=142(DATA ERROR)
WHILE[#10LE#11]DO1 N999G#31M99
#12=1
IF[#19EQ#0]GOTO20
G#31
G65P#19
N20WHILE[#12LE[#7-1]]DO2
G91X#21
IF[#19EQ#0]GOTO30
G#31
G65P#19
N30#12=#12+1
- 32 -
Contents of O9100
- 33 -
6. APPENDIX
It is valid when the tool length (from gauge line to blade tip) is shown.
Tool length
Workpiece offset
to be set
Reference block
Z0 plane
Workpiece
Table
Program:
O Program No. ;
G△△ ← Select work coordinate system G54 – G59, G54.1 P1 – P48
Procedure:
- 34 -
② Work coordinate system setting when tool length offset is not used.
(It is valid when the tool to be used is only one and the length is unknown.)
Z0 plane
Workpiece
Table
Program:
O Program No. ;
G△△ ← Select work coordinate system G54 – G59, G54.1 P1 – P48
G65 P9006 B☆☆ ; ← B Height of reference block (The value is set with
decimal point.
M30 ;
Procedure:
② Execute the above program. Then, a desired coordinate system is automatically set.
- 35 -
O 9006 ( Z WORK ZERO SET )
Contents of O 9006 #110 = #0
M98 P9100
IF [ #11 EQ #0 ] GOTO40
(They are not programmed in
GOTO [ #102 * 10 + 10 ]
the system tape.)
N10 IF [ #100 GE 200 ] GOTO11
#110 = # [ 2000 + #11 ]
FANUC 11M GOTO40
FANUC 15M N11 #110 = # [ 10000 + #11 ]
PROFESSIONAL 2 GOTO40
N20
PROFESSIONAL 3
N30 IF [ #100 EQ 12 ] GOTO31
PROFESSIONAL 5 IF [ #100 GE 200 ] GOTO31
PROFESSIONAL A #110 = # [ 2000 + #11 ] + # [ 2200 + #11 ]
COMMAND Ⅲ N GOTO40
N31 #110 = # [ 10000 + #11 ] + # [ 11000 + #11 ]
COMMAND 5N N40 #10 = ROUND [ [ #4014 – 54 ] * 1000 ] / 1000;
(Except HDNC IF [ # 10 EQ 0.1 ] GOTO50
machine) # [ 5223 + 20 * #10 ] = #5023 - #2 - #110
GOTO70
N50 #13 = ROUND [ [ #4130 – 1 ] * 1000 ] / 1000;
N60 # [ 7003 + 20 * #10 ] = #5023 - #2 - #110;
N70 M99;
- 36 -
O9006 ( Z WORK ZERO SET )
#110 = #0
M98 P9100
FANUC 6MB IF [ #11 EQ #0 ] GOTO20
FANUC 0MB IF [ #102 EQ 1] GOTO10
FANUC 0MC #110 = # [ 2000 + #11 ]
PROFESSIONAL 1 GOTO20
N10 #110 = # [ 2000 + # 11 ] + # [ 2200 + #11 ]
N20 #10 = ROUND [ [ #4014 – 54 ] * 1000 ] / 1000;
# [ 2701 + #10 ] = #5023 - #2 - #110
N60 M99
- 37 -
(2) Tool length measurement macro
Z0 plane
Workpiece
Table
Program:
O Program No. ;
G65 P9007 H□□ B☆☆ ; H Offset number to set measurement value
M30 ; B Height of reference block (The value
is set with decimal point.)
Procedure:
The set value of Z in the work coordinate system is Z0.000 (when the top of the workpiece is
defined as a work zero point).
- 38 -
O 9007 ( TOOL LENGTH MEASURE )
Contents of O 9007 IF [ #11 EQ #0 ] GOTO990
M98 P9100
(They are not programmed in GOTO [ #102 * 10 + 10 ]
the system tape.) N10 IF [ #100 GE 200 ] GOTO11
# [ 2000 + #11 ] = #5023 - #2
GOTO40
N11 # [ 10000 + #11 ] = #5023 - #2
FANUC 11M GOTO40
FANUC 15M N20
PROFESSIONAL 2 N30 IF [ #100 EQ 12 ] GOTO31
IF [ #100 GE 200 ] GOTO31
COMMAND Ⅲ N # [ 2000 + #11 ] = #5023 - #2
COMMAND 5N # [ 2200 + #11 ] = 0
(Except HDNC GOTO40
machine) N31 # [ 10000 + #11 ] = #5023 - #2
# [ 11000 + #11 : = 0
GOTO40
N990 #3000 = 140 ( NOT ASSIGNED )
N40 M99
- 39 -
O9007 ( TOOL LENGTH MEASURE )
IF [ #11 EQ #0 ] GOTO990
M98 P9100
GOTO [ #102 * 10 + 10 ]
N10 IF [ #100 GE 200 ] GOTO11
# [ 2000 + #11 ] = #5023 - #2
GOTO40
N11 # [ 10000 + #11 ] = #5023 - #2
PROFESSIONAL A
GOTO40
PROFESSIONAL 3 N20
PROFESSIONAL 5 N30 IF [ #100 EQ 12 ] GOTO31
PROFESSIONAL P/S IF [ #100 GE 200 ] GOTO31
# [ 2200 + #11 ] = #5023 - #2
# [ 2000 + #11 ] = 0
GOTO40
N31 # [ 11000 + #11 ] = #5023 - #2
# [ 10000 + #11 ] = 0
GOTO40
N990 #3000 = 140 ( NOT ASSIGNED )
N40 M99
- 40 -
(3) Reading cutting time
Common to all the NC units
Program:
Machining program
G53 ;
#1 = #3002 ;
#520 = ROUND [ [ #1 * 60 ] * 10 ] / 10 ;
M30 ;
or
- 41 -
7. LOCAL VARIABLES, COMMON VARIABLES, AND SYSTEM
VARIABLES
- 42 -
7.3 System variables
H code D code
Up to 200: Geometry Wear Geometry Wear
compensation compensation compensation compensation
Tool offset number 1 #2001 #2201 #2401 #2601
: : : : :
Tool offset number 200 #2200 #2400 #2600 #2800
H code D code
201 and above: Geometry Wear Geometry Wear
compensation compensation compensation compensation
Tool offset number 1 #10001 #11001 #12001 #13001
: : : : :
Tool offset number 999 #10999 #11999 #12999 #13999
- 43 -
b. Work offset amount
Note: For the machine model HDNC (with COMMAND Ⅲ N or COMMAND 5N),
the first axis is called X axis, the second YT axis, the third ZT axis, the fourth Y
axis, and the fifth Z axis. For the others and NC units, the first axis is called X
axis, the second Y axis, and the third Z axis.
Model FS 0MB FS 6MB FS 15M Professional A YASNAC
FS 0MC FS 11M Professional 3 MX3
Professional 1 Professional 2 Professional 5
Command ⅢN Professional P / S
Axis Command 5N FS 16M
External 1st axis #2500 #5201 #2500
workpiece 2nd axis #2600 #5202 #2600
offset 3rd axis #2700 #5203 #2700
Same as left Same as left
4th axis #2800 #5204 #2800
5th axis #5205
6th axis #5206
G54 1st axis #2501 #5221 #2501
2nd axis #2601 #5222 #2601
3rd axis #2701 #5223 #2701
Same as left Same as left
4th axis #2801 #5224 #2801
5th axis #5225
6th axis #5226
G55 1st axis #2502 #5241 #2502
2nd axis #2602 #5242 #2602
3rd axis #2702 #5243 #2702
Same as left Same as left
4th axis #2802 #5244 #2802
5th axis #5245
6th axis #5246
G56 1st axis #2503 #5261 #2503
2nd axis #2603 #5262 #2603
3rd axis #2703 #5263 #2703
Same as left Same as left
4th axis #2803 #5264 #2803
5th axis #5265
6th axis #5266
G57 1st axis #2504 #5281 #2504
2nd axis #2604 #5282 #2604
3rd axis #2704 #5283 #2704
Same as left Same as left
4th axis #2804 #5284 #2804
5th axis #5285
6th axis #5286
G58 1st axis #2505 #5301 #2505
2nd axis #2605 #5302 #2605
3rd axis #2705
Same as left
#5303
Same as left
#2705
4th axis #2805 #5304 #2805
5th axis #5305
6th axis #5306
G59 1st axis #2506 #5321 #2506
2nd axis #2606 #5322 #2606
3rd axis #2706
Same as left
#5323
Same as left
#2706
4th axis #2806 #5324 #2806
5th axis #5325
6th axis #5326
Additional work
coordinate system
G54.1 P1 1st axis #7001
: : Same as left
6th axis #7006
G54.1 P2 1st axis #7021
: : Same as left
6th axis #7026
: :
: :
G54.1 P48 1st axis #7941
: : Same as left
6th axis #7946
- 44 -
c. Position data
Note: For the machine model HDNC (with COMMAND Ⅲ N or COMMAND 5N),
the first axis is called X axis, the second YT axis, the third ZT axis, the fourth Y
axis, and the fifth Z axis. For the others and NC units, the first axis is called X
axis, the second Y axis, and the third Z axis.
Model FS 0MB FS 6MB FS 15M Professional A YASNAC
FS 0MC FS 11M Professional 3 MX3
Professional 1 Professional 2 Professional 5
Command ⅢN Professional P / S
Axis Command 5N FS 16M
Block end point
No consideration is made
for work coordinate
system and compensation.
1st axis #5001 Same as left Same as left Same as left Same as left
2nd axis #5002
3rd axis #5003
: :
6th axis #5006
Current command position
Consideration is made for
machine coordinate
system and compensation.
1st axis #5021 Same as left Same as left Same as left Same as left
2nd axis #5022
3rd axis #5023
: :
6th axis #5026
Current command position
Consideration is made for
work coordinate system
and compensation.
1st axis #5041 Same as left Same as left Same as left Same as left
2nd axis #5042
3rd axis #5043
: :
6th axis #5046
G31 skip position
Consideration is made for
work coordinate system
and compensation.
1st axis #5061 Same as left Same as left Same as left Same as left
2nd axis #5062
3rd axis #5063
: :
6th axis #5066
- 45 -
d. Modal data
FS 0MB FS 6MB FS 15M Professional A YASNAC
Model FS 0MC FS 11M Professional 3 MX3
Professional 1 Professional 2 Professional 5
Axis Command ⅢN Professional P / S
Command 5N FS 16M
G code
G00, G01, G02, G03 #4001 Same as left Same as left Same as left Same as left
G17, G18, G19 #4002 Same as left Same as left Same as left Same as left
G90, G91 #4003 Same as left Same as left Same as left Same as left
G22, G23 #4004 Same as left Same as left Same as left
G94, G95 #4005 Same as left Same as left Same as left
G20, G21 #4006 Same as left Same as left Same as left Same as left
G40, G41, G42 #4007 Same as left Same as left Same as left Same as left
G43, G44, G49 #4008 Same as left Same as left Same as left Same as left
G73, G74, G76, G80 – G89 #4009 Same as left Same as left Same as left Same as left
G98, G99 #4010 Same as left Same as left Same as left Same as left
G50, G51 #4011 Same as left Same as left Same as left #4015
G66, G67 #4012 Same as left Same as left Same as left #4014
G54 – G59, G54.1 #4014 Same as left Same as left Same as left #4012
G61 – G64 #4015 Same as left Same as left Same as left #4013
G68, G69 #4006 #4016 Same as left #4018
G50.1, G51.1 #4018
G122, G123 #4017
B code #4102 Same as left Same as left Same as left Same as left
D code #4107 Same as left Same as left Same as left Same as left
F code #4109 Same as left Same as left Same as left Same as left
H code #4111 Same as left Same as left Same as left Same as left
M code #4113 Same as left Same as left Same as left Same as left
Sequence number #4114 Same as left Same as left Same as left Same as left
Program number #4115 Same as left Same as left Same as left Same as left
S code #4119 Same as left Same as left Same as left Same as left
T code #4120 Same as left Same as left Same as left Same as left
Additonal work coordinate system #4130 Same as left
number
Alarm #3000 Same as left Same as left Same as left Same as left
Clock 1 (ms) #3001 Same as left Same as left Same as left Same as left
Clock 2 (hour) #3002 Same as left Same as left Same as left Same as left
Single block control #3003 Same as left Same as left Same as left Same as left
Feed hold control #3004 Same as left Same as left Same as left Same as left
Time data (YMD) #3011 #3011 Same as left
(HMS) #3012 #3012 Same as left
Message #3006 Same as left
Mirror image #3005 #3007
- 46 -
REVISION RECORD
Revision Revision
No. Contents Remarks
No. Date
4 8911 Nov. 1989 ① FS 0-MC, COMMAND 5N, Contents of the macro
PROFESSIONAL 2, and YASNAC MX3 system tape has been
have been added. changed in Tape No.
② No. O9003 has been changed to No. O9005. SE074E-8911.
③ FS 15-M of No. O9005 has been changed.
④ IF[#33 LT #18]
GOTO992 has been added to O9110, O9120,
O9130, O9140, and O9170.
5 9106 Jun. 1991 G04 has been added to XY zero point setting
macro (O9005).
6 9208 Aug. 1992 Corner circle specification has been added to Use SE074-9208! for
O9140. the macro tape.
NC and offset memory type have been changed to
the mode setting to O9100.
7 9306 Jun. 1993 ① O9120 H command is omissible. Use SE074E-9308
② Correction at omission of Q in O9140. (VERSION 3)! for the
macro system tape (Z
③ Addition of Z zero point setting macro and
origin setting macro
tool length measurement macro.
and tool length
measurement macro
are not input in the
① Correct inconvenience of O9006 in which tape).
8 9405 May 1994 Use SE074-9405! for
any other work coordinate system except G54 the macro system tape.
cannot be used.
② Operator from LT to LE in line number 42nd
of O9120 has been changed.
③ ROUND processing in variable #14, #28 of
O9140 has been added.
9 9711 Nov. 1997 N50 has been added to O9006.
N60 has been changed.
10 0008 Aug. 2000 The custom macros has been applied to the NC Use SE074-0008! for
units of 0.0001 mm unit. the macro tape.
11 0503 Mar 2005 PROFESSIONAL 5 have been added.
12 0603 Mar 2006 PROFESSIONAL 5(FS310iS) have been added.
13 1102 Feb 2011 PROFESSIONAL P(FS0i-MD) have been added. Use SE074-1102! for
Processing of operation error O9005 has been the macro tape.
added.
14 MA Version Mar 2015 PROFESSIONAL S(FS0i-MD) have been added.
V123-P4E-
XC
15 MA Version May 2016 PROFESSIONAL P/S(FS0i-MF) have been added.
V123-P4E-
XD
- 47 -