Understanding Argument Assignment Number Two
With custom macro B there are two different forms of argument assignment for the G65 command to call a custom macro. By far, the more popular is argument assignment number one.
Founder and President, CNC Concepts Inc.
With custom macro B there are two different forms of argument assignment for the G65 command to call a custom macro. By far, the more popular is argument assignment number one. Here are most of the local variable representations in with argument assignment number one:
A: #1, B: #2, C: #3, D: #7, E: #8, F: #9, H: #11, I: #4, J: #5, K: #6, M: #13, Q: #17, R: #18, S: #19, T: #20, U: #21, V: #22, W: #23, X: #24, Y: #25, Z: #26
While the local variable number selection may not make complete sense, these local variables are used in the custom macro to represent their corresponding letter addresses when argument assignment number one is used.
Now, here are the local variable representations when argument assignment number two is used:
A: #1, B: #2, C: #3, I: #4, J: #5, K: #6, I: #7, J: #8, K: #9, I: #10, J: #11, K: #12, I: #13, J: #14, K: #15, I: #16, J: #17, K: #18, I: #19, J: #20, K: #21, I: #22, J: #23, K: #23, I: #25, J: #26, K: #27, I: #28, J: #29, K: #30, I: #31, J: #32, K: #33
Notice that the letter addresses A, B, and C are followed by ten sets of I, J, and K. A, B, and C work just as they do in argument assignment number one, but I, J, and K are a little different. Think of the first set of I, J, and K as I(1), J(1), and K(1). Think of the second set as I(2), J(2), and K(2) – and so on through I(10), J(10), and K(10). Again, you’ll have up to ten sets of I, J, and K with which to work.
The first I in the G65 command will be represented by local variable #4; the first J by #5; the first K by #6. The second I in the G65 command will be represented by #7; the second J by #8, and the second K by #9. The tenth I in the G65 command (if there are ten) will be represented by #31, the tenth J by #32, and the tenth K by #33. Here’s an example call statement using argument assignment number two:
N010 G65 P1002 A1.75 B-0.6 C1.0 I12.0 J1.75 I35.0 J1.625 I175.0 J1.1 I25.0 J1.75 I113.0 J1.75
K is not being used in this example. Here is how the local variables will be assigned:
#1: 1.75, #2: -0.6, #3: 1.0, #4: 12.0 #5: 1.75, #7: 35.0, #8: 1.625, #10: 175.0, #11: 1.1, #13: 25.0, #14: 1.75, #16: 113.0, #17: 1.75
You may be wondering why argument assignment number two is so important. This method of argument assignment is helpful—and possibly the only way to handle the application—when you want to pass groups of information to the custom macro. Up to ten groups (ten sets of I, J, and K) containing three pieces of information each (again, I, J, and K values).
One potential application might be a tool life management system. Up to ten groups of tools could be specified in the G65 command, containing three pieces of information per group (possibly tool type, tool life in number of parts, and how many replacement tools are in the group).
The drawing below is for a circular cam—it’s actually the previously shown example.
As you can see, we’re using I and J (K is not needed) to specify the rises and falls around the cam. I specifies the angular length of the current rise or fall and K specifies its ending radius. Letter address A specifies the starting radius, B the depth to mill, and C the incremental angle for calculations (C1.0 will cause each movement around the cam to be 1.0 degree).
Here is the calling (main) program:
O2001 (Main program for cam)
N005 G54 (Set program zero)
N010 G65 P1002 A1.75 B-0.6 C1.0 I12.0 J1.75 I35.0 J1.625 I175.0 J1.1 I25.0 J1.75 I113.0 J1.75 (Mill entire cam)
N015 M30 (End of program)
Again, this kind of argument assignment makes it very easy to specify groups of data to your custom macro. With our cam example, a cam with up to ten rises and falls can be easily defined and machined.
There is not enough room to provide the entire cam custom macro program here. If you would like to see full program, visit http://www.cncci.com/resources/tips/arg2.htm.