What's new
What's new

Fanuc user defined G-code in Group 9?

adamm

Cast Iron
Joined
Sep 19, 2008
Location
Kingston, ON
I've discovered Macro programming on a Fanuc 6MB. I have some macros written that I want to be able to call like the Group 9 G-codes. They are basically custom drilling cycles, and I would like to be able to have them repeat by just specifying new X and Y positions like, for example, G83.

G83 X1. Y2. R.1 Z-1.;
X2.;
X3. Y1.;
G80;

Can that be done with a custom macro that is (for example) G70 that is in program 9013? (This is a mill, and G70 isn't currently used)

G70 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G80;

Instead of
G70 X1. Y2. I1.5 J.625;
G70 X10. Y2. I1.5 J.625;
G70 X12. Y-2. I1.5 J.625;

Thanks,

Adam
 
I've discovered Macro programming on a Fanuc 6MB. I have some macros written that I want to be able to call like the Group 9 G-codes. They are basically custom drilling cycles, and I would like to be able to have them repeat by just specifying new X and Y positions like, for example, G83.

G83 X1. Y2. R.1 Z-1.;
X2.;
X3. Y1.;
G80;

Can that be done with a custom macro that is (for example) G70 that is in program 9013? (This is a mill, and G70 isn't currently used)

G70 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G80;

Instead of
G70 X1. Y2. I1.5 J.625;
G70 X10. Y2. I1.5 J.625;
G70 X12. Y-2. I1.5 J.625;

Thanks,

Adam

Hello Adam,
You have to call the Macro Program using the Modal Call G66. Your Post indicates that you know that a Custom G Code can be created by registering a number that is associated with the Custom G Code; in your example "70" is registered in the parameter that is linked to Program Number O9013 for G70. Once registered, the execution of G70 will call Macro Program O9013 and is equivalent to

G65 P9013

If Macro Program O9013 were to be called with G66, the Macro remains Modal until cancelled with G67 and will execute after a block specifying movement along axes is executed. This process will continue until G67 is executed. Accordingly, G67 would be used in much the same way as G80 if the design of the Macro was to mimic a Canned Cycle.

On late Fanuc controls, the registration of the number in creating the Custom G Code is made in negative form if the G Code is to call the Macro in Modal Form. That is, if the G code is going to replace G66 in calling the Macro. This functionality wasn't introduced until much later than the FS6 control. Therefore, you will have to use the following syntax:

G66 P9013 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G67;

As you wont be creating a Custom G Code, there is no need to tie up one of the programs numbers that can be called via a G code. Accordingly, you could use a program number that has some association with the Canned Cycle you wish to create. For example:

G66 P70 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G67;

Regards,

Bill
 
Caution while using G66: The local variables are assigned the specified values only in the first macro execution. The subsequent executions use the updated values (if updated) of the local variables in the previous execution.
 
Caution while using G66: The local variables are assigned the specified values only in the first macro execution. The subsequent executions use the updated values (if updated) of the local variables in the previous execution.

Hello Sinha,
A prudent caution, but an easily worked around issue. The two accepted methods are:

1. Save the initial value of the Local Variables the arguments are passed to on entry to and restore their value on exit from the Macro.

2. Make a working copy of the passed arguments on entry to the Macro and not change the value of the Local Variables the arguments are passed to.

Personally, I prefer the second option.

Regards,

Bill
 
Hello Adam,
You have to call the Macro Program using the Modal Call G66. Your Post indicates that you know that a Custom G Code can be created by registering a number that is associated with the Custom G Code; in your example "70" is registered in the parameter that is linked to Program Number O9013 for G70. Once registered, the execution of G70 will call Macro Program O9013 and is equivalent to

G65 P9013

If Macro Program O9013 were to be called with G66, the Macro remains Modal until cancelled with G67 and will execute after a block specifying movement along axes is executed. This process will continue until G67 is executed. Accordingly, G67 would be used in much the same way as G80 if the design of the Macro was to mimic a Canned Cycle.

On late Fanuc controls, the registration of the number in creating the Custom G Code is made in negative form if the G Code is to call the Macro in Modal Form. That is, if the G code is going to replace G66 in calling the Macro. This functionality wasn't introduced until much later than the FS6 control. Therefore, you will have to use the following syntax:

G66 P9013 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G67;

As you wont be creating a Custom G Code, there is no need to tie up one of the programs numbers that can be called via a G code. Accordingly, you could use a program number that has some association with the Canned Cycle you wish to create. For example:

G66 P70 X1. Y2. I1.5 J.625;
X10.;
X12. Y-2.;
G67;

Regards,

Bill

Thanks Bill. I'll proceed in that direction. These old controls can do a lot more than I thought they could when I started using them, but they certainly have their limitations.


Caution while using G66: The local variables are assigned the specified values only in the first macro execution. The subsequent executions use the updated values (if updated) of the local variables in the previous execution.

Thanks for the heads-up Sinha, I'll review the macro to make sure that won't be a problem.
 








 
Back
Top