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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     74      75      76      77     ..

 

 

 

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

 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 564 - 

 - Reset 

With a reset operation, local variables and common variables #100 to 
#199 are cleared to null values.    They can be prevented from clearing 
by setting bit 6 (CCV) of parameter No.6001.    System variables #100 
to #199 are not cleared. 
A reset operation clears any called states of custom macro programs 
and subprograms, and any DO states, and returns control to the main 
program. 
 

  - Display of the PROGRAM RESTART 

As with M98, the M and T codes used for subprogram calls are not 
displayed. 
 

 - Feed hold 

When a feed hold is enabled during execution of a macro statement, 
the machine stops after execution of the macro statement.  The 
machine also stops when a reset or alarm occurs. 
 

 - DNC operation 

The control commands (such as GOTO and WHILE-DO) cannot be 
executed during DNC operation. 
However, this restriction is removed when a program registered in 
program memory is called during DNC operation. 
 

  - Constant values that can be used in <expression> 

+0.00000000001 to +999999999999 
-999999999999 to -0.00000000001 

The number of significant digits is 12 (decimal).     
If this range is exceeded, an alarm PS0012 occurs. 
 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 565 - 

16.13 

INTERRUPTION TYPE CUSTOM MACRO 

 
When a program is being executed, another program can be called by 
inputting an interrupt signal (UINT) from the machine.     
This function is referred to as an interruption type custom macro 
function.    Program an interrupt command in the following format: 
 

Format 

M96Pxxxxxxxx ; 

Enables custom macro interrupt 

M97 ; 

Disables custom macro interrupt 

 

Explanation 

Use of the interruption type custom macro function allows the user to 
call a program during execution of an arbitrary block of another 
program.  This allows programs to be operated to match situations 
which vary from time to time. 
(1)  When a tool abnormality is detected, processing to handle the 

abnormality is started by an external signal. 

(2)  A sequence of machining operations is interrupted by another 

machining operation without the cancellation of the current 
operation. 

(3)  At regular intervals, information on current machining is read. 
 

Listed above are examples like adaptive control applications of 
the interruption type custom macro function. 

Interrupt signal
(UINT) **

Interrupt signal
(UINT) *

Interrupt signal
(UINT) *

M96 Pxxxxxxxx;

Nxxxxxxxx ;

M97  ;

M99 (Pxxxxxxxx) ;

O xxxxxxxx;

 

Fig 16.13 (a)    Interruption type custom macro function 

 

When M96Pxxxx is specified in a program, subsequent program 
operation can be interrupted by an interrupt signal (UINT) input to 
execute the program specified by Pxxxx.    When the interrupt signal 
(UINT, marked with an asterisk (*) in Fig 16.13 (a)) is input during 
execution of the interrupt program or after M97, it is ignored. 
 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 566 - 

16.13.1 

Specification Method 

 

Explanation 
 - Interrupt conditions 

A custom macro interrupt is available only during program execution.   
It is enabled under the following conditions 

  When memory operation, DNC operation, or MDI operation is 

selected 

  When STL (start lamp) is on 

  When a custom macro interrupt is not currently being processed 

A macro interrupt cannot be performed during manual operation. 
 

 - Specification 

Generally, the custom macro interrupt function is used by specifying 
M96 to enable the interrupt signal (UINT) and M97 to disable the 
signal. 
Once M96 is specified, a custom macro interrupt can be initiated by 
the input of the interrupt signal (UINT) until M97 is specified or the 
CNC is reset.    After M97 is specified or the CNC is reset, no custom 
macro interrupts are initiated even when the interrupt signal (UINT) is 
input.  The interrupt signal (UINT) is ignored until another M96 
command is specified. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The interrupt signal (UINT) becomes valid after M96 is specified.  
Even when the signal is input in M97 mode, it is ignored.    When the 
signal input in M97 mode is kept on until M96 is specified, a custom 
macro interrupt is initiated as soon as M96 is specified (only when the 
status-triggered scheme is employed); when the edge-triggered 
scheme is employed, the custom macro interrupt is not initiated even 
when M96 is specified. 
 

NOTE 

  For the status-triggered and edge-triggered 

schemes, see Item "Custom macro interrupt signal 
(UINT)" of II-16.13.2. 

Interrupt signal 
(UINT) 

Effective interrupt 
input signal 

When UINT is kept on 

1
0

M96

M97

M96 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 567 - 

16.13.2 

Details of Functions 

 

Explanation 
  - Subprogram-type interrupt and macro-type interrupt 

There are two types of custom macro interrupts:  Subprogram-type 
interrupts and macro-type interrupts.  The interrupt type used is 
selected by bit 5 (MSB) of parameter No.6003. 
 
(a)  Subprogram-type interrupt:  When bit 5 (MSB) of parameter 

No.6003 is set to 1 

 

An interrupt program is called as a subprogram.     

 

This means that the levels of local variables remain unchanged 
before and after the interrupt.     

 

This interrupt is not included in the nesting level of subprogram 
calls. 

(b)  Macro-type interrupt:    When bit 5 (MSB) of parameter No.6003 

is set to 0 

 

An interrupt program is called as a custom macro.     

 

This means that the levels of local variables change before and 
after the interrupt.     

 

The interrupt is not included in the nesting level of custom macro 
calls.   

 

When a subprogram call or a custom macro call is performed 
within the interrupt program, this call is included in the nesting 
level of subprogram calls or custom macro calls.     

 

Arguments cannot be passed from the current program even 
when the custom macro interrupt is a macro-type interrupt.    The 
local variables immediately after interruption are all cleared to 
null. 

 

  - M codes for custom macro interrupt control 

In general, custom macro interrupts are controlled by M96 and M97.   
However, these M codes, may already being used for other purposes 
(such as an M function or macro M code call) by some machine tool 
builders. 
For this reason, bit 4 (MPR) of parameter No.6003 is provided to set 
M codes for custom macro interrupt control. 
When specifying this parameter to use the custom macro interrupt 
control M codes set by parameters, set parameters Nos.6033 and 6034 
as follows: 
Set the M code to enable custom macro interrupts in parameters 
Nos.6033, and set the M code to disable custom macro interrupts in 
parameter 6034. 
When specifying that parameter-set M codes are not used, M96 and 
M97 are used as the custom macro control M codes regardless of the 
settings of parameters Nos.6033 and 6034. 
The M codes used for custom macro interrupt control are processed 
internally (they are not output to external units).    However, in terms 
of program compatibility, it is undesirable to use M codes other than 
M96 and M97 to control custom macro interrupts. 
 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 568 - 

 - 

Custom macro interrupts and NC statements 

When performing a custom macro interrupt, the user may want to 
interrupt the NC statement being executed, or the user may not want to 
perform the interrupt until the execution of the current block is 
completed.  Bit 2 (MIN) of parameter No.6003)is used to select 
whether to perform interrupts even in the middle of a block or to wait 
until the end of the block.    The type of interrupt performed even in 
the middle of a block is called type I and the type of interrupt 
performed at the end of the block is called type II. 
 

 CAUTION 

For interrupt type I, operation after control is 

returned differs depending on whether the interrupt 
program contains an NC statement. 

When the program number block contains EOB (;), 

it is assumed to contain an NC statement. 

(Program containing an 
NC statement) 

O0013; 
#101=#5041; 
#102=#5042; 
#103=#5043; 
M99; 

(Program containing no 
NC statement) 

O0013#101=#5041;  
#102=#5042; 
#103=#5043; 
M99; 

 

     

Type I (when an interrupt is performed even in the middle of a block) 

(i)  When the interrupt signal (UINT) is input, any movement or 

dwell being performed is stopped immediately and the interrupt 
program is executed. 

(ii)  If there are NC statements in the interrupt program, the command 

in the interrupted block is lost and the NC statement in the 
interrupt program is executed.    When control is returned to the 
interrupted program, the program is restarted from the next block 
after the interrupted block. 

(iii)  If there are no NC statements in the interrupt program, control is 

returned to the interrupted program by M99, then the program is 
restarted from the command in the interrupted block. 

 

Interrupt signal 
(UINT) input 

Custom macro interrupt 

Execution in progress 

Execution in progress

Normal program 

CNC command restart;   
when there are no NC statements 
in the interrupt program 

Interrupted by macro interrupt 

 

Fig. 16.13 (b)    Custom macro interrupt and NC command (type I) 

 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 569 - 

   

 

Type II (when an interrupt is performed at the end of the block) 

(i)  If the block being executed is not a block that consists of several 

cycle operations such as a drilling canned cycle and automatic 
reference position return (G28), an interrupt is performed as 
follows: 

 

When an interrupt signal (UINT) is input, macro statements in 
the interrupt program are executed immediately unless an NC 
statement is encountered in the interrupt program.  NC 
statements are not executed until the current block is completed. 

(ii)  If the block being executed consists of several cycle operations, 

an interrupt is performed as follows: 

 

When the last movement in the cycle operations is started, macro 
statements in the interrupt program are executed unless an NC 
statement is encountered.    NC statements are executed after all 
cycle operations are completed. 

 

Custom macro interrupt

Execution in progress

Execution in progress

Normal program

NC statement in the interrupt
program

Interrupt signal (UINT) input

 

Fig. 16.13 (c)    Custom macro interrupt and NC command (type II) 

 

M

 

NOTE 

During execution of a program for cycle operations, 
interrupt type II is performed regardless of whether 
bit 2 (MIN) of parameter No. 6003 is set to 0 or 1.  
Cycle operations are available for the following 
functions: 
<1>  Automatic reference position return 
<2> Tool radius 

 tool nose radius compensation 

(generating multiple blocks using the specified 
block such as when the tool moves around the 
outside of an acute angle) 

<3>  Canned cycle 
<4>   Automatic tool length measurement 
<5>   Optional chamfering/corner R 
<6>  Exponential interpolation 
<7>   Normal direction control 
<8>   Cutting point interpolation for cylindrical 

interpolation 

 

16.CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 570 - 

T

 

NOTE 

During execution of a program for cycle operations, 
interrupt type II is performed regardless of whether 
bit 2 (MIN) of parameter No. 6003 is set to 0 or 1.  
Cycle operations are available for the following 
functions: 
<1>   Automatic reference position return 
<2>  Tool radius 

 tool nose radius compensation 

(generating multiple blocks using the specified 
block such as when the tool moves around the 
outside of an acute angle) 

<3>   Canned cycle (No interruption type custom 

macro can be used during execution of a 
multiple repetitive canned turning cycle, 
however.) 

<4>   Automatic tool length measurement 
<5>  Chamfering/corner R 
<6>  Exponential interpolation 
<7>   Cutting point interpolation for cylindrical 

interpolation 

 

 

 

  - Conditions for enabling and disabling the custom macro interrupt signal 

The interrupt signal becomes valid after execution starts of a block 
that contains M96 for enabling custom macro interrupts.    The signal 
becomes invalid when execution starts of a block that contains M97. 
While an interrupt program is being executed, the interrupt signal 
becomes invalid.    The signal become valid when the execution of the 
block that immediately follows the interrupted block in the main 
program is started after control returns from the interrupt program.  
In type I, if the interrupt program consists of only macro statements, 
the interrupt signal becomes valid when execution of the interrupted 
block is started after control returns from the interrupt program. 
 

  - Custom macro interrupt signal (UINT) 

There are two schemes for custom macro interrupt signal (UINT) 
input:  The status-triggered scheme and edge-triggered scheme.  
When the status-triggered scheme is used, the signal is valid when it is 
on.  When the edge triggered scheme is used, the signal becomes 
valid on the rising edge when it switches from off to on status. 
One of the two schemes is selected with bit 3 (TSE) of parameter 
No.6003. 
 

B-63944EN/03

 PROGRAMMING 

16.CUSTOM MACRO

 

 

- 571 - 

When the status-triggered scheme is selected by this parameter, a 
custom macro interrupt is generated if the interrupt signal (UINT) is 
on at the time the signal becomes valid.  By keeping the interrupt 
signal (UINT) on, the interrupt program can be executed repeatedly. 
 
When the edge-triggered scheme is selected, the interrupt signal 
(UINT) becomes valid only on its rising edge.  Therefore, the 
interrupt program is executed only momentarily (in cases when the 
program consists of only macro statements).  When the 
status-triggered scheme is inappropriate, or when a custom macro 
interrupt is to be performed just once for the entire program (in this 
case, the interrupt signal may be kept on), the edge-triggered scheme 
is useful. 
 
Except for the specific applications mentioned above, use of either 
scheme results in the same effects.    The time from signal input until a 
custom macro interrupt is executed does not vary between the two 
schemes. 
 
In the example shown in Fig 16.13 (d), an interrupt is executed four 
times when the status-triggered scheme is used;  when the 
edge-triggered scheme is used, the interrupt is executed just once. 
 

Interrupt signal (UINT)

1

0

Status-triggered scheme

Edge-triggered scheme

Interrupt
execution

Interrupt
execution

Interrupt
execution

Interrupt
execution

Interrupt execution

 

Fig. 16.13 (d)    Custom macro interrupt signal 

 

 

 

 

 

 

 

 

Content      ..     74      75      76      77     ..