Vous êtes sur la page 1sur 71

Macro “ B ” Programming

Makino Asia Pte Ltd


Application Department

1
Description
This course is designed to enable the programmer
to use the control’s 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

3
V * 318 V * 1000
Spee = or
Dia 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

Chip Thickness depend on


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

Depth of cut

Chip Thickness

5
Feed Per Tooth
&
Feed Per Revolution

6
Calculation of Speed & Feed
If Ball nose = 10 mm ( 2 teeth )
Cutting speed = 200 m/min ( V )
Feed per tooth = 0.1 mm ( Sz )
Answer is
Speed = 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

I ma ge
No M 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
Answer
#1 = 123.
#2 = #1 123.

#3 = #2 + 10 133.

G01 X10. F#3 F133.


#4 = 123.4567
G00 X#4 123.457
G04 P#4 123. sec

G04 X#4 123.457 sec


G#3 133. alarm occur

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
#1 = #2 + 10. #1 = #2 + #3
#1 = #2 - 10. #1 = #2 - #3
#1 = #2 * 10. #1 = #2 * #3
#1 = #2 / 10. #1 = #2 / #3
#1 = SIN [ 90 ] #1 = SIN [ #2 ]
#1 = COS [ 90 ] #1 = COS [ #2 ]
#1 = TAN [ 90 ] #1 = TAN [ #2 ]
#1 = ATAN [ 1 ] / [ 1 ] #1 = ATAN [ #1 ] / [ #2 ]

12
Differ Control For ATAN
( unit = degree )

#i = ATAN [b] / [a]


Y

#1 = ATAN [1] / [1] 45. ( 0M-15M )


#2 #1
b
225. ( 0M )
#2 = ATAN [-1] / [-1] -135. ( 15M )
X
a

#2 = ATAN [-1] / [1] 315. ( 0M )


-45. ( 15M )

#2 = ATAN [1] / [-1] 135. ( 0M-15M )

13
Arithmetic Operation Commands II
Answer
If
#1 = SQRT [ #2 ] #2 = 2 #1 = 1.4142

#1 = ABS [ #2 ] #2 = -1.23 #1 = 1.23

#1 = ROUND [#2] #2 = 1.234 #1 = 1.0


#2 = 1.5436 #1 = 2.0

#1 = FIX [#2] #2 = 1.234 #1 = 1.0


#2 = -1.634 #1 = - 1.0

#1 = FUP [#2] #2 = 1.234 #1 = 2.0


#2 = -1.634 #1 = - 2.0
14
Case function of “ROUND”

If #1 = 12.3456 Case
#10 = 12.3758 Answer

X[ ROUND[#1] ] #12 = 5.1236


or G91 G00 X#10 = 12.376
X#1 X#12 = 5.124
Answer is X[ #10 + #12 ] = 17.499
Axis move X12.346

12.3758 + 5.1236 = 17.4994

15
Example function of “ROUND”
Example
#10 = 12.3758
Answer
#12 = 5.1236
X-[ ROUND[#10] + ROUND[#12] ] X -17.50
or
#10 = ROUND [ #10 * 1000 ] / 1000
#12 = ROUND [ #12 * 1000 ] / 1000
X-[ #10 + #12 ] X -17.50

16
Learning Activity
If #100 = 11. #101 = 25.
#102 = -1.2345 #103 = 2.3456 Answer
#104 = ABS [#102] = 1.2345
#105 = ROUND [#103] = 2.0
#106 = FIX [#102] = - 1.0
#107 = FUP [#102] = - 2.0
#108 = #100 + #101 = 36.0
#109 = #101 - #102 = 26.2345
G91 G00 X#102 move X-1.234
X#103 move X 2.346
X- [#102 + #103] move X-1.111

17
Empty Variable “ #0 “
“ #0 ” mean Empty or Vacant
“0” is a Value
Example :-
#100 = #0
Answer
#102 = 0
G90 G1 X#100 F500 Axis no move
G90 G1 X#102 F500 Axis move X0

18
Repeat Function ( IF )
Condition
IF / GOTO Statement EQ NE GT
GE LT LE

N1 IF [ #1 GT #2 ] GOTO 2
Not OK
#1 = #1 + 1
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 10 ] GOTO 2

Answer
Process
GT
what happen
GE
#1 = #1 + 1
GOTO 1
N2 M30

22
Exercises 2 ( WHILE condition )
#1 = 0
WHILE [ #1 10 ] DO 2

Answer Process
LT

#1 = #1 + 1
END 2
M30

23
Exercises 3 ( Clear by IF )
%
O100 ( IF ) #100 = #0
#1 = 100. ( START ) #101 = #0
#102 = #0
#2 = 110. ( END )
#103 = #0
N3 IF [ #1 GT #2 ] GOTO 7 #104 = #0
# [ #1 ] = #0 #105 = #0
#1 = #1 +1 #106 = #0
GOTO 3 #107 = #0
#108 = #0
N7 M30
#109 = #0
% #110 = #0

24
Exercises 4 ( Clear by WHILE )
%
O100 ( WHILE ) #100 = #0
#1 = 100. ( START ) #101 = #0
#102 = #0
#2 = 110. ( END )
#103 = #0
WHILE [ #1 LE #2 ] DO1 #104 = #0
# [ #1 ] = #0 #105 = #0
#1 = #1 +1 #106 = #0
END1 #107 = #0
#108 = #0
M30
#109 = #0
% #110 = #0

25
Exercises 5 ( Rewrite Tool Pot )
O100 ( REWRITE TOOL POT NUMBER )
/ M57 ( TOOL NUMBER WRITR)
/ T00 ( CLEARING TOOL NUMBER ) Pot 1 = T1
/ M30 Pot 2 = T2
Pot 3 = T3
M57 Pot 4 = T4
#1 = 1 .
WHILE [ #1 LT 60 ] DO1 .
.
T#1
.
#1 = #1 + 1 .
END1 Pot 60 = T60
M30
26
Exercises 6
#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 )
Using WHILE condition and ROUND + SQRT command

27
Exercises 6 ( ROUND + SQRT )
#101 = 1.000 (1)
O100 ( SQRT ) #102 = 1.414 (2)
#103 = 1.732 (3)
#1 = 101. ( START ) #104 = 2.000 (4)
#105 = 2.236 (5)
#2 = 110. ( END ) #106 = 2.449 (6)
#107 = 2.646 (7)
#3 = 1. ( SQRT [ #3 ] ) #108 = 2.828 (8)
#109 = 3.000 (9)
WHILE [ #1 LE #2 ] DO1 #110 = 3.162 (10)

# [ #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
Illustration ( Positioning cycle )
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

30
#5 = [#21* #30] * SIN [#1] + #25

#
G90 X#4 Y#5 #5 ( Y )

*
21
#30 = #30 +1

#
#1
END1
M99 #4 ( X )
30
Exercise 8 ( Drill Depth Cycle )
O800 ( MAIN PROGRAM )
G90 G0 G54 X0 Y0 R point
G43 H1 Z50. S1200 M3
Z0
G0 X10. Y-10.
M98 P803
G91 G0 G28 Z0
M30 Q

O803 ( DRILL DEPTH CYCLE )


d

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 )
R point
#17 = 1.5 ( Q = Depth Of Cut )
#33=0 ( Set ) Z0
G90 G0 Z#18
DO1
#33 = #33 + ABS[#17] Q
IF [ #33 LT ABS[#26] ] GOTO 11
#33 = ABS[#26]
N11 G90 G1 Z-#33 F#9 d
G0 Z#18
IF [ #33 EQ #26 ] GOTO99
G0 Z [ 1-#33 ] Depth Z
END1
N99 M99
32
Type System Variable
Tool Compensation #2001 ~ #2200
Work Offset #5201 ~ #5328
Macro Alarm #3000
Clock Information #3001, #3002
Auto operation control #3003, #3004
Model Information #4000 ~ #4120
Position Information #5001 ~ #5065

33
Tool Offset ( Type A )
Offset Variable No > 200
1 #2001 - #10001
2 #2002 - #10002

99 #2099 - #10099
200 #2200 - #10200

If Tool Number > 200 Use #10000 + offset no

34
Example Tool Offset ( A )

Offset Page
Use “ D “ Offset H16
G90 G10 P31 R10. H17

same
H31 10.0
#2032 = 5.2
H32 5.2

35
Tool Offset ( Type C )
Offset H D
Geometry Wear Geometry Wear
1 #2001 #2201 #2401 #2601
2 #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
#5222 = - 452.032 ( Y ) Y 0.000
#5223 = - 450.123 ( Z ) Z 0.000
P1 X - 230.000
P1=G54, P2=G55, P3=G56 Y - 452.032
P4=G57, P5=G58, P6=G59 Z - 450.123

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

#5001~ ABSIO Work coord. Possible

#5006 End block pos System


#5021~ ABSMT Machine coord. Impossible
#5026 Current pos System
#5041~ ABSOT Work coord. Impossible

#5046 Current pos System


#5061~ Skip Signal Work coord. Possible

#5066 G31 System


Refer to Manual
41
Example Machine Position

G54 Machine Position


Machine Position
#5221 = #5021 ( X ) X - 230.000
#5222 = #5022 ( Y ) Y - 452.032
#5223 = #5023 ( Z ) 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 #3001 1 msec. ( unit )
Clock 2 #3002 1 hour ( unit )

Example 1 Example 2
G65 P9010 T20. O1000
#3002 = 0 ( initial )
O9010 G0 X10. Y10.
#3001 = 0 ( initial ) G1 X100 F500
#20 = #20 * 1000
WHILE [ #3001 LE #20 ] DO1
END1 #100 = #3002 * 60 ( min )
M99 M99

44
Date / Time #3011~#3012
#3011 Year / Month / Day
#3012 Hour / Minute / Second

Example
Date : 1987.5.20
#3011 = 19870520
Time : 4 : 17 : 05 PM
#3012 = 161705

45
Parts Counting #3901~#3902
#3901 Total number of parts
#3902 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 Single block Function
0 Not suppressed Awaited
1 Suppressed Awaited
2 Not suppressed Not Awaited
3 Suppressed 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. X-150. Y35.
G0 X-30. Y-140. 60
5
G67
G91 G0 G28 Z0
80
M30

56
Sequence of G66, G67
G66 P1001 X80. Y60. Z5. F500 #1 #17
#2 #18
G0 X-150. Y35.
#3 #19
G0 X100. Y70. #4 #20
G0 X-30. Y-140. #5 #21
#6 #22
G67 #7 #23
#8 #24 80.
1 - read variable G66 P1001 X Y Z F #9 500. #25 60.
2 - move position G0 X-150. Y35. #10 #26 5.
#11 #27
3 - call macro program O1001 #12 #28
4 - back to and move G0 X100. Y70. #13 #29
#14 #30
5 - call macro program O1001
#15 #31
6 - back to and move G0 X-30. Y-140. #16 #32
7 - call macro program O1001
8 - back to G67 cancelled macro

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
O9010 -- #6050
☯ G65 P9011 X10. Y10. Z5.
O9011 -- #6051 -- 102
F500 O9012 -- #6052
same O9013 -- #6053
O9014 -- #6054
☯ G102 X10. Y10. Z5. F500 O9015 -- #6055
O9016 -- #6056
O9017 -- #6057
O9018 -- #6058
O9019 -- #6059

59
Macro call with “M” code
Set parameter
Create O9020 program O9020 -- #6080 -- 6
and use M6 to call tool O9021 -- #6081 -- 90
O9022 -- #6082 -- 91
change program O9023 -- #6083 -- 60
O9024 -- #6084
☯ G65 P9021 X10. Y10. M8. O9025 -- #6085
O9026 -- #6086
same
O9027 -- #6087
O9028 -- #6088
☯ M90 X10. Y10. M8.
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 ---


When #18 = 12
CIRCLE NO 12
#120 = 0.123
#121 = 0.123
+X 0.123 -X 0.321 #122 = 0.213
+Y 0.213 -Y 0.132 #123 = 0.132

when #120 LE #1
--- OK ---

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. X-150. Y35.
G0 X-30. Y-140. 60
5
G67
G91 G0 G28 Z0
80
M30

56
Sequence of G66, G67
G66 P1001 X80. Y60. Z5. F500 #1 #17
#2 #18
G0 X-150. Y35.
#3 #19
G0 X100. Y70. #4 #20
G0 X-30. Y-140. #5 #21
#6 #22
G67 #7 #23
#8 #24 80.
1 - read variable G66 P1001 X Y Z F #9 500. #25 60.
2 - move position G0 X-150. Y35. #10 #26 5.
#11 #27
3 - call macro program O1001 #12 #28
4 - back to and move G0 X100. Y70. #13 #29
#14 #30
5 - call macro program O1001
#15 #31
6 - back to and move G0 X-30. Y-140. #16 #32
7 - call macro program O1001
8 - back to G67 cancelled macro

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
O9010 -- #6050
☯ G65 P9011 X10. Y10. Z5.
O9011 -- #6051 -- 102
F500 O9012 -- #6052
same O9013 -- #6053
O9014 -- #6054
☯ G102 X10. Y10. Z5. F500 O9015 -- #6055
O9016 -- #6056
O9017 -- #6057
O9018 -- #6058
O9019 -- #6059

59
Macro call with “M” code
Set parameter
Create O9020 program O9020 -- #6080 -- 6
and use M6 to call tool O9021 -- #6081 -- 90
O9022 -- #6082 -- 91
change program O9023 -- #6083 -- 60
O9024 -- #6084
☯ G65 P9021 X10. Y10. M8. O9025 -- #6085
O9026 -- #6086
same
O9027 -- #6087
O9028 -- #6088
☯ M90 X10. Y10. M8.
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 ---


When #18 = 12
CIRCLE NO 12
#120 = 0.123
#121 = 0.123
+X 0.123 -X 0.321 #122 = 0.213
+Y 0.213 -Y 0.132 #123 = 0.132

when #120 LE #1
--- OK ---

62
Printout Program
POPEN --- MAKINO ---
DPRNT [ --- MAKINO --- ] CIRCLE NO 12
DPRNT [ * ]
+X 0.123 -X 0.321
DPRNT [ *** CIRCLE *** NO #18 [40]] +Y 0.213 -Y 0.132

DPRNT [ * ] --- OK ---

DPRNT [*** +X * #120[43] *** -X * #121[43]]


DPRNT [*** +Y * #122[43] *** -Y * #123[43]] When #18 = 12

DPRNT [ * ] #120 = 0.123


#121 = 0.123
IF [#120 LE #1 ] GOTO1 #122 = 0.213
#123 = 0.132
DPRNT [ *** -- NOT OK -- *** ]
GOTO2 when #120 LE #1

N1 DPRNT [ *** -- OK -- *** ]


N2 PCLOS
63
Create M90 for Tool Approach
O9021 ( M90 TOOL APPROACH )
( M90 X Y Z M ) N12 IF [#13 NE #0] GOTO13
M9 #13 = 8 ( M )
G91 G0 G28 Z0 M5 N13
G49 G90 G0 G#4014 X#24 Y#25
IF [#26 NE #0] GOTO 10 G43 H#4111 Z#26 M1
#26 = 100. ( Z ) M3
N10 IF [#24 NE #0] GOTO 11 M#13
#24 = 0 ( X ) G98 M99
N11 IF [#25 NE #0]GOTO 12
#25 = 0 ( Y )

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 ) T3 M6
T1 M6 G54 H3 S500 T1 ( TAP M6 )
G54 H1 S1000 T2 ( CEN DR ) M90
M90 M135 S500 ( Rigid Tap )
G81 Z-1.5 R2. F100 L0 K0 G84 Z-8. R7. F500 L0 K0
M98 P1001 M98 P1001

T2 M6 M91
G54 H2 S1500 T3 ( DR 5 ) M30
M90
G83 Z-15. R2. Q1.5 F100 L0 K0 O1001 ( Sub-Program )
M98 P1001 X50. Y50.
X-50. Y-50.
Q = Dia * 0.3 or 0.15
M99
67
Learning Activity ( 1 )
O1000 ( MANUAL SET WCS )
#110 = #5021 ( X1 )
M00
#111 = #5021 ( X2 )

Touch sensor
M00 Y4

X1 X2

M30 G54

Y3

68
Answer ( 1 )
O1000 ( MANUAL SET WCS )
#110 = #5021 ( X1 )
M00 Y4
#111 = #5021 ( X2 )
M00
X1 X2
#112 = #5022 ( Y3 )
M00 G54
#113 = #5022 ( Y4 )
#5221 = [ #110 + #111 ] / 2
Y3
#5222 = [ #112 + #113 ] / 2
M30
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
G90 G#100 X0 Y0
#113 = #5022 ( Y4 )
M30

70
DIAGRAM - II

Repeat Depth Cycle


G65 P7000 T B S - Q R
R Point
T ( #2O ) = Top T
B ( #2 ) = Bottom
Q
S ( #19 ) = Sub-Program Profile
B
Q ( #17 ) = Depth Of Cut
R ( #18 ) = R Point
Sub-Program

71
Program Layout
O1000 ( MAIN PROGRAM ) O1001 ( SUB-PROGRAM )
T1 M6 G0 X40. Y-40.
G54 H1 S1000 ( END 10 ) Z#33
M90 G1 G41 Y-25. D32 F1000
#2032 = 5.5 X-25.
G65 P7000 T0 B-8.2 S1001. Q2. Y 25.
X 25.
T2 M6 Y -40.
G54 H2 S1500 ( END 8 ) G1 G40 X40. Y-40.
M90 M99
#2032 = 4.
G65 P7000 T0 B-8.2 S1001.
M91
M30

72
Macro Program ( Repeat Cycle )
O7004 ( REPEAT CYCLE ) DO1
( G65 P7000 T B S -- Q R ) #33 = #33 - ABS[#17]
#27 = #4003 ( G90, G91 ) IF [ #33 GT #2 ] GOTO 21
#26 = ABS [#26] ( Z ) #33 = #2
IF [ #19 NE #0 ] GOTO 10 N21 M98 P#19
#3000 = 10 ( S MISSING ) IF [ #33 EQ #2 ] GOTO 98
N10 END1
IF [ #17 NE #0 ] GOTO 11 N98 IF [ #18 NE #0 ] GOTO 99
#17 = 1000. ( Q ) #18 = 50. ( R )
N11 #33 = #20 ( T ) 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. I = RPM
A2000. B140. I1400. J98. J = Feed rate
1
X10. Y-10. T
X-10. Y10.
2
G67
M91 Z0 R point 3 D
Z
M30

O805 ( STEP DRILL CYCLE ) 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
G1 Z-[ #26+#20+1 ] F#2 J = Feed rate
S#4
1
T
G1 Z-[ #26+#20+#7 ] F#5
G0 Z#18 2
G#33 M99 Z0 R point 3 D
Z

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


D = #7,,R = #18,, T = #20,,Z = #26 B = Feed rate

75
Learning Activity ( 3 )
O1000 ( MAIN PROGRAM )
T1 M6 U = Start WCS
G54 H1 S2000 F140 V = End WCS
M90 S = Sub Program
G65 P8001 U54. V56. S1001. K = Mirror 21 or 22
G65 P8001 U57. V59. S1001. K21. Z = Refer Point 100.

M91
M30

76
Change Parameter
#7 #6 #5 #4 #3 #2 #1 #0
#3202 PSR NE9 NE8
1 1

MDI ( *soft key )


#3104.6 = 1 ( DAL )
#3202.0 = 0 ( NE8 ) OFFSET SETTING
#3202.4 = 1 ( NE9 ) * SETTING
#3402.6 = 1 ( CLR ) PARAMETER WRITE = 1
#3406.3 = 1 ( C03 ) INPUT ( display alarm 100 )
#3407.6 = 1 ( C14 ) SYSTEM
#3409.7 = 1 ( CFH ) * PARA
#6001.6 = 1 ( CCV ) Key in 3202
#6080 = 6 * NO SCH ( change if necessary NE9 )
#6081 = 90 OFFSET SETTING
#6082 = 91 * SETTING
#6083 = 60 PARAMETER WRITE = 0
INPUT
RESET (alarm clear)
78