0% found this document useful (0 votes)
94 views

Custom Macro Sample Programming Manual (En)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

Custom Macro Sample Programming Manual (En)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

CUSTOM MACRO

SAMPLE PROGRAMMING MANUAL

For S-series, E-series, F-series, PS-series & Slim3 /


Slim3n Machines

(V1231I-P4E-XD)
SAMPLE CUSTOM MACROS

-i-
V1231I-P4E-XD
- ii -
CONTENTS

1. GENERAL ……………………………………………………………………………………….. 1

2. PRECAUTIONS IN USING CUSTOM MACRO ……………………………………………… 2

2.1 Set value of #100 in 09100 …………………………………………………………….. 2

2.2 Restriction ………………………………………………………………………………... 3

2.3 Notice …………………………………………………………………………………….. 3

3. ALARM DISPLAY ……………………………………………………………………………….. 4

4. MACRO CALL USING G CODES …………………………………………………………….. 5

5. MACRO PROGRAM ……………………………………………………………....................... 6

(1) XY zero point setting O9005 ……………………………………….. 6

(2) Inside circle finishing O9110 ……………………………………….. 8

(3) Deep circular pocket cutting O9120 ……………………………………… 11

(4) Outside box pocket finishing O9130 ……………………………………… 14

(5) Deep box pocket cutting O9140 ……………………………………… 17

(6) Special pecking cycle (A) O9150 ……………………………………… 20

(7) Special pecking cycle (B) O9160 ……………………………………… 23

(8) Reaming cycle O9170 ……………………………………… 25

(9) Circumferential positioning of holes O9180 ……………………………………… 27

(10) Positioning of holes on arc O9190 ……………………………………… 29

(11) Positioning of holes in matrix O9200 ……………………………………… 31

Contents of O9100 ……………………………………………………………………………. 33

6. APPENDIX ……………………………………………………………………………………. 34

(1) Z zero point setting macro …………………………………………………………… 34

(2) Tool length measurement macro ……………………………………………………. 38

(3) Reading cutting time ………………………………………………………………….. 41

7. LOCAL VARIABLES, COMMON VARIABLES,


AND SYSTEM VARIABLES …………………………………………………………………. 42

-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

Number of programs: 12 pcs


Tape length: approx. 25 m(Except for FANUC Series 310is)
approx. 30 m(FANUC Series 310is or later)

-1-
2. PRECAUTIONS IN USING CUSTOM MACRO

2.1 Set value of #100 in O9100

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”.

O9100 (CALC OFFSET & ABSIO POS);


#100 = Set value (SELECVT OF NC/UNIT & OFFSET TYPE);
G53;
:
:
(Contents of O9100 is shown on page .)

List of set values of #100 in O9100


Offset memory type A B C
201 and 201 and 201 and
up to 200 up to 200 up to 200
NC unit above above above
FANUC Series 15-M
PROFESSIONAL 2
0 200.0 1.0 201.0 2.0 202.0
COMMAND 5N
(Except HDNC machine)
PROFESSIONAL A 0.001
10.1 210.0 11.0 211.0 12.0 212.0
spec.
PROFESSIONAL 3
0.0001
PROFESSIONAL 5 10.1 210.1 11.1 211.1 12.1 212.1
spec.
PROFESSIONAL P / S - - - - 12.1 212.1
FANUC SYSTEM 11M
COMMAND Ⅲ N 20.0 220.0 21.0 221.0 22.0 222.0
(Except HDNC machine)
FANUC Series 0-MB
FANUC Series 0-MC
30.0  31.0   
FANUC SYSTEM 6M-B
PROFESSIONAL 1
SYC43/64 NC UNIT
40.0 40.0    
YASNAC MX3
COMMAND Ⅲ N of HDNC
50.0 250.0 51.0 251.0 52.0 252.0
machine
COMMAND 5N of HDNC 60.0 260.0 61.0 261.0 62.0 262.0

-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.

(2) Any arguments must be given decimal point.

Example: G65 P9110 --- D5 ---; NG


G65 P9110 --- D5 ---; OK

