
Ed. Date Design Description
Date Jan.07.’04 Design. Apprv.
page
-
34/64
FANUC Series 30i-MODEL A
Real time custom macro
A-79350EN
Title
Draw
No.
Sample program
The sample program below exercises the following three control operations at the
same time.
(1) A cutting operation is performed on the X-axis and Z-axis.
(2) On each rising edge of the X signal 5.2, 20 is fed on the peripheral axis A.
(3) When the workpiece coordinate on the X-axis (#100101) is equal to or less than
50, the Y signal 2.3 is set to 1.
The operation of (1) is coded in the main NC statement.
The operation of (2) is coded in the first modal RTM command (//1).
The operation of (3) is coded in the second modal RTM command (//2).
O0001 ;
G90 G00 X100 Z100;
//1 ZWHILE[1] ZDO ;
ZEDGE [#IOX[5,2] EQ 1 ] ZDO ;
G91 G00 A20. ;
ZEND ;
ZEND ;
//2 ZWHILE[1] ZDO ;
ZEDGE [ #100101 LE 50.0 ] #IOY[2,3] = 1 ;
ZEND ;
#100=100 ;
WHILE [ #100 GT 0 ]) DO1
G91 G01 Z-#100 F200. ;
Z#100. ;
#100 = #100 - 10 ;
X-10. F100;
END1
M02 ;
Workpiece
50
(Y signal is
turned on when
tool enters this
range.)
X
Z
RTM command ② operation
(On each rising edge of X5.2,
20 is fed on peripheral axis
.)
RTM command ③ operation
(When X coordinate is 50 o
less, Y signal 2.3 is set to 1.)
Command for cutting on
X-axis and Z-axis
Peripheral axis A
Signal switch
(Address X5.2)
Signal lamp
(Address Y2.3)