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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     76      77      78      79     ..

 

 

 

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

 

 

17.REAL-TIME CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 580 - 

  - Real time macro statement (RTM statement) 

The real time macro statement (RTM statement) is a statement 
included in an RTM command. 
One or more RTM statements make up an RTM command. 
An RTM statement consists of a macro command and axis control 
command dedicated to the real time custom macro function. 
 
The axis control command of an RTM statement is an RTM statement 
including an address.    This command is used to exercise axis control. 
Example 
 

// ZDO ; 

 

G90 G00 X100 ; 

 ZEND 

(ZDO and ZEND are reserved words required for the axis control 
command of an RTM statement, and are detailed later.) 
 
The macro command of an RTM statement is a macro statement used 
with an RTM statement for arithmetic/logical operation and signal 
control.  (In the example below, #RV[1] and #RV[2] are variables 
dedicated to the real time macro command.) 
Example 
 

// #IOG[124, 5] = 1 ; 

 

// #RV[1] = #RV[2] * 10 ; 

 

Format 

The real time macro command format is shown below. 
The RTM command is a command with two slashes (//) prefixed at the 
start of a block. 

//n <real-time-macro-statement> 
 or 
//n ZDO ; 
<real-time-macro-statement> 

ZEND ; 

N:  Modal ID (1 to 10) (Omissible) 
 

When a proper number is coded in n, a modal real time 
macro command is specified. When n is omitted, a 
one-shot real time macro command is specified. 

ZDO to ZEND are detailed later. 

 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 581 - 

17.1 

TYPES OF REAL TIME MACRO COMMANDS 

 

17.1.1 

Modal Real Time Macro Command / One-shot Real Time 

Macro Command 

 

Explanation 

A command with ’//’ followed by an RTM statement is referred to as a 
one-shot real time macro command (one-shot RTM command). 
Example: 
 

// #RV[1] = 30 ; 

 
On the other hand, a command with ’//’ followed by number n (1 to 
10) then an RTM statement is referred to as a modal real time macro 
command (modal RTM command). 
Example: 
 

//3 #RV[1] = 30 ; 

 
A one-shot RTM command starts when the execution of the first 
following NC command starts.    A started one-shot RTM command is 
valid until the end of the NC command. 
A modal RTM command starts when the execution of the first 
following NC command starts, as in the case of a one-shot RTM 
command. 
Unlike a one-shot RTM command, however, a started modal RTM 
command is valid until the automatic operation is completed. 
 

  - Start of a real time macro command 

An RTM command starts when the execution of the first following 
NC command starts. 
 
Example: 
When NC command (1) starts execution in the program below, macro 
commands (2) and (4) are executed in succession without waiting for 
the end of (1). 
On the other hand, RTM command (3)starts execution when NC 
command (5) starts execution after the end of NC command (1). 

O0001 ; 

 

G90 G00 X30. ; 

(1) NC command 

#100=0 ; 

(2) Macro command 

// #RV[0]=1 ; 

(3) RTM command 

#102=2; 

(4) Macro command 

G90 G00 X100. ; 

(5) NC command 

M30 ; 

 

 

17.REAL-TIME CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 582 - 

  - End of a real time macro command 

When one of the following conditions is satisfied, the RTM command 
is terminated. 
 
Termination conditions common to one-shot RTM and modal RTM 
commands 

 

When RTM command processing is completed 

 

When a reset occurs 

 

Termination condition specific to a one-shot RTM command 

 

When the execution of the NC command that started at the same 
time has ended 

 
However, if the RTM statement being executed is an axis control 
command, the command is terminated when the execution of the block 
is completed. 
If the execution of the Y10. block is completed before the X100. block 
in the command below, and the execution of the Y20. block starts, for 
example, the X100. command of the RTM statement is executed until 
the end. 
 
// ZDO ; 
X100 ; 
ZEND ; 
Y10. ; 
Y20. ; 

 

NOTE 

1  No one-shot RTM command can be specified using 

any of the commands indicated below as a trigger.   
When using any of these commands as a trigger, 
use a modal RTM command. 

- Command related to reference position return 
- Command related to AI contour control 
- Command related to canned cycles (rigid tapping, 

drilling cycle, etc.) 

- Command related to cutter compensation 
- Command related to tool length compensation 
- Command related to automatic tool length 

measurement 

- Command related to coordinate system rotation 