(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.

Alarm No. Description


140 NOT ASSIGNED
140
① Data necessary for cutting is not specified or 0 is specified. Confirm the
(640, 3140) argument of .

141 OFFSET ERROR


① Tool radius offset value larger than cutting hole radius or approach circle
141 radius is set.
(641, 3141) ② Tool radius offset value larger than corner arc radius is set.
③ Tool radius offset value is 0.
141 DATA ERROR
① R point is set under hole bottom point Z.
142 ② Cutting cannot be started under R point (Z minus direction). Start cutting
(642, 3142) above R point (+ side).
③ Corner arc radius or approach circle radius is larger than the half of lateral side
length and longitudinal side length.
142 NC UNIT DATA ERROR
143
(643, 3143) ① Correct the value of “#100 = ” of O9100 according to List of Set Values
in 2.1.

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).

4.3 Change the command format for calling a macro as follows;


Value to be set to G parameter argument assignment;

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

Example: Calling O9110 (inside circle finishing) with G112.


1. Change program number to O9012.
2. Set 112 to parameter number corresponding to O9012.
3. Specify in the command format below.

G112I D R Z F ;

-6-
5. MACRO PROGRAM

(1) XY zero point setting O9005


Install a workpiece on the table or a fixture and perform centering. Then, call the macro and
execute it, so that the workpiece offset value can automatically be set.

Machine zero point


Y axis
workpiece offset

X axis workpiece offset


Work coordinate origin

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.

(b) Make a program below in the EDITOR mode.

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

 Specify Q1. for CW, and omit Q for CCW.

 Specify M1. when R and Z are incremental values.


Omit M when R and Z are absolute values.

Note: The tool radius compensation (G40, G41, G42) is used.


The offset value must be less than the radius of the approach circle.

-8-
Example:

[1] ø20 end mill, D12 = 10.0


Feedrate: 70 mm/min
Approach rate: 200 mm/min
Cutting direction: CCW (down-cut)
Absolute: (G90) is used.
R value
O101;
Z value
G90 G00 G54 X70.0 Y80.0;
S300 M03;
G43 Z50.0H ;

G65 P9110 I40. D12. R-8. Z-10. F70. S200.;

X0 Y0 M05;
M30;

[2] ø16 end mill, D01 = 8.0


Feedrate: 60 mm/min
Approach rate: 100 mm/min
Cutting direction: CW (up-cut)
Incremental: (G91) is used.
R value
O201; Z value
G90 G00 G54 X40.0 Y40.0;
S400 M03;
G43 Z100.0 H ;

G65 P9110 I28. D1. R-120. Z-2. F60. S100.Q1.M1.;

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

 Specify M1. when R and Z are incremental values.


Omit M when R and Z are absolute values.

Notes:

(1) Specify so that H is less than cutter diameter


(2) Only down-cut (CCW) is available.

- 11 -
Example:

[1] When undercut in Z direction is done at a time

ø25 end mill, D05 = 12.7 (0.2 remained)


Feedrate: 50 mm/min
Width of cut: 15 mm
Absolute: (G90) is used.

O102;
G90 G00 G54 X100.0 Y120.0;
S230 M03;
G43 Z100.0H ;

G65 P9120 180. D5. H15. R2. Z-7. F50..;

X0 Y0 M05;
M30;

Note: Since S is omitted, S = F/2 = 25.

[2] When undercut in Z direction is divided into several times

ø20 end mill, D22 = 10.3 (0.3 remained)


Feedrate: 50 mm/min
Cutting rate: 30 mm/min
Amount of cut per pass: 4 mm
Width of cut: 12 mm
Incremental: (G91) is used.
X, Y start point: X0, Y0 (workpiece zero point)
Z start point: 50 mm above work piece

O202;
G91 G00 X70.0 Y80.0;
S250 M03;

G65 P9120 I40. D22. H12. R-48. Z-12. F50. S30. Q4. M1.;

X-70.0 Y-80.0 M05;


M30;

- 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

 Specify Q1. for CW, and omit Q for CCW.


 Specify M1. when R and Z are incremental values.
Omit M when R and Z are absolute values.

Notes:

(1) Do not specify I when corner arc machining is not done.


(2) Since the argument of tool radius compensation is used, the offset value must be less than
C and I values.

- 14 -
Example:

[1] ø25 end mill, D13 = 12.5


Feedrate: 80 mm/min
Cutting direction: CW (up-cut)
Incremental: (G91) is used.
X, Y start point: X0Y0 (workpiece zero point)
Z start point: 50 mm above workpiece

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.;

X120.0 Y100.0 M05;


M30;

[2] ø10 end mill, D20 = 5.0


Feedrate: 60 mm/min
Cutting direction: CCW (down-cut)
Absolute: (G90) is used.

O203;
G90 G00 G54 X0 Y0;
S700 M03;
G43 Z100.0 H ;

