
#100=0.5 (End mill size variable)
#110=0.05 (Stepover)
#111=1.5 (Slot width)
#101= [#111/2]-[#100/2] (No 5 Y position calculation)
#102=[-[#100/2]+#110] (No 3 X position calculation)
#103=0.1*#100 (Enter and Exit radius)
G00 X[#102-#103-0.1] Y-#101 (Position 1)
Z.1
G01 Z-1.5
WHILE [[#102-#103] LE 3] DO1
G01 X[#102-#103] (Position 2)
G03 X#102 Y[-#101+#103] R#103 (Position 3)
G01 Y[#101-#103] (Position 4)
G03 X[#102-#103] Y#101 R#103 (Position 5)
G00 Y-#101 (Back to Position 2)
#102=#102+#110 (Stepover)
END1
G65 allows us to call a macro subprogram and pass it variables. So far we’ve only used macro commands within a program and changed variables accordingly. Using the G65 call allows us to pass values to a stand alone macro program which makes the program on the screen clear and concise. G65 follows the following format:
G65 P9000 S0.05 D0.5 W1.5
Here G65 is calling macro subprogram O9000 and passing it arguments S, D, and W. The program number is really just another program with O9000 as the number. The G65 call differs from M98 sub program call because of the ability to pass the subprogram new information in the form of arguments which are S0.05, D0.5, and W1.5 in our example. You’ll notice the arguments are letters in the G65 call but all the variables we’ve used in calculations so far are numbers. When the G65 program calls O9000 the letters S, D, and W are converted to numbers according to the following chart:
Again, when using our example macro call: G65 P9000 S0.05 D0.5 W1.5, the variables #19 (the letter S), #7 (the letter D) and #23 (letter W), are populated in the control memory and read by our macro subprogram O9000. So when we use the variables, #19, #7, and #23 in the 09000 program they will already have the values of 0.05, 0.5, and 1.5 , respectively if called by G65.
So now let’s rewrite the macro above to be able to use the variables for stepover (letter S and #19), end mill size (letter D and #7) and slot size (letter W and #23). We’ll be making the following substitutions to allow G65 usage:
#100 substituted with #7 (End mill size)
#110 substituted with #19 (Stepover)
#111 substituted with #23 (Slot width)
We’ll also be taking out the first three lines which used to define what the end mill size, stepover, and slot width and since the G65 call is defining them.