FANUC Series 30i/300i/300is-MODEL A. Machining Center System. User's manual - page 72

 

  Index      Manuals     FANUC Series 30i/300i/300is-MODEL A. Machining Center System. User's manual (B-63944EN/03)

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     70      71      72      73     ..

 

 

 

FANUC Series 30i/300i/300is-MODEL A. Machining Center System. User's manual - page 72

 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 532 - 

16.7.2 

Modal Call: Call After the Move Command (G66) 

 
Once G66 is issued to specify a modal call a macro is called after a 
block specifying movement along axes is executed.    This continues 
until G67 is issued to cancel a modal call. 
 

G66  P p  L 

l

  <argument-specification> ; P  :  Number of the program to call 

l

  :  Repetition count (1 by default) 

Argument  :  Data passed to the macro 

O0001 ; 
    : 
G66 P9100 L2 A1.0 B2.0 ;
G00 G90 X100.0 ; 
Y200.0 ; 
X150.0 Y300.0 ; 
G67 ; 
    : 
M30 ; 

O9100 ; 
    : 
G00 Z-#1 ; 
G01 Z-#2 F300 ; 
    : 
    : 
    : 
    : 
M99 ; 

 

 

Explanation 
 - Call 

  After G66, specify at address P a program number subject to a 

modal call. 

  When a number of repetitions is required, a number from 1 to 

999999999 can be specified at address L. 

  As with a simple call (G65), data passed to a macro program is 

specified in arguments. 

  In the G66 mode, a macro or subprogram can be called. 

 

 - Cancellation 

When a G67 code is specified, modal macro calls are no longer 
performed in subsequent blocks. 
 

 - Call nesting 

Macro calls can be nested to a depth of up to five levels including 
simple calls (G65) and modal calls (G66/G66.1).  Subprogram calls 
can be nested to a depth of up to 15 levels including macro calls. 
 

  - Modal call nesting 

For a single modal call (when G66 is specified only once), each time 
the move command is executed, the specified macro is called.    When 
nested modal macro calls are specified, the macro at the next higher 
level is called each time the move command for a macro call is 
executed. 
Macros are called in reverse order in which they are specified.    Each 
time G67 is issued, the macros are canceled one by one in reverse 
order in which they are specified. 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 533 - 

[Example] 

G66 P9100 ;   

O9100 ;   

O9200 ; 

X10.0 ; 

(1-1) 

Z50.0 ; 

(2-1) 

X60.0 ; 

(3-1) 

G66 P9200 ;   

M99 ; 

 

Y70.0 ; 

(3-2) 

X15.0 ; 

(1-2) 

 

 

M99; 

G67 ; 

Cancels P9200. 

G67 ; 

Cancels P9100. 

X-25.0 ; 

(1-3) 

 

Execution order of the above program (blocks not containing the 
move command omitted) 

(1-1) 

  (1-2) 

     (1-3) 

(2-1) (3-1) (3-2) 

(2-1) (2-1) 

*  No modal call is performed after (1-3) because the mode is not 

the macro call mode. 

 

Limitation 

  G66 and G67 blocks are specified in pairs in the same program.  

If a G67 code is specified not in the G66 mode, an alarm PS1100 
occurs.  Bit 0 (G67) of parameter No. 6000 can be set to 1 to 
specify that the alarm does not occur in this case. 

  In a G66 block, no macros can be called.  Local variables 

(arguments) are set, however. 

  G66 needs to be specified before any arguments. 

  No macros can be called in a block which contains a code such as a 

auxiliary function that does not involve movement along an axis. 

  Local variables (arguments) can only be set in G66 blocks.    Note 

that local variables are not set each time a modal call is performed. 

 

NOTE 

If M99 is specified in a block in which a call is 
performed, it is executed after the call is 
performed. 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 534 - 

Sample program 

 

M

 

The same operation as the drilling canned cycle G81 is created using a 
custom macro and the machining program makes a modal macro call.   
For program simplicity, all drilling data is specified using absolute 
values. 
 

Operation 1

Operation 3

Operation 2

Point I

Point R

Z=0

Point Z

Operation 4

The canned cycle consists of the following
basic operations:

Operation 1: Positioning along the X-axis

and Y-axis

Operation 2: Rapid traverse to point R

Operation 3: Cutting feed to point Z

Operation 4: Rapid traverse to point R or I

R

Z

Rapid traverse

Cutting feed

 

 

 - Calling format 

G66  P9110  Zz  Rr  Ff  Ll ; 

 
Z  : Coordinates of position Z (absolute programming only) ....... (#26) 
R  :  Coordinates of position R (absolute programming only)....... (#18) 
F : Cutting feedrate........................................................................ (#9) 
L : Repetition count 
 

  - Program that calls a macro program   

O0001;  
G28 G91 X0 Y0 Z0;   
G92 X0 Y0 Z50.0;   
G00 G90 X100.0 Y50.0;   
G66 P9110 Z-20.0 R5.0 F500;   
G90 X20.0 Y20.0; 
X50.0;  
Y50.0;  
X70.0 Y80.0;   
G67; 
M30;   

 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 535 - 

  - Macro program (program called) 

O9110; 

 

#1=#4001; 

.......................Stores G00/G01. 

 

#3=#4003;

.........................Stores G90/G91. 

 

#4=#4109;

.........................Stores the cutting feedrate. 

 

#5=#5003;

.........................Stores the Z coordinate at the start of drilling. 

 

G00 G90 Z#18;

.................Positioning at position R 

 

G01 Z#26 F#9;

..................Cutting feed to position Z 

 

IF[#4010 EQ 98]GOTO 1;

Return to position I 

 

G00 Z#18;

.........................Positioning at position R 

 GOTO 2; 
N1 G00 Z#5;

........................Positioning at position I 

N2 G#1 G#3 F#4;

................Restores modal information. 

 

M99; 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 536 - 

Sample program 

 

T

 

This program makes a groove at a specified position. 

U

 

 

 - Calling format 

G66 P9110 Uu Ff 

 

U  :  Groove depth (incremental programming) 
F  :  Cutting feed of grooving 

 

  - Program that calls a macro program 

O0003 ; 
G50 X100.0 Z200.0 ; 
S1000 M03 ; 
G66 P9110 U5.0 F0.5 ; 
G00 X60.0 Z80.0 ; 
Z50.0 ; 
Z30.0 ; 
G67 ; 
G00 X00.0 Z200.0 M05 ; 
M30; 

 

  - Macro program (program called) 

O9110 ; 
G01 U - #21 F#9 ;

....... Cuts the workpiece. 

G00 U#21 ;

................. Retracts the tool. 

M99 ; 

 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 537 - 

16.7.3 

Modal Call:    Each Block Call (G66.1) 

 
In this macro call mode, the specified macro is unconditionally called 
for each NC command block.    All data other than O, file name, N, 
and G codes that is specified in each block is not executed and is used 
as arguments.    (The G code in the block in which G66.1 is specified 
is not used as an argument.  Only the last G code specified in 
subsequent blocks is used as an argument.) 
The NC command blocks having O or file name N have the same 
effect as when G65P is specified in the next position, the other NC 
command blocks have the same effect as when G65P is specified at 
the beginning. 
 

G66.1 P p  L 

l

  <argument-specification> ; 

P  :  Number of the program to call 

l

  :  Repetition count (1 by default) 

Argument  :  Data passed to the macro

O0001 ; 
    : 
G66.1 P9100 L2 A1.0 
B2.0 ; 
A10.0 B20.0 F300 ; 
A0 B-30.0 ; 
F1000 ; 
G67 ; 
    : 

O9100 ; 
    : 
G00 Z-#1 ; 
G01 Z-#2 F#9 ; 
    : 
    : 
    : 
    : 
M99 ; 

 

 

[Example] 

In the G66.1 P100 ; mode, 
N001 G01 G91 X100 Y200 D1 R1000 ; 
is the same as 
N001 G65 P100 G01 G91 X100 Y200 D1 R1000 ; 

 

Explanation 
 - Call 

  After G66.1, specify at address P a program number subject to a 

modal call. 

  When a number of repetitions is required, a number from 1 to 

999999999 can be specified at address L. 

  As with a simple call (G65), data passed to a macro program is 

specified in arguments. 

  In the G66.1 mode, a macro or subprogram can be called. 

 

 - Cancellation 

When a G67 code is specified, modal macro calls are no longer 
performed in subsequent blocks. 
 

 - Call nesting 

Macro calls can be nested to a depth of up to five levels including 
simple calls (G65) and modal calls (G66/G66.1).  Subprogram calls 
can be nested to a depth of up to 15 levels including macro calls. 
 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 538 - 

  - Modal call nesting 

For a single modal call (when G66.1 is specified only once), the 
specified macro is called for each NC command block.    When nested 
modal macro calls are specified, the macro at the next higher level is 
also called in a block within a called macro in which an NC command 
is specified. 
Macros are called in reverse order in which they are specified.    Each 
time G67 is issued, the macros are canceled one by one in reverse 
order in which they are specified. 
 

[Example]  Axis specification switching 

N1 G66.1 P1000 X10.0 ; 

Calls O1000 and executes Y10.0. 

N2 X20.0 ; 

Calls O1000 and executes Y20.0. 

N3 G66.1 P2000 Y10.0 Z20.0 ;

Calls O2000 and executes Y20.0 
Z10.0.    Then, calls O1000 and 
executes X20.0 Z10.0. 

N4 X10.0 Y20.0 Z30.0 ; 

Calls O2000 and executes X10.0 
Y30.0 Z20.0.    Then, calls O1000 
and executes X30.0 Y10.0 Z20.0. 

N5 G67 ; 

Cancels P2000. 

N6 G67 ; 
 

Cancels P1000. 

O1000 X#25 Y#24 Z#26 ; 
M99 ; 

(X-Y switching) 

 

O2000 X#24 Y#26 Z#25 ; 
M99 ; 

(Y-Z switching) 

 
Execution order of the above program (blocks not containing the 
move command omitted) 

Calling 

program

N1

 N2

 N3

   N4    N5 N6

O1000 

 

 

 

 

 

 

 

 

 

 

 

 

Called 

programs  O2000 

 

 

 

 

 

 

 

 

 

 

 

 

 
In N1 and N2 blocks, O1000 is called and the X and Y specifications 
are made to change places. 
In N3 and N4 blocks, O2000 is called first and the Y and Z 
specifications are made to change places.  For the switched 
specification, O1000 is called and the X and Y specifications are made 
to change places.  Therefore, the X, Y, and Z specifications are 
switched to the Z, X, and Y specifications. 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 539 - 

Limitation 

  G66.1 and G67 blocks are specified in pairs in the same program.   

If a G67 code is specified not in the G66.1 mode, an alarm PS1100 
occurs.  Bit 0 (G67) of parameter No. 6000 can be set to 1 to 
specify that the alarm does not occur in this case. 

 G66.1 

block 

(a)  In a G66.1 block, a macro is called. 
(b)  The correspondence between addresses specified as arguments 

and variables is the same as for simple calls. 

 

  Block following a G66.1 block in which a call is performed (not 

including G66.1 blocks) 
(a)  Addresses G, P, and L can also be used as arguments.  

Address G corresponds to #10; address L to #12; address P to 
#16.    However, the restrictions on the input format of normal 
NC commands are put on the data.  For example, ;G1000. 
P0.12 L-4 cannot be specified. 

(b)  When multiple G codes are specified, only the last G code is 

used as an argument.    O, file name, and N codes and G codes 
not in group 00 are passed to the next and subsequent blocks. 

 

NOTE 

1  In a block in which only an O number, file name, 

sequence number, EOB, macro statement, or M99 
command is specified, a macro is not called for 
each block. 

2  In each block, when an address other than O, file 

name, or N is specified, it is assumed to be an NC 
command and a macro is called for each block.  
When N is specified following an address other 
than O, file name, or N, it is used as an argument.   
In this case, N corresponds to variable #14 and the 
number of decimal places is 0. 

3  If M99 is specified in a block in which a macro is 

called, it is executed after the call is performed. 

 

 

 

 

 

 

 

 

Content      ..     70      71      72      73     ..