
B-63944EN/02 PROGRAMMING 17.REAL-TIME CUSTOM MACRO
- 511 -
Similarly, use ZDO...ZEND for a multi-statement including an axis
control command.
If the workpiece coordinate on the second axis is equal to or less than 10, a
movement on the V-axis starts and the Y1.0 signal is set to 1.
//1 ZONCE [#100102 LE 10.] ZDO ;
G91 G00 V10. ;
#IOY[1,0] = 1 ;
ZEND ;
17.4.2 Condition Transition (ZEDGE Statement)
After ZEDGE, <conditional-expression> and
<real-time-macro-statement> are coded.
// ZEDGE A B (If A becomes true, B is executed.)
- //(n) ZEDGE [<conditional-expression>] <real-time-macro-statement>
When <conditional-expression> makes a transition from false to true,
an RTM statement specified after <conditional-expression> is
executed. <conditional-expression> conforms to the custom macro
specifications.
With the ZEDGE command, the result of the first evaluation of
<conditional-expression> is always false.
Explanation
The difference between the ZONCE command and ZEDGE command
is that if <conditional-expression> is false, the RTM statement itself is
terminated in the case of ZONCE, while the evaluation of
<conditional-expression> continues until <conditional-expression>
becomes true in the case of ZEDGE. (With a one-shot real time
command, the evaluation of <conditional-expression> continues until
the execution of the NC statement that started operation
simultaneously with the command ends.)
On the rising edge of the G address signal 4.3, the workpiece coordinate on
the third axis is read.
// ZEDGE [#IOG[4,3] EQ 1] #RV[0]=#100103 ;
In the example above, even if the [#IOG[4,3] EQ 1] is true from the
beginning, #RV[0]=#100103 of the RTM statement is not executed.
#RV[0]=#100103 is executed when the result of evaluation of
[#IOG[4,3] EQ 1] changes from false to true.
As in the case of ZONCE, multiple RTM statements can be coded in
<real-time-macro-statement>.
If <conditional-expression-1> specifies an axis control command, be
sure to use ZDO...ZEND even when a single statement is used.
Code the following by using ZDO...ZEND of multi-statement
structure:
// ZEDGE [<conditional-expression>] ZDO ;
<real-time-macro-statement-1> ;