
Ed. Date Design Description
Date Jan.07.’04 Design. Apprv.
page
-
27/64
FANUC Series 30i-MODEL A
Real time custom macro
A-79350EN
Title
Draw
No.
Conditional branch (ZONCE statement)
After ZONCE, <conditional-expression> and <real-time-macro-statement> are coded.
//(n) ZONCE [<conditional-expression>] <real-time-macro-statement>
If <conditional-expression> is true, <real-time-macro-statement> is executed. If
<conditional-expression> is false, <real-time-macro-statement> is not executed, but
control exits from the ZONCE command to terminate the execution.
<conditional-expression> conforms to the custom macro specifications.
// ZONCE A B (If A is true, B is executed.)
If A is true, the command is terminated after executing B.
If A is false, the command is terminated without executing B.
If the workpiece coordinate on the first axis is greater than 30, the Y1.0
signal is output.
// ZONCE [#100101 GT 30.] #IOY[1,0] = 1 ;
If the workpiece coordinate on the first axis is greater than 30 and #RV[0]
matches #RV[3], the Y1.0 signal is output.
// ZONCE[[#100101 GT 30.] AND [#RV[0] EQ #RV[3]]] #IOY[1,0]=1 ;
In <real-time-macro-statement>, multiple RTM statements can be coded.
In this case, code the following by using ZDO...ZEND of multi-statement structure:
// ZONCE [<conditional-expression>] ZDO ;
<real-time-macro-statement-1> ;
<real-time-macro-statement-2> ;
:
ZEND ;
If the workpiece coordinate on the second axis is equal to or less than 10,
the rapid traverse override value is changed.
// ZONCE [#100102 LE 10.] ZDO ;
#IOG[14,0]=0 ;
#IOG[14,1]=1 ;
ZEND ;