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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     75      76      77      78     ..

 

 

 

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

 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 572 - 

 - 

Return from a custom macro interrupt 

To return control from a custom macro interrupt to the interrupted 
program, specify M99.  A sequence number in the interrupted 
program can also be specified using address P.    If this is specified, 
the program is searched from the beginning for the specified sequence 
number.    Control is returned to the first sequence number found. 
 

NOTE 

  When an M99 block consists only of address O, N, 

P, L, or M, this block is regarded as belonging to 
the previous block in the program.  Therefore, a 
single-block stop does not occur for this block.    In 
terms of programming, the following <1> and <2> 
are basically the same.    (The difference is whether 
Gxx is executed before M99 is recognized.) 

 

<1>  Gxx Xxxx ; 
   M99 

<2>  Gxx Xxxx M99 ; 

 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 573 - 

  - Custom macro interrupt and modal information 

A custom macro interrupt is different from a normal program call.    It 
is initiated by an interrupt signal (UINT) during program execution.   
In general, any modifications of modal information made by the 
interrupt program should not affect the interrupted program. 
For this reason, even when modal information is modified by the 
interrupt program, the modal information before the interrupt is 
restored when control is returned to the interrupted program by M99. 
 
When control is returned from the interrupt program to the interrupted 
program by M99 Pxxxxxxxx, however, modal information can again 
be controlled by the program.  In this case, the new continuous 
information modified by the interrupt program is passed to the 
interrupted program.   
 
In this case, take the following action as required:   
<1> The interrupt program provides modal information to be used 

after control is returned to the interrupted program. 

<2> After control is returned to the interrupted program, modal 

information is specified again as necessary. 

 

{

∆∆∆∆

M96 Pxxxxxxxx ;

{

xxxxxxxx ;

Interrupt signal (UINT)

Modify modal information

(Without P specification)

Modal information remains
unchanged before and after
the interrupt.

M99 (Pxxxxxxxx) ;

(With P specification)

The new modal information modified by the interrupt program is present.

Nxxxxxxxx ;

 

Fig. 16.13 (e)    Custom macro interrupt and modal information 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 574 - 

Modal information when control is returned by M99 

The modal information present before the interrupt becomes valid.  
The new modal information modified by the interrupt program is 
made invalid. 
 

Modal information when control is returned by M99 Pxxxxxxxx 

The new modal information modified by the interrupt program 
remains valid even after control is returned.     
 

Modal information which was valid in the interrupted block 

The old modal information which was valid in the interrupted block 
can be read using custom macro system variables #4401 to #4530. 
 

M

 

System variable

Modal information which was valid when a custom 

macro interrupt was generated 

#4401 

 :

 

#4421 
#4502 
#4507 
#4508 
#4509 
#4511 
#4513 
#4514 
#4515 
#4519 
#4520 
#4530

 

G code (group 01) 
 : 
G code (group 21) 
B code 
D code 
E code 
F code 
H code 
M code 
Sequence number 
Program number 
S code 
T code 
Additional workpiece coordinate system number 

 

T

 

System variable

Modal information which was valid when a custom 

macro interrupt was generated 

#4401 

 : 

#4421 
#4508 
#4509 
#4513 
#4514 
#4515 
#4519 
#4520 
#4530

 

G code (group 01) 
 : 
G code (group 21) 
E code 
F code 
M code 
Sequence number 
Program number 
S code 
T code 
Additional workpiece coordinate system number 

 

 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 575 - 

  - System variables (position information values) for the interrupt program 

 
Position information can be read as follows. 
 

Macro 

variable

Condition 

Position information 

value 

Until the first NC statement appears 

Coordinates of point A 

After an NC statement with no move 
command appears 

Coordinates of point A' 

#5001 or 
above 

After an NC statement with a move 
command appears 

Coordinates of the end 
point of the move 
command 

#5021 or 
above 

 

Machine coordinates of 
point B' 

#5041 or 
above 

 Workpiece 

coordinates 

of point B' 

 

B

B

A’

A

Interrupt generated

    Programmed tool path

Offset vector

Tool center path

 

 

  - Custom macro interrupt and custom macro modal call 

When the interrupt signal (UINT) is input and an interrupt program is 
called, the custom macro modal call is canceled (G67).  However, 
when G66 is specified in the interrupt program, the custom macro 
modal call becomes valid.  When control is returned from the 
interrupt program by M99, the modal call is restored to the state it was 
in before the interrupt was generated.    When control is returned by 
M99 Pxxxxxxxx;, the modal call in the interrupt program remains 
valid. 
 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 576 - 

 - 

Custom macro interrupt and program restart 

In program restart, when the interrupt signal (UINT) is input during 
dry run recovery after a search, the interrupt program is called after 
restart of all axes is completed. 
That is, interrupt type II is assumed regardless of the parameter 
setting. 
 

M

 

NOTE 

1  Alarm PS1101 occurs in the following cases: 

<1> An interrupt is generated in the programmable 

mirror image (G51.1) mode and another G51.1 
is specified in the interrupt program. 

<2> 

An interrupt is generated in the coordinate 
system rotation (G68) mode and another G68 
is specified in the interrupt program. 

<3> An interrupt is generated in the scaling (G51) 

mode and another G51 is specified in the 
interrupt program. 

2  In program restart, do not input the interrupt signal 

(UINT) during dry run recovery after a search. 

 

T

 

NOTE 

1  Alarm PS1101 occurs in the following cases: 

<1> An interrupt is generated in the programmable 

mirror image (G51.1) mode and another G51.1 
is specified in the interrupt program. 

<2> 

An interrupt is generated in the coordinate 
system rotation (G68.1) mode and another 
G68.1 is specified in the interrupt program. 

<3> An interrupt is generated in the scaling (G51) 

mode and another G51 is specified in the 
interrupt program. 

2  No interruption type custom macro can be used 

during execution of a multiple repetitive canned 
turning cycle. 

3  In program restart, do not input the interrupt signal 

(UINT) during dry run recovery after a search. 

 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 577 - 

17 

REAL-TIME CUSTOM MACRO 

 
Chapter 17, "REAL-TIME CUSTOM MACRO", consists of the 
following sections: 
 
17.1  TYPES OF REAL TIME MACRO COMMANDS................581 
17.2 VARIABLES..........................................................................588 
17.3  ARITHMETIC AND LOGICAL OPERATION....................596 
17.4  CONTROL ON REAL TIME MACRO COMMANDS ........598 
17.5 MACRO 

CALL ......................................................................605 

17.6 OTHERS.................................................................................607 
17.7  AXIS CONTROL COMMAND.............................................608 
17.8 NOTES ...................................................................................622 
17.9 LIMITATION.........................................................................624 
 

17.REAL-TIME CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 578 - 

Overview 

Used with an NC program, the real time custom macro function 
controls peripheral axes and signals. 
 
If a macro statement is used together with an NC statement, a program 
using the conventional custom macro function executes the macro 
statement immediately when the macro statement is read.  So, the 
macro statement cannot be executed independently of the NC 
statement. 
On the other hand, the real time custom macro function enables the 
following control operations when a real time macro command (RTM 
command) is coded in an NC program. 
 

 

A real time macro command starts operation in synchronism with 
the NC statement and is executed independently.  During NC 
program execution, a real time macro command can be executed 
at the same time. 

  PMC interface signals can be read and written (with a restriction).   

In an NC program, a motion using a signal as a trigger can be 
coded. 

 

Variables dedicated to a real time macro command can be read 
and written. 

 

A real time macro command can exercise axis control.  (The 
option is required.) 

 

Multiple real time macro commands can be executed at the same 
time.    Multiple real time custom macro statements can be coded 
in an NC program and can be controlled independently of each 
other. 

 
By using a real time custom macro, control on signals and peripheral 
axes can be programmed. 
The example below turns on and off a signal and performs operation 
on a peripheral axis when machining points are passed. 
 
 
 
 
 
 
 
 
 
 
During movement for machining along the X-axis in the figure above: 
<1>  When point Xa is passed, the G99.5 signal is set to 1. 
 

 Real time macro command 1 

<2>  When point Xb is passed, positioning is started on peripheral axis 

Y.  

 Real time macro command 2 

<3>  When point Xc is passed, the G99.5 signal is set to 0. 
 

 Real time macro command 3 

 

Signal

ON

OFF

Peripheral axis Y 

X-axis machining direction 

Xa=30

Xb=50

Xc=80 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 579 - 

The operation above is programmed using real time macro commands. 

Program 
O0001 ; 
G92 X0 ; 
//1 ZEDGE [#100101 GE 30. ] #IOG[99,5] = 1 ; 
//2 ZEDGE [#100101 GE 50.] ZDO ; 
G91 G00 Y100 ; 
ZEND ; 
//3 ZEDGE [#100101GE 80. ] #IOG[99,5] = 0 ; 
G90 G01 X200. F150 ; 
M30 ; 

 
The timing is as follows.  (‘**’ represents the satisfaction of the 
condition.) 
 

coordinate 

  30

  50

    80 

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Peripheral 

axis 

operation               

 

 

 

 

 

 

 

 

 

 

 

 

 

 

G99.5 

signal 

             

NC statement (machining) 

G90 G01 X200. F150 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Real time macro command 1 

//1 ZEDGE [#100101 GE 30.] 

#IOG[99,5] = 1 ; 

 

 

**

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Real time macro command 2 

//2 ZEDGE [#100101 GE 50. ]   

ZDO ; 

G91 G00 Y100 ; 

ZEND ; 

 

 

 

 

 

**

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Real time macro command 3 

//3 ZEDGE [#100101 GE 80. ] 

#IOG[99,5] = 0 ; 

 

 

 

 

 

 

 

 

 

 

** 

 

 

 

Explanation 

To use the real time custom macro function, a real time macro 
command (RTM command) is coded in an NC program. 
 

  - Real time macro command (RTM command) 

The real time macro command (RTM command) is a macro command 
that starts execution in phase with an NC statement in the program.  
After the execution of a real time macro command starts, the RTM 
command operates independently of the NC statement. 
An RTM command is a statement dedicated to the real time custom 
macro function. 
An RTM command consists of a set of one or more real time macro 
statements (RTM statements). 
 

 

 

 

 

 

 

 

Content      ..     75      76      77      78     ..