6 Subprograms and Program Section Repeats
d
6.1 Subprograms
Example for exercise: Group of four holes at three different locations
The hales are drilfed
with cycle 1 PECKING,
You, enter the Wal hole depth, setup clearance,
drilling feed rate etc. once in the cycle.
Yau can then call the cycle w&h the
miscellaneous function M99 (see page E&6)+
Coordinates of the first hole in each group:
Group @ X = 15mm Y = IOmm
Group @
X =45mm Y =60mm
Group @
X =75mm Y = IOmm
Spacing of holes:
IX = 20 mm IY = 20 mm
Total hole depth (DEPTH): Z = IOmm
Hole diameter: 0 = 5mm
Part program
0 BEGIN PGM 360064 MM
1 BLK FORM 0.1 Z X+0 Y+O Z-20
2 BLK FORM 0.2 X+1 00 Y+lOO Z+O
3
TOOL DEF 1 L+O R+2.5
4 TOOL CALL 1 Z SIOOO
5
CYCL DEF 1 .O PECKING
6 CYCL DEF 1.1 SETUP2
7 CYCL DEF 1.2 DEPTH -10
8 CYCL DEF 1.3 PECKGIO
Cycle definition PECKING (see page 8-6)
9 CYCL DEF 1.4 DWELL 0
IO CYCL DEF 1.5 FIOO
11 LZ+lOO FMAX
12 L X+15 Y+lO RO FMAX M6 . . . . . . . . . ..__............... Move to hole group 1, insert tool
13 L Z+2 FMAX M3 . . . . . . . . . . . . . ..____._.__.................. Pre-position in the infeed axis
14 CALL LBL 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Subprogram call (with block 14 the subprogram is executed
once)
15 L X+45 Y+60 FMAX . . . . . . .._.__....................._._.. Move to hole group 2
16 CALL LBL 1 . . . ..__._............................................... Subprogram call
17 L X+75 Y+lO FMAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Move to hole group 3
18 CALL LBL 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Subprogram call
19 L Z+l 00 FMAX M2 . . .._...________........................... Retract tool; return to program (M2):
The subprogram is entered after M2
20 LBL 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Beginning of subprogram
21 L M99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Execute pecking cycle for first hole in group
22 L IX+20 FMAX M99 . . . . . . . . . . . . .._....................... Move to position for second hole and drill
23 L IY+20 FMAX M99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Move to position for third hole and drill
24 L IX-20 FMAX M99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Move to position for fourth hole and drill
25 LBL 0 . . . . . . ..__........................................................ End of subprogram
26 END PGM 360064 MM
4
6-4 TNC 370
4