G65 P9130 U40.V25.C10. D20. R-3. Z-5. F60. I6.;

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

 Specify M1. when R and Z are incremental values.


Omit M when R and Z are absolute values.

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:

[1] When undercut in Z axis is done at a pass

ø25 end mill, D23 = 12.8 (0.3 remained)


Feedrate: 60 mm/min
Cutting rate: 30 mm/min
Width of cut: 15 mm
Absolute: (G90) is used.

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;

[2] When cutting in Z axis is divided into several passes

ø25 end mill, D23 = 12.8 (0.3 remained)


Feedrate: 60 mm/min
Cutting rate: 30 mm/min
Amount of cut
per pass: 8 mm
Width of cut: 15 mm
Absolute: (G90) is used.

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

 Specify M1. when R and Z are incremental values.


Omit M when R and Z are absolute values.
 The drill returns to point R once when the distance exceeds the specified S value.

- 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

G66 P9150 R2. Z-50. Q3. S15. F90.;


X15. Y-15.;
X60. Y-20.;
X80. Y-50.;
X30. Y-40.;
X15. Y-65.;
G67;

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

 Specify M1. when R and Z, and K are incremental values.


Omit M when R, Z and K are absolute values.
 Use this cycle when drilling has already reached up to a certain depth (point K).

- 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

G66 P9160 R2. Z-50. K-10. Q2. F90.;


X15. Y-15.;
X30.; X20.
Y30.;
G67;

X0 Y0 M05;
M30;

O9160(DEEP HOLE CYCLE B)


IF[#18EQ#0]GOTO990 #10=#10-#17
IF[#26EQ#0]GOTO990 END1
IF[#17EQ#0]GOTO990 IF[#103GE0.1]GOTO300
IF[#9EQ#0]GOTO990 #10=ROUND[#10*1000]/1000
#32=#4001 GOTO301
#31=#4003 N300#10=ROUND [#10 *10000]/10000
IF[#6NE#0]GOTO5 N301
#6=#18 IF[#10EQ0]GOTO2
N5IF[#13EQ1]GOTO10 Z-[#8-0.2]
M98P9100 G01Z-[#10+0.2]F#9
IF[#18LT#6]GOTO992 G00Z[#3+#1]
IF[#6LT#26]GOTO992 GOTO999
IF[#33LT#18]GOTO992 N990#3000=140(DATA LACK)
#1=ABS[#33-#18] N992#3000=142(DATA ERROR)
#2=ABS[#6-#18] N2G00Z#1
#3=ABS[#26-#18] N999G#32G#31M99
GOTO20
N10#1=ABS[#18]
#3=ABS[#26]
#2=ABS[#6]
N20#17=ABS[#17]
#10=#3-#2
#8=#2
G91G00Z-#1
WHILE[#10GE#17]DO1
Z-[#8-0.2]
G01Z-[#17+0.2]F#9
G00Z[#8+#17]
#8=#8+#17

- 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

 Specify M1. when R and Z are incremental values.


Omit M when R and Z are absolute values.

- 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

When used for drilling


G90 G98 … drilling cycle … L0;
G65 P9180 X Y I D A ;
G80 X …… Y ……;

When used for multi-block machining


G65 P9180 X Y I D A S ;

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:

(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).

- 27 -
Example: (Drilling):

ø8 drill
Feedrate: 60 mm/min
Absolute: (G90) is used.

O108;
G90 G00 G54 S800 M03;
G43 Z50.0 H

G83 R2. Z-25. Q2. F80 L0;


G65 P9180 X70. Y80. I55. D6.;
G80 X0 Y0 M05;

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

When used for drilling


G90 G98 … Drilling cycle … L0;
G65 P9190 X Y I B D A ;
G80 X …… Y ……;

When used for multi-block machining


G65 P9190 X Y I B D A S ;

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:

(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).

- 29 -
Example: (Drilling):

ø6.5 drill
Feedrate: 60 mm/min
Absolute: (G90) is used.

O109;
G90 G00 G54 S800 M03;
G43 Z50.0 H ;

G83 R2. Z-15. Q2. F80L0;


G65 P9190 X70. Y80. I55. B60. D3. A30.;
G80 X0 Y0 M05;

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

When used for drilling


G90 G98 … drilling cycle … L0;
G65 P9200 X Y U D V H ;
G80 X …… Y ……;

When used for multi-block machining


G65 P9200 X Y U D V H S ;

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:

ø4 end mill D14 = 2.0


Feedrate: 30 mm/min
Cutting rate: 10 mm/min
Amount of cut per pass: 2 mm
Width of cut: 3 mm
Box pocket cutting: O9140 is used.
(Main) absolute: (G90) is used.
(Sub) incremental: (G91) is used.

Main program
O110;
G90 G00 G54 X-120.0 Y-100.0;
S2000 M03;
G43 Z50.0 H

G65 P9200 X-150. Y-115. U30. D3. V30. H2. S120.;

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

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

- 33 -
6. APPENDIX

(1) Z zero point setting macro

This macro is used to set Z axis work coordinate system.


A couple of typical examples from various setting methods are shown below.

① Work coordinate system setting when tool length offset is used.

 It is valid when the tool length (from gauge line to blade tip) is shown.

Z axis machine zero point

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

G65 P9006 H□□ B☆☆ ; ←H Tool length offset number


M30 ; B Height of reference block (The value
is set with decimal point.)

Prepare O9006 corresponding to the type of the NC unit (See page ).

Procedure:

① Align the blade tip manually to the reference block.


② Execute the above program. Then, a desired coordinate system is automatically set.

- 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.)

Z axis machine zero point

Reference block Workpiece offset


to be set

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 ;

Prepare O9006 corresponding to the type of the NC unit (See page ).

Procedure:

① Align the blade tip manually to the reference block.

② 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;

O9006 ( Z WORK ZERO SET )


#110 = #0
M98 P9100
IF [ #11 EQ #0 ] GOTO40
GOTO [ #102 * 10 + 10 ]
N10 IF [ #100 GE 200 ] GOTO11
3110 = # [ 2000 + #11 ]
GOTO40
N11 #110 = # [ 10000 + #11 ]
GOTO40
COMMAND Ⅲ N N20
COMMAND 5N N30 IF [ #100 EQ 12 ] GOTO31
(HDNC machine) IF [ #100 GE 299 ] GOTO31
#110 = # [ 2000 + #11 ] + # [ 2200 + #11 ]
GOTO40
N31 #110 = # [ 10000 + #11 ] + # [ 11000 + #11 ]
N40 #10 = ROUND [ [ #4014 – 54 ] * 1000 ] / 1000;
IF [ #10 EQ 0.1 ] GOTO50
# [ 5225 + 20 * #10 ] = #5025 - #2 - #110
GOTO60
N50 #13 = ROUND [ [ #4130 – 1 ] * 1000 ] / 1000;
N60 # [ 7005 * 20 * #103 ] = #5025 - #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

O9006 (Z WORK ZERO SET )


#110 = #0
M98 P9100
IF [ #11 EQ #0 ] GOTO20
IF [ #102 EQ 1 ] GOTO10
YASNAC MX3 #110 = # [ 2000 + #11 ]
GOTO20
N10 #110 = # [ 2000 + #11 ] + # [ 2200 + #11 ]
N20 #10 = ROUND [ [ #4012 – 54 ] * 1000 ] / 1000;
# [ 2701 + #10 ] = #5023 - #2 - #110
N60 M99

- 37 -
(2) Tool length measurement macro

This macro is used to measure tool length.


Most typical example from various methods is shown below.

Z axis machine zero point

Tool length to be measured


Reference block (The value is negative.)

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.)

Prepare O9007 corresponding to the type of the NC unit (See page ).

Procedure:

① Align the blade tip manually to the reference block.

② Execute the above program. Then, a measurement value is automatically set.

Relationship with Z work zero point:

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

O9007 ( TOOL LENGTH MEASURE )


IF [ #11 EQ #0 ] GOTO990
M98 P9100
GOTO [ #102 * 10 + 10 ]
N10 IF [ #100 GE 200 ] GOTO11
# [ 2000 + #11 ] = #5025 - #2
GOTO40
N11 # [ 10000 + #11 ] = #5025 - #2
COMMAND Ⅲ N GOTO40
COMMAND 5N N20
N30 IF [ #100 EQ 12 ] GOTO31
(HDNC machine)
IF [ #100 GE 200 ] GOTO31
# [ 2000 + #11 ] = #5025 - #2
# [ 2200 + #11 ] = 0
GOTO40
N31 # [ 10000 + #11 ] = #5025 - #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

O9007 ( TOOL LENGTH MEASURE )


IF [ #11 EQ #0 ] GOTO990
M98 P9100
FANUC 6MB
IF [ #102 EQ 1 ] GOTO10
FANUC 0MB # [ 2000 + #11 ] = #5023 - #2
FANUC 0MC GOTO20
PROFESSIONAL 1 N10 # [ 2200 + #11 ] = #5023 - #2
# [ 2000 + #11 ] = 0
YASNAC MX3 GOTO20
N990 #3000 = 140 ( NOT ASSIGNED )
N20 M99

- 40 -
(3) Reading cutting time
Common to all the NC units

This is a macro program to read cutting time.


The cumulated time while the start switch is on (the program is running) is set to the common
variable #520. The unit is set to minute (MINUTE). The value is rounded to one decimal.
The value of common variable #520 is M30 or remained even when the power is turned off.

Program:

O Program No. ; → Main program


#3002 = 0 ;

Machining program

G53 ;
#1 = #3002 ;
#520 = ROUND [ [ #1 * 60 ] * 10 ] / 10 ;
M30 ;

or

O Program No. ; → Main program


M98 P×××× ;

O×××× ( TIMER 0 SET ) ;


#3002 = 0 ;
Machining program M99 ;

O△△△△ ( TIMER COUNT ) ;


M98 P△△△△ ; G4 ;
#1 = #3002 ;
M30 ;
#520 = ROUND [ [ #1 * 60 ] * 10 ] / 10 ;
M99 ;

- 41 -
7. LOCAL VARIABLES, COMMON VARIABLES, AND SYSTEM
VARIABLES

7.1 Local variables 7.2 Common variables


(similar in those to
each NC unit)
FS 0MB FS 15M Professional A Professional YASNAC
FS 0MC FS 11M Professional 3 P/S
<blank> #0 Professional 1 Professional 2 Professional 5 MX3
A A #1 FS 6MB Command Ⅲ N FS 16M
B B #2 Command 5N
C C #3 Non-hol #100 – 149 A #100 – 149 A #100 – 149 #100 – 199 #100 – 149
I I1 #4 ding B #100 – 199 B #100 – 199
type C #100 – 199
J J1 #5 D #100 – 199
K K1 #6
Holding #500 – 531 A #500 – 549 A #500 – 531 #500 – 999 #500 – 559
D I2 #7 type B #500 – 599 #500 – 999
B
E J2 #8 #500 – 509 C #500 – 699
F K2 #9 (FS 6MB) D #500 – 999
I3 #10 Total 82 A 100 A 82 600 110
H J3 #11 B 200 B 600
60 C 300
K3 #12
(FS 6MB) D 600
M I4 #13
J4 #14
K4 #15
I5 #16
Q J5 #17
R K5 #18
S I6 #19
T J6 #20
U K6 #21
V I7 #22
W J7 #23
X K7 #24
Y I8 #25
Z J8 #26
K8 #27
I9 #28
J9 #29
K9 #30
I10 #31
J10 #32
K10 #33

- 42 -
7.3 System variables

a. Tool offset amount

FS 0MB FS 6MB FS 15M Professional A YASNAC


FS 0MC FS 11M Professional 3 MX3
Offset memory A Professional 2 Professional 5
Professional 1 Command Ⅲ N FS 16M
Command 5N
Up to 200:
Tool offset number 1 #2001
Same as left Same as left Same as left Same as left
: :
Tool offset number 200 #2200
201 and above:
Tool offset number 1 #10001
- - Same as left -
: :
Tool offset number 999 #10999

FS 15M Command Ⅲ N Professional A FS0MB


Offset memory B FS 11M Command 5N Professional 3 FS0MC
Professional 2 Professional 5
Up to 200: Geometry Wear Geometry Wear
compensation compensation compensation compensation

Tool offset number 1 #2001 #2201 #2201 #2001


: : : : :
Tool offset number 200 #2200 #2400 #2400 #2200
201 and above: Geometry Wear Geometry Wear
compensation compensation compensation compensation
Tool offset number 1 #10001 #11001 #11001 #10001
: : : : :
Tool offset number 999 #10999 #11999 #11999 #10999

Offset memory C FS 15M, FS 11M, Command Ⅲ N, Command 5N, Professional 2

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

Offset memory C Professional A, Professional 3, Professional 5, Professional P / S, FS 16M


H code D code
Geometry Wear Geometry Wear
compensation compensation compensation compensation
Tool offset number 1 #11001 #10001 #13001 #12001
: : : : :
Tool offset number 400 #11400 #10400 #13400 #12400

- 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

MANUAL NAME SAMPLE CUSTOM MACROS


MANUAL NO. SE074E-1102

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 -

You might also like