Independent CNC repair and technical reference Contact

FANUC real-time macros ZONCE and ZEDGE: why no action occurs even though the condition later becomes true

Published Updated

An assumed 100-millisecond execution window compares ZONCE, ZEDGE and an initially true condition under 30i-A real-time macro rules. One-shot waiting lifetime and detection of short pulses are separate issues.

Contents
  1. Three rules determine the timing
  2. Put the wait inside a specific window
  3. Textual order does not determine window duration
  4. Which layer should be checked?

A real-time macro says “execute when the condition is met,” yet no action occurs when the condition later becomes true. There are at least two separate questions: whether the command evaluates once or waits for an edge, and whether its execution window has already ended.

Three rules determine the timing

The 30i/31i/32i-A common user manual B-63944EN/03, §17.1.1 and §17.4.1–17.4.2, pages 581 and 599–600 (public mirror of the original manual) specifies that ZONCE terminates when its condition is false; it does not wait for a later true result. ZEDGE waits for a false-to-true transition; an initially true condition is not a new edge. A one-shot RTM starts with the first subsequent NC command and remains valid until that NC command ends.

This article concerns one-shot statements in that edition's real-time custom macro function. Ordinary macro IF, modal RTM and PLC scan logic are not treated as the same mechanism. Function availability and signal mapping must match the actual controller configuration.

Put the wait inside a specific window

In an original logical example, the associated NC block starts at t=0 and ends at t=100 ms. “Action” means only logging a software event, with no signal output or axis movement. The table assumes that the listed condition changes have been effectively sampled.

Condition changesOne-shot ZONCEOne-shot ZEDGE
Initially false; becomes true at 60 ms and stays trueTerminates at the first false evaluationExecutes after detecting a rising edge within the window
Initially false; becomes true only at 120 msAlready terminatedThe 100 ms window has ended; no longer waits
Initially true; becomes false at 40 ms and true again at 70 msExecutes on the initially true conditionInitial true does not trigger; the later false→true transition does

The second row need not indicate an incorrect condition expression: the event is outside the validity period. The third distinguishes “the present state is true” from “a new edge was observed.” The former tests whether a state holds; the latter identifies a subsequent transition.

Textual order does not determine window duration

Placing a one-shot real-time macro earlier in the program does not by itself show that it starts waiting earlier. Identify the NC command that actually starts it. If monitoring must span several NC blocks, merely lengthening one block's expected duration does not establish reliable logic: override, stops and execution branches can change the timing relationship.

Also distinguish “the lifetime is long enough” from “sampling can observe the event.” With an assumed checking period of 4 ms, a 1 ms pulse can lie entirely between checks. This is a general sampling counterexample; 4 ms is not a claimed FANUC real-time macro cycle specification. ZEDGE is not a hardware-capture guarantee for arbitrarily short pulses.

Which layer should be checked?

If an initially false condition means no later execution, check for mistaken use of ZONCE. If a condition can trigger within a block but not after its end, check the one-shot lifetime. If only very short events are occasionally missed, examine the input chain and sampling. These phenomena have different causes and should not all be attributed to “macros not being real-time.” Further mechanism analysis is in the OPTION section.

Related technical articles

FANUC optional rotary-axis control: how the sign of an absolute command selects directionFANUC direction-dependent high-speed position switches: why one coordinate can give different outputsFANUC flexible synchronization: matching speed and aligning phase are separate conditions