You are on page 1of 78

Macro B Programming

Makino Asia Pte Ltd


Application Department

Description
This course is designed to enable the programmer
to use the controls powerful Macro programming
feature on milling machines
Students will lean to read and write repetitive
machining cycle
Will understand the components of the macro body
and the meaning of the macro call command like
G65, G66 and G67
2

Back to basic = Speed & Feed


The consideration for determining
speeds and feed are changing
The charts provided are based on
actual machining experience utilizing
cutting techniques

Spee =

V * 318
Dia

or

V * 1000
Dia *

( 3.1412 )

End Feed = Speed * no of tooth * Feed per tooth


Drill Feed = Speed * Feed per Revolution
Tap Feed = Speed * Pitch
4

Chip Thickness
Feed per tooth

Diameter
of cutter

Chip Thickness depend on


Ad = depth of cut,
Rd = width of cut,
Sz = feed per tooth

Depth of cut
Chip Thickness
5

Feed Per Tooth


&
Feed Per Revolution

Calculation of Speed & Feed


If Ball nose

Cutting speed
Feed per tooth
Answer is
Speed

= 10 mm ( 2 teeth )
= 200 m/min ( V )
= 0.1 mm ( Sz )
= 200 * 318 / 10

= 6360 ( rpm )
Feed
= 6360 * 2 * 0.1
= 1272 mm/min
if feed reduce to 50% mean
F636, Sz = 0.05
7

Up Cut & Down Cut

No M

e
g
a
m
I
irror
8

GROUP PROGRAM
Example
O3200 ( Main Program ) like O1000, O100
O3201 ( Sub Program )
O3202 ( Sub Program )
O3203 ( Sub Program )
Use O3200,O3203 Delete
Use O3200,O3203 Punch
9

Statement Example
#1 = 123.

Answer

#2 = #1

123.

#3 = #2 + 10

133.

G01 X10. F#3

F133.

#4 = 123.4567
G00 X#4

123.457

G04 P#4

123.

G04 X#4

123.457 sec
alarm occur
133.

G#3

sec

10

Arithmetic Expression
Answer

if #1 = 8.
# [ #1 ]

#8

if #1 = 10.
# [ 100 + #1 ] = 123.

#110

= 123.

# [ 10 + #110 ] = #1

#133

= 10.

#100 = #133 + #110

#100

= 133.

#[ #133 ] = #[ #100 ] + #1

#10

= 20.

11

Arithmetic Operation Commands I


#1 = 123.
#1 = #2 + 10.
#1 = #2 - 10.
#1 = #2 * 10.
#1 = #2 / 10.
#1 = SIN [ 90 ]
#1 = COS [ 90 ]
#1 = TAN [ 90 ]
#1 = ATAN [ 1 ] / [ 1 ]

#1 = #2
#1 = #2 + #3
#1 = #2 - #3
#1 = #2 * #3
#1 = #2 / #3
#1 = SIN [ #2 ]
#1 = COS [ #2 ]
#1 = TAN [ #2 ]
#1 = ATAN [ #1 ] / [ #2 ]

12

Differ Control For ATAN

( unit = degree )

#i = ATAN [b] / [a]


#1 = ATAN [1] / [1]
#2 = ATAN [-1] / [-1]

Y
45. ( 0M-15M )
225. ( 0M )
-135. ( 15M )

#2 = ATAN [-1] / [1]

315. ( 0M )

#2 = ATAN [1] / [-1]

135. ( 0M-15M )

#2

#1

b
X

-45. ( 15M )

13

Arithmetic Operation Commands II


#1 = SQRT [ #2 ]

If
#2 = 2

#1 =

Answer
1.4142

#1 = ABS [ #2 ]

#2 = -1.23

#1 =

1.23

#1 = ROUND [#2]

#2 = 1.234
#2 = 1.5436

#1 =

1.0

#1 =

2.0

#1 = FIX [#2]

#2 = 1.234
#2 = -1.634

#1 =

1.0

#2 = 1.234
#2 = -1.634

#1 =

#1 = FUP [#2]

#1 = - 1.0
2.0

#1 = - 2.0
14

Case function of ROUND


If #1 = 12.3456

Case

X[ ROUND[#1] ]

#12 = 5.1236

or

G91 G00 X#10

X#1

X#12

= 12.376
= 5.124

Answer is

X[ #10 + #12 ]

= 17.499

Axis move X12.346

#10 = 12.3758

Answer

12.3758 + 5.1236 = 17.4994


15

Example function of ROUND


Example
#10 = 12.3758
#12 = 5.1236
X-[ ROUND[#10] + ROUND[#12] ]
or
#10 = ROUND [ #10 * 1000 ] / 1000
#12 = ROUND [ #12 * 1000 ] / 1000
X-[ #10 + #12 ]

Answer
X -17.50

X -17.50

16

Learning Activity
If #100 = 11.
#101 = 25.
#102 = -1.2345
#103 = 2.3456
#104 = ABS [#102]
#105 = ROUND [#103]
#106 = FIX [#102]
#107 = FUP [#102]
#108 = #100 + #101
#109 = #101 - #102
G91 G00 X#102
X#103
X- [#102 + #103]

Answer
= 1.2345
= 2.0
= - 1.0
= - 2.0
= 36.0
= 26.2345
move X-1.234
move X 2.346
move X-1.111
17

Empty Variable #0
#0 mean Empty or Vacant
0

is a Value

Example :#100 = #0
#102 = 0

Answer

G90 G1 X#100 F500

Axis no move

G90 G1 X#102 F500

Axis move X0

18

Repeat Function ( IF )
IF / GOTO Statement
N1 IF [ #1 GT #2 ] GOTO 2
Not OK
#1 = #1 + 1

Condition
EQ NE

GT

GE

LE

LT

OK

GOTO 1
N2 M99

19

Repeat Function ( WHILE )


WHILE / DO / END Statement
WHILE [ #1 LT #2 ] DO1
OK
#1 = #1 + 1

Not OK

END1
M99
20

Rules For DO and END


DO 1

DO 1

GOTO 1

GOTO 10

DO 2

DO 1

END 1

END 2

N1

N 10

END 1

END 1

Use Do / END without condition


21

Exercises 1 ( IF condition )
#1 = 1
N1 IF [ #1

Answer
GT
what happen
GE

10 ] GOTO 2

Process

#1 = #1 + 1
GOTO 1
N2 M30
22

Exercises 2 ( WHILE condition )


#1 = 0
WHILE [ #1

Answer
LT

10 ] DO 2

Process

#1 = #1 + 1
END 2
M30
23

Exercises 3 ( Clear by IF )
%
O100 ( IF )
#1 = 100. ( START )
#2 = 110. ( END )
N3 IF [ #1 GT #2 ] GOTO 7
# [ #1 ] = #0
#1 = #1 +1
GOTO 3
N7 M30
%

#100 = #0
#101 = #0
#102 = #0
#103 = #0
#104 = #0
#105 = #0
#106 = #0
#107 = #0
#108 = #0
#109 = #0
#110 = #0
24

Exercises 4 ( Clear by WHILE )


%
O100 ( WHILE )
#1 = 100. ( START )
#2 = 110. ( END )
WHILE [ #1 LE #2 ] DO1
# [ #1 ] = #0
#1 = #1 +1
END1
M30
%

#100 = #0
#101 = #0
#102 = #0
#103 = #0
#104 = #0
#105 = #0
#106 = #0
#107 = #0
#108 = #0
#109 = #0
#110 = #0
25

Exercises 5 ( Rewrite Tool Pot )


O100 ( REWRITE TOOL POT NUMBER )
/ M57 ( TOOL NUMBER WRITR)
/ T00 ( CLEARING TOOL NUMBER )
/ M30
M57
#1 = 1
WHILE [ #1 LT 60 ] DO1
T#1
#1 = #1 + 1
END1
M30

Pot 1 = T1
Pot 2 = T2
Pot 3 = T3
Pot 4 = T4
.
.
.
.
.
Pot 60 = T60
26

Exercises 6
#101
#102
#103
#104
#105
#106
#107
#108
#109
#110

= 1.000
= 1.414
= 1.732
= 2.000
= 2.236
= 2.449
= 2.646
= 2.828
= 3.000
= 3.162

(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
( 10 )

Using WHILE condition and ROUND + SQRT command

27

Exercises 6 ( ROUND + SQRT )


#101 = 1.000 (1)
#102 = 1.414 (2)
#103 = 1.732 (3)
#104 = 2.000 (4)
#105 = 2.236 (5)
#106 = 2.449 (6)
#107 = 2.646 (7)
#108 = 2.828 (8)
#109 = 3.000 (9)
#110 = 3.162 (10)

O100 ( SQRT )
#1 = 101. ( START )
#2 = 110. ( END )
#3 = 1. ( SQRT [ #3 ] )
WHILE [ #1 LE #2 ] DO1
# [ #1 ] = ROUND [ SQRT [#3] * 1000 ] / 1000
#1 = #1 + 1
#3 = #3 + 1
END1
M30

28

Exercise 7 ( Positioning )
O800 ( MAIN PROGRAM )
G90 G0 G54 X0 Y0
G43 H1 Z50. S1200 M3
G81 Z-1.5 R2. F100 L0 K0
M98 P801
G80
G91 G0 G28 Z0
M30
O801 ( LINE BOLT HOLE )
M99
29

#
21
*
#

O801 ( LINER BOLT HOLE )


#24 = 50. ( X Position )
#25 = 30. ( Y Position )
#1
= 30. ( Angle )
#21 = 20. ( Distance )
#11
= 4. ( No Of Hole )
#30 = 0 ( Counter )
WHILE [ #30 LT #11 ] DO1
#4 = [#21* #30] * COS [#1] + #24
#5 = [#21* #30] * SIN [#1] + #25
G90 X#4 Y#5
#30 = #30 +1
END1
M99

30

Illustration ( Positioning cycle )

#5 ( Y )

#1
#4 ( X )
30

Exercise 8 ( Drill Depth Cycle )


O800 ( MAIN PROGRAM )
G90 G0 G54 X0 Y0
G43 H1 Z50. S1200 M3
G0 X10. Y-10.
M98 P803
G91 G0 G28 Z0
M30

R point
Z0

O803 ( DRILL DEPTH CYCLE )

M99
d = 1mm

Depth Z
31

Illustration ( Drill Depth Cycle )


O803 ( DRILL DEPTH CYCLE )
#26 = 20.
( Z = Depth )
#18 = 2.
( R = R Point )
#9 = 100.
( F = Feed Rate )
#17 = 1.5
( Q = Depth Of Cut )
#33=0 ( Set )
G90 G0 Z#18
DO1
#33 = #33 + ABS[#17]
IF [ #33 LT ABS[#26] ] GOTO 11
#33 = ABS[#26]
N11 G90 G1 Z-#33 F#9
G0 Z#18
IF [ #33 EQ #26 ] GOTO99
G0 Z [ 1-#33 ]
END1
N99 M99

R point
Z0

Depth Z

32

Type System Variable


Tool Compensation
Work Offset
Macro Alarm
Clock Information
Auto operation control
Model Information
Position Information

#2001 ~ #2200
#5201 ~ #5328
#3000
#3001, #3002
#3003, #3004
#4000 ~ #4120
#5001 ~ #5065

33

Tool Offset ( Type A )


Offset
1
2

Variable No
#2001
#2002
-

> 200
#10001
#10002

99
200

#2099
#2200

#10099
#10200

If Tool Number > 200 Use #10000 + offset no


34

Example Tool Offset ( A )


Use D Offset
G90 G10 P31 R10.
same
#2032 = 5.2

Offset Page
H16
H17

H31
H32

10.0
5.2

35

Tool Offset ( Type C )


Offset

Geometry

Wear

Geometry

Wear

#2001

#2201

#2401

#2601

#2002

#2202

#2402

#2602

200

#2200

#2400

#2600

#2800

999

#10999

#11999

#12999

#13999

( H ) G90 G10 L10 P2 R5. same #2002 = 5.


( D ) G90 G10 L11 P2 R4. same #2402 = 4.
36

Work Zero Offset


G54 ( P1 )

#5221 ~ #5226

X, Y, Z, 4, 5, 6

G55 ( P2 )

#5241 ~ #5246

X, Y, Z, 4, 5, 6

G56 ( P3 )

#5261 ~ #5266

X, Y, Z, 4, 5, 6

G57 ( P4 )

#5281 ~ #5286

X, Y, Z, 4, 5, 6

G58 ( P5 )

#5301 ~ #5306

X, Y, Z, 4, 5, 6

G59 ( P6 )

#5321 ~ #5326

X, Y, Z, 4, 5, 6

External ( P0 ) #5201 ~ #5206

X, Y, Z, 4, 5, 6

37

Example Work Offset


G90 G10 L2 P1 X- 230.0 Y- 452.032 Z- 450.123
same
#5221 = - 230.0

(X)

P0

X 0.000
Y 0.000
Z 0.000

P1

X - 230.000
Y - 452.032
Z - 450.123

#5222 = - 452.032 ( Y )
#5223 = - 450.123 ( Z )
P1=G54, P2=G55, P3=G56
P4=G57, P5=G58, P6=G59

38

Model Information
Variable

Code

Variable

Code

#4000~21 G code

#4113

M code

#4102

B code

#4114

Sequence no

#4107

D code

#4115

Program no

#4108

E code

#4119

S code

#4109

F code

#4120

T code

#4111

H code

#4130

G54.1 P1~48

Refer to Manual

39

G Code List
Refer to Manual

Code

Group

Variable

G00, G01, G02, G03

01

#4001

G90, G91

03

#4003

G54, G55, G56 ~G59

14

#4014

G73, G76, G81~G89

09

#4009

G98, G99

10

#4010

Example : #27 = #4003 ( store G90/G91 Group 03 )


= 90 or 91
40

Position Information #5001 ~ #5066

Read during movement

Work coord.

Possible

#5001~

ABSIO

#5006

End block pos System

#5021~

ABSMT

Machine coord. Impossible

#5026

Current pos

System

#5041~

ABSOT

Work coord.

#5046

Current pos

System

#5061~

Skip Signal

Work coord.

#5066

G31

System

Impossible
Possible

Refer to Manual
41

Example Machine Position


G54

Machine Position

#5221

= #5021 ( X )

#5222

= #5022 ( Y )

#5223

= #5023 ( Z )

Machine Position
X - 230.000
Y - 452.032
Z - 450.123

Transfer Machine Position Into Work Offset G54 WCS

42

Alarm Message #3000


#100 = #0
IF [ #100 NE #0 ] GOTO 100
#3000 = 140 ( DATA ERROR )
N100 M99
Less than 26 character
n = 1 ~ 999

43

Clock #3001~#3002
Clock 1
Clock 2

#3001
#3002

Example 1
G65 P9010 T20.
O9010
#3001 = 0 ( initial )
#20 = #20 * 1000
WHILE [ #3001 LE #20 ] DO1
END1
M99

1 msec. ( unit )
1 hour ( unit )
Example 2
O1000
#3002 = 0 ( initial )
G0 X10. Y10.
G1 X100 F500

#100 = #3002 * 60 ( min )


M99
44

Date / Time #3011~#3012


#3011
#3012

Year / Month / Day


Hour / Minute / Second
Example
Date : 1987.5.20
#3011 = 19870520
Time : 4 : 17 : 05 PM
#3012 = 161705

45

Parts Counting #3901~#3902


#3901
#3902

Total number of parts


Required number of parts

O1000
#3902 = 50. ( required parts )
IF [ #3901 EQ #3902 ] GOTO 3000

GOTO 99
N3000 #3000 = 140 ( PART FINISH )
N99 M30
( Initial Total part = 0 and the counter execution when M30 occurs )
46

Single Block #3003


#3003
0
1
2
3

Single block
Not suppressed
Suppressed
Not suppressed
Suppressed

Function
Awaited
Awaited
Not Awaited
Not Awaited

#3003 = 1 ----- Deactivate single block stop control on panel


G0 X10. Y10.
G1 X100 F500
#3003 = 0 ----- Reactivate single block stop control on panel
M99
47

Feed hold, Override, Exact stop #3004


#3004

Feed hold

Feed rate override

Exact stop check

0
1
2
3
4
5
6
7
: Effective
48

Model Call A ( G66, G67 )

O1000 ( MAIN PROGRAM )


G90 G54 G0 X0 Y0
G43 H1 Z50. S1000 M3
G0 Z5.
G66 P1001 X80. Y60. Z5. F500
G0 X-150. Y35.
G0 X100. Y70.
60
G0 X-30. Y-140.
G67
G91 G0 G28 Z0
M30

X-150. Y35.
5
80
56

Sequence of G66, G67


G66 P1001 X80. Y60. Z5. F500
G0 X-150. Y35.
G0 X100. Y70.
G0 X-30. Y-140.
G67
1 - read variable G66 P1001 X Y Z F
2
3
4
5
6
7
8

move position G0 X-150. Y35.


call macro program O1001
back to and move G0 X100. Y70.
call macro program O1001
back to and move G0 X-30. Y-140.
call macro program O1001
back to G67 cancelled macro

#1
#2
#3
#4
#5
#6
#7
#8
#9 500.
#10
#11
#12
#13
#14
#15
#16

#17
#18
#19
#20
#21
#22
#23
#24 80.
#25 60.
#26 5.
#27
#28
#29
#30
#31
#32

57

Sample for Macro Body

O1001 ( SUB MACRO )


IF [ #24 * #25 * #9 * #26 NE 0 ] GOTO 10
#3000 = 140 ( DATA ERROR )
N10 #31 = #4003 ( G90,G91 )
G90 G1 Z - [ ABS [ #26 ] ] F#9
G91 G1 X #24
Y #25
X- #24
Y- #25
G90 G0 Z5.
G#31 M99
58

Macro Call with G code


Set parameter

G65 P9011 X10. Y10. Z5.


F500
same
G102 X10. Y10. Z5. F500

O9010 -- #6050
O9011 -- #6051 -- 102
O9012 -- #6052
O9013 -- #6053
O9014 -- #6054
O9015 -- #6055
O9016 -- #6056
O9017 -- #6057
O9018 -- #6058
O9019 -- #6059

59

Macro call with M code


Create O9020 program
and use M6 to call tool
change program
G65 P9021 X10. Y10. M8.
same
M90 X10. Y10. M8.

Set parameter

O9020 -- #6080 -- 6
O9021 -- #6081 -- 90
O9022 -- #6082 -- 91
O9023 -- #6083 -- 60
O9024 -- #6084
O9025 -- #6085
O9026 -- #6086
O9027 -- #6087
O9028 -- #6088
O9029 -- #6089
60

External Output Command


POPEN ( connection to I/O )
BPRNT ( output binary )
DPRNT ( output EIA or ISO codes )
PCLOS ( disconnection from I/O )
Command format
POPEN
DPRNT [ a #b [ c d ] ...]
PCLOS
No of digits below decimal point

No of digits above decimal point


Variable
Character

Refer to Manual
61

Printout Layout
--- MAKINO --CIRCLE NO 12
+X 0.123
+Y 0.213
--- OK ---

-X 0.321
-Y 0.132

When #18 = 12
#120 = 0.123
#121 = 0.123
#122 = 0.213
#123 = 0.132
when #120 LE #1

62

Model Call A ( G66, G67 )

O1000 ( MAIN PROGRAM )


G90 G54 G0 X0 Y0
G43 H1 Z50. S1000 M3
G0 Z5.
G66 P1001 X80. Y60. Z5. F500
G0 X-150. Y35.
G0 X100. Y70.
60
G0 X-30. Y-140.
G67
G91 G0 G28 Z0
M30

X-150. Y35.
5
80
56

Sequence of G66, G67


G66 P1001 X80. Y60. Z5. F500
G0 X-150. Y35.
G0 X100. Y70.
G0 X-30. Y-140.
G67
1 - read variable G66 P1001 X Y Z F
2
3
4
5
6
7
8

move position G0 X-150. Y35.


call macro program O1001
back to and move G0 X100. Y70.
call macro program O1001
back to and move G0 X-30. Y-140.
call macro program O1001
back to G67 cancelled macro

#1
#2
#3
#4
#5
#6
#7
#8
#9 500.
#10
#11
#12
#13
#14
#15
#16

#17
#18
#19
#20
#21
#22
#23
#24 80.
#25 60.
#26 5.
#27
#28
#29
#30
#31
#32

57

Sample for Macro Body

O1001 ( SUB MACRO )


IF [ #24 * #25 * #9 * #26 NE 0 ] GOTO 10
#3000 = 140 ( DATA ERROR )
N10 #31 = #4003 ( G90,G91 )
G90 G1 Z - [ ABS [ #26 ] ] F#9
G91 G1 X #24
Y #25
X- #24
Y- #25
G90 G0 Z5.
G#31 M99
58

Macro Call with G code


Set parameter

G65 P9011 X10. Y10. Z5.


F500
same
G102 X10. Y10. Z5. F500

O9010 -- #6050
O9011 -- #6051 -- 102
O9012 -- #6052
O9013 -- #6053
O9014 -- #6054
O9015 -- #6055
O9016 -- #6056
O9017 -- #6057
O9018 -- #6058
O9019 -- #6059

59

Macro call with M code


Create O9020 program
and use M6 to call tool
change program
G65 P9021 X10. Y10. M8.
same
M90 X10. Y10. M8.

Set parameter

O9020 -- #6080 -- 6
O9021 -- #6081 -- 90
O9022 -- #6082 -- 91
O9023 -- #6083 -- 60
O9024 -- #6084
O9025 -- #6085
O9026 -- #6086
O9027 -- #6087
O9028 -- #6088
O9029 -- #6089
60

External Output Command


POPEN ( connection to I/O )
BPRNT ( output binary )
DPRNT ( output EIA or ISO codes )
PCLOS ( disconnection from I/O )
Command format
POPEN
DPRNT [ a #b [ c d ] ...]
PCLOS
No of digits below decimal point

No of digits above decimal point


Variable
Character

Refer to Manual
61

Printout Layout
--- MAKINO --CIRCLE NO 12
+X 0.123
+Y 0.213
--- OK ---

-X 0.321
-Y 0.132

When #18 = 12
#120 = 0.123
#121 = 0.123
#122 = 0.213
#123 = 0.132
when #120 LE #1

62

Printout Program

POPEN
DPRNT [ --- MAKINO --- ]
DPRNT [ * ]
DPRNT [ *** CIRCLE *** NO #18 [40]]
DPRNT [ * ]
DPRNT [*** +X * #120[43] *** -X * #121[43]]
DPRNT [*** +Y * #122[43] *** -Y * #123[43]]
DPRNT [ * ]
IF [#120 LE #1 ] GOTO1
DPRNT [ *** -- NOT OK -- *** ]
GOTO2
N1 DPRNT [ *** -- OK -- *** ]
N2 PCLOS

--- MAKINO --CIRCLE NO 12


+X 0.123
+Y 0.213

-X 0.321
-Y 0.132

--- OK ---

When #18 = 12
#120 = 0.123
#121 = 0.123
#122 = 0.213
#123 = 0.132
when #120 LE #1

63

Create M90 for Tool Approach


O9021 ( M90 TOOL APPROACH )
( M90 X Y Z M )
M9
G91 G0 G28 Z0 M5
G49
IF [#26 NE #0] GOTO 10
#26 = 100. ( Z )
N10 IF [#24 NE #0] GOTO 11
#24 = 0 ( X )
N11 IF [#25 NE #0]GOTO 12
#25 = 0 ( Y )

N12 IF [#13 NE #0] GOTO13


#13 = 8 ( M )
N13
G90 G0 G#4014 X#24 Y#25
G43 H#4111 Z#26 M1
M3
M#13
G98 M99

64

Create M91 for Tool Home


O9022 ( M91 TOOL HOME #6082 )
G80 G40 M5
G91 G0 G28 Z0 M9
G49
G90 G0 G53 X-320.0 Y0
M99

65

Create M6 for Tool Change


O9020 ( M6 TOOL CHANGE #6080 )
G80 G40 M5
G91 G0 G28 Z0 M9
G49 G90
M464 ( read spindle tool number )
G04 P1
IF [ #1032 EQ #4120 ] GOTO99
T#4120
G90 G0 G53 X-600.0 Y0 M1
M6
N99 M99
66

Program Layout
O1000 ( Main Program )
T1 M6
G54 H1 S1000 T2 ( CEN DR )
M90
G81 Z-1.5 R2. F100 L0 K0
M98 P1001

T3 M6
G54 H3 S500 T1 ( TAP M6 )
M90
M135 S500 ( Rigid Tap )
G84 Z-8. R7. F500 L0 K0
M98 P1001

T2 M6
G54 H2 S1500 T3 ( DR 5 )
M90
G83 Z-15. R2. Q1.5 F100 L0 K0
M98 P1001

M91
M30

Q = Dia * 0.3 or 0.15

O1001 ( Sub-Program )
X50. Y50.
X-50. Y-50.
M99
67

Learning Activity ( 1 )

#111 = #5021 ( X2 )
M00

Y4

X1

M30

X2

Touch sensor

O1000 ( MANUAL SET WCS )


#110 = #5021 ( X1 )
M00

G54
Y3

68

Answer ( 1 )
O1000 ( MANUAL SET WCS )
#110 = #5021 ( X1 )
M00
#111 = #5021 ( X2 )
M00
#112 = #5022 ( Y3 )
M00
#113 = #5022 ( Y4 )
#5221 = [ #110 + #111 ] / 2
#5222 = [ #112 + #113 ] / 2
M30

Y4

X1

X2

G54
Y3

If G54 change to G55 or G59


How to mark the program better

69

Answer ( 1.1 )
O1000 ( MANUAL SET WCS )
#100 = 55. ( WCS )

#4 = 5221. ( M/C X )
#5 = 5222. ( M/C Y )

#110 = #5021 ( X1 )

#8 = 20.

M00

#10 = #100 - 54.

#111 = #5021 ( X2 )

#[ #4 + #8 * #10 ] = [#110+#112] / 2

M00

#[ #5 + #8 * #10 ] = [#112+#113] / 2

#112 = #5022 ( Y3 )

G91 G0 Z100.

M00
#113 = #5022 ( Y4 )

G90 G#100 X0 Y0
M30
70

DIAGRAM - II
Repeat Depth Cycle
G65 P7000 T B S - Q R

R Point

T ( #2O ) = Top
B ( #2 ) = Bottom
S ( #19 ) = Sub-Program

Profile
B

Q ( #17 ) = Depth Of Cut


R ( #18 ) = R Point

Sub-Program
71

Program Layout
O1000 ( MAIN PROGRAM )
T1 M6
G54 H1 S1000 ( END 10 )
M90
#2032 = 5.5
G65 P7000 T0 B-8.2 S1001. Q2.
T2 M6
G54 H2 S1500 ( END 8 )
M90
#2032 = 4.
G65 P7000 T0 B-8.2 S1001.
M91
M30

O1001 ( SUB-PROGRAM )
G0 X40. Y-40.
Z#33
G1 G41 Y-25. D32 F1000
X-25.
Y 25.
X 25.
Y -40.
G1 G40 X40. Y-40.
M99

72

Macro Program ( Repeat Cycle )


O7004 ( REPEAT CYCLE )
( G65 P7000 T B S -- Q R )
#27 = #4003 ( G90, G91 )
#26 = ABS [#26] ( Z )
IF [ #19 NE #0 ] GOTO 10
#3000 = 10 ( S MISSING )
N10
IF [ #17 NE #0 ] GOTO 11
#17 = 1000. ( Q )
N11 #33 = #20 ( T )

DO1
#33 = #33 - ABS[#17]
IF [ #33 GT #2 ] GOTO 21
#33 = #2
N21 M98 P#19
IF [ #33 EQ #2 ] GOTO 98
END1
N98 IF [ #18 NE #0 ] GOTO 99
#18 = 50. ( R )
N99 G90 G0 Z [ ABS [ #18 ] ]
G#27 M99

73

Learning Activity ( 2 )
O800 ( MAIN PROGRAM )
G54 H1 S2000 F140
M90
G66 P805 T10. Z10. D5. R2.
A2000. B140. I1400. J98.
X10. Y-10.
X-10. Y10.
G67
M91
M30
O805 ( STEP DRILL CYCLE )

I = RPM
J = Feed rate

2
Z0

R point

A = RPM
B = Feed rate

M99
74

Answer 2
O805 ( DRILL DEPTH CYCLE )
IF [#1*#2*#4*#5*#7*#18*#20*#26 NE 0 ] GOTO111
#3000 = 140 ( DATA ERROR )
N111 #33 = #4003
G90 G0 Z#18 S#1 M3
I = RPM
J = Feed rate
G1 Z-[ #26+#20+1 ] F#2
1
S#4
T
G1 Z-[ #26+#20+#7 ] F#5
2
G0 Z#18
R point
Z0
3
G#33 M99
D
Z

A = #1,, B = #2,, I = #4,, J = #5


D = #7,,R = #18,, T = #20,,Z = #26

A = RPM
B = Feed rate
75

Learning Activity ( 3 )
O1000 ( MAIN PROGRAM )
T1 M6
G54 H1 S2000 F140
M90
G65 P8001 U54. V56. S1001.
G65 P8001 U57. V59. S1001. K21.

U = Start WCS
V = End WCS
S = Sub Program
K = Mirror 21 or 22
Z = Refer Point 100.

M91
M30

76

Change Parameter
#7

#3202
#3104.6 = 1 ( DAL )
#3202.0 = 0 ( NE8 )
#3202.4 = 1 ( NE9 )
#3402.6 = 1 ( CLR )
#3406.3 = 1 ( C03 )
#3407.6 = 1 ( C14 )
#3409.7 = 1 ( CFH )
#6001.6 = 1 ( CCV )
#6080 = 6
#6081 = 90
#6082 = 91
#6083 = 60

#6

#5

#4

PSR

NE9

#3

#2

#1

#0

NE8

( *soft key )
MDI
OFFSET SETTING
* SETTING
PARAMETER WRITE = 1
INPUT ( display alarm 100 )
SYSTEM
* PARA
Key in 3202
* NO SCH ( change if necessary NE9 )
OFFSET SETTING
* SETTING
PARAMETER WRITE = 0
INPUT
RESET (alarm clear)
78

You might also like