39
96-5047 rev L June 2005
This is the same program (Example #5) using subroutines.
STEP
STEP SIZE
FEED RATE
LOOP COUNT
G CODE
01
0
LOC [4]
[3]
[96]
02
0
080.000
1
[88]
03
0
080.000
1
[95]
04
[90.00]
080.000
1
[91]
05
[15.00]
[25.000]
1
[91]
06
0
080.000
1
[99]
Explanation:
Step #1 tells the control to jump to Step #4. The control will do steps #4 and #5 three times, with Step #6
marking the end of the subroutine. After finishing the subroutine, the control jumps back to the step following
the “G 96” call (in this case, Step #2). Since Step #3 is not part of a subroutine, it marks the end of the pro-
gram and will return the control to Step #1.
Using subroutines in Example #5 saves only two lines of programs. However, if you wanted to repeat the
pattern eight times, you would save twelve program lines. In the subroutine example, only the loop count in
Step #1 would be changed to increase the number of times you wish to repeat the pattern.
As an aid in programming subroutines, think of the subroutine as a separate program and write it on a piece of
paper. Program the control using “G96” when you want to invoke the previously written subroutine. When
finished, end the program with an End 95 code. Now enter your subroutine and note the step it begins with.
Enter that step in the LOC register of the “G96” call.
Example #6
We want to index 15, 20, 25, 30 degrees in sequence four times and then drill a five-hole bolt pattern.
STEP
STEP SIZE
FEED RATE
LOOP COUNT
G CODE
01
0
Loc [4]
[4]
[96]
02
0
080.000
[5]
[98]
03
0
080.000
1
[95]
(main program above———subroutine below)
04
[15.000]
080.000
1
[91]
05
[20.000]
080.000
1
[91]
06
[25.000]
080.000
1
[91]
07
[30.000]
080.000
1
[91]
08
0
080.000
1
[99]
Содержание HRT 160
Страница 9: ...8 96 5047 rev L June 2005 HRT210SHS MACHINE DIMENSIONS ...
Страница 55: ...54 96 5047 rev L June 2005 9 HRT ASSEMBLY DRAWINGS ...
Страница 58: ...57 96 5047 rev L June 2005 ...
Страница 59: ...58 96 5047 rev L June 2005 ...
Страница 61: ...60 96 5047 rev L June 2005 ...
Страница 62: ...61 96 5047 rev L June 2005 ...
Страница 63: ...62 96 5047 rev L June 2005 ...
Страница 64: ...63 96 5047 rev L June 2005 ...