Command related to scaling 

- Command related to programmable mirror image 

2  If an RTM command is specified using, as a trigger, 

a block such as a block specifying NURBS 
interpolation or a T series multiple repetitive canned 
cycle that does not necessarily pass the start point 
or end point of the command, operation can start or 
end at a point other than the start point and end 
point.    Do not use such a block as a trigger. 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 583 - 

NOTE 

3  Do not restart a program that includes an RTM 

command. 

4  When an NC statement used as a trigger for an 

RTM command represents an auxiliary function, 
execution continues even if the FIN signal is 
awaited. 
If the following program is executed, for example, 
the count-up operation of #RV[0] continues until the 
FIN signal of M55 is returned: 
O0001 ; 
// ZWHILE [1] #RV[0] = #RV[0]+1 ; 
M55 ; 
G91 X200. ; 
    : 

5  If M02 follows an RTM command, execution 

continues until a reset occurs, even when the 
program itself is terminated. 
If the following program is executed, for example, 
the count-up operation of #RV[0] continues until a 
reset occurs: 
O0001 ; 
// ZWHILE [1] #RV[0] = #RV[0]+1 ; 
M02 ; 

 

  - Priority of commands 

If a modal RTM command and one-shot RTM command are specified 
at the same time, the modal RTM command is executed first. 
If multiple modal RTM commands are specified at the same time, the 
commands are executed in ascending order of ID values. 
No priority is applicable to one-shot RTM commands. 
The order of execution is as follows: 
 
Modal RTM command with ID value being 1 
Modal RTM command with ID value being 2 
 : 
 : 
Modal RTM command with ID value being 10 
One-shot RTM command 
 : 
One-shot RTM command 
 
 
Example 1) 
 

Priority of modal RTM commands 

 O0001 

 

//1 #RV[0]=1 ; 

 

//3 #RV[0]=3 ; 

 

//2 #RV[0]=2 ; 

 M02 

High 

Low 

17.REAL-TIME CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 584 - 

 
 

When the program above is executed, the RTM commands are 
executed in the following order: 

 #RV[0]=1 
 #RV[0]=2 
 #RV[0]=3 
 

So, the value of #RV[0] is 3. 

 
Example 2) 
 

Priority of modal RTM commands and a one-shot RTM 
command 

 O0001 

 

//3 #RV[0]=3 ; 

 

//1 #RV[0]=1 ; 

 

// #RV[0]=10 ; 

 

//5 #RV[0]=5 ; 

 M02 

 
 

When the program above is executed, the RTM commands are 
executed in the following order: 

 //1 

#RV[0]=1 

 //3 

#RV[0]=3 

 //5 

#RV[0]=5 

 // 

#RV[0]=10 

 

So, the value of #RV[0] is 10. 

 
Example 3) 
 

Priority of one-shot RTM commands 

 

When the following program is executed, the value of #RV[0] is 
undefined, that is, 1, 2, or 3. 

 O0001 

 //#RV[0]=1 

 //#RV[0]=2 

 //#RV[0]=3 

 G04P10 

 M30 

 
Even if a priority is applicable, the order of execution or the order of 
termination can change when an RTM statement includes a control 
code, ZWHILE or ZEDGE, or axis control command. 
 
Example 4) 
 

The RTM command priority of #RV[0]=1 in a modal command 
with its ID value being 1 is higher than the priority of #RV[1]=1 
in a modal command with its ID value being 2.  However, 
#RV[0]=1 is executed after the end of the execution of the block 
specifying the axis control command G91 G00 X10., so that 
#RV[1]=1 is actually executed earlier than #RV[0]=1. 

 O0001 

 

//1 ZDO ; 

 

G91 G00 X10. ; 

 #RV[0]=1 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 585 - 

 ZEND 

 

//2 #RV[1]=1 ; 

 

G04 P10 ; 

 M30 

 
Example 5) 
 

In the RTM command priority, ZEDGE in a modal command 
with its ID value being 1 is always a false control code (detailed 
later).  The RTM command priority of #RV[0]=1 in a modal 
command with its ID value being 1 is higher than the priority of 
#RV[1]=1 and #RV[2]=1 in a modal command with their ID 
values being 2.  However, #RV[0]=1 is executed after the 
condition of ZEDGE becomes true (that is, at the second time or 
later), so that #RV[1]=1 and #RV[2]=1 are executed earlier than 
#RV[0]=1. 

 O0001 

 

//1 ZEDGE [ #IOG[234.0] EQ 1 ] #RV[0]=1 ; 

 

//2 ZDO ; 

 #RV[1]=1 

 #RV[2]=1 

 ZEND 

 

G04 P10 ; 

 M30 

 

  - Number of real time macro commands 

A program can have multiple RTM commands coded. 
Up to six one-shot RTM commands can be specified. 
If one-shot RTM commands more than the maximum allowable 
number are specified, an alarm is issued. 
 
Up to ten modal RTM commands can be specified.    When specifying 
modal RTM commands, ensure that there is no duplicate ID. 
 
If there is a duplicate ID, or an incorrect ID is specified, an alarm is 
issued. 
 
In all paths, up to 16 RTM commands can be executed 
simultaneously. 
When an axis control command is included, up to four commands can 
be executed simultaneously. 
 

NOTE 

1  In a block specifying an RTM statement, no NC 

command can be coded. 

2  If the maximum specifiable number of commands or 

the maximum number of simultaneously executable 
commands is exceeded, a PS alarm is issued. 

17.REAL-TIME CUSTOM MACRO

 PROGRAMMING 

B-63944EN/03

 

 

- 586 - 

NOTE 

3  If an NC statement to be used to trigger an RTM 

command is specified in a block (e.g., small block) that 
ends in a very short time, an RTM statement 
programmed to start at a different timing may be 
executed simultaneously.    If the following is specified, 
for example, #RV[0]=1 and #RV[1]=2 may be executed 
simultaneously: 

                  // #RV[0]=1 ; 
         G91 G01 X0.002 ; F5000 
                  // #RV[1]=2 ; 
         X0.001 ; 
4  When a function for reading multiple blocks in advance 

is used, the same ID must not be coded in the scope of 
blocks read in advance.    In the following program, for 
example, while //1 #RV[0]=#100101 is being executed 
during AI contour control, //1 #RV[1]=#100101 and //1 
#RV[2]=#100101 are also read in advance.    So, an 
alarm may be issued. 

         //1 #RV[0]=#100101 ; 
         X#100 ; 
         //1 #RV[1]=#100101 ; 
         X#100 ; 
         //1 #RV[2]=#100101 ; 
         X#100 ; 
5  When a function for reading multiple blocks in advance 

is used, up to three blocks among the blocks read in 
advance can trigger an RTM command. 
For example, if the blocks up to the block of (2) are 
read in advance during execution of (1) in the program 
below, up to three blocks can trigger an RTM 
command.  In the program below, the number of NC 
blocks that trigger an RTM command exceeds 3, so 
that the RTM command of (a) must not be coded. 

X30. Y50. ;  ......................................................(1) 
// Z-30. ; 
// #RV[0]=#RV[0]+1 ; 
X3. Y16. ; 

 NC block 1 triggering an RTM command 

X-23. Y4. ; 
// #RV[1]=#RV[1]+1 ; 
//2 Z30. ; 
X-2. Y9. ; 

  NC block 2 triggering an RTM command 

X17. Y5. ; 
// #RV[2]=#RV[2]+1 ; 
X-2. Y9. ; 

  NC block 3 triggering an RTM command 

// #RV[3]=#RV[3]+1 ; ..........................................(a) 
X-12. Y-3. ; 
X-100. Y200. ; ....................................................(2) 

B-63944EN/03

 PROGRAMMING 

17.REAL-TIME CUSTOM MACRO

 

 

- 587 - 

 

 - Reserved words 

The following reserved words are used with real time custom macros: 
 

Reserved words dedicated to real time custom macros 

 

ZDO,  ZEND,  ZONCE,  ZWHILE,  ZEDGE 

 

Reserved words shared with custom macros 

 

AND, OR, XOR, MOD, EQ, NE, GT, LT, GE, LE, SIN, COS, 
TAN, ASIN, ACOS, ATAN, ATN, SQRT, SQR, ABS, BIN, 
BCD, ROUND, RND, FIX, FUP, LN, EXP, POW 

 
Be sure to fully spell out the reserved words for real time custom 
macros.  For example, ’ZONCE’ must not be coded as ’ZON’ 
or ’ZONC’. 

 

 

 

 

 

 

 

 

Content      ..     76      77      78      79     ..