$FAST_CLOCK

  • Hey, all. I've inherited an R30iB Mate that has some BG Logic I'm trying to figure out, that makes use of $FAST_CLOCK:

    Code
    IF (F[7]=ON AND DO[112]=OFF) THEN ;
      GO[1]=6 ;
      IF (DO[111]=OFF),R[9]=($FAST_CLOCK) ;
      IF ($FAST_CLOCK<=R[9]),DO[111]=(ON) ;
      IF (DI[102]=OFF),DO[111]=(OFF) ;
    ENDIF ;

    F7, DO102, and DO112 are controlled from the "foreground" program.


    Now, if I'm reading this correctly, DO111 will only turn On once $FAST_CLOCK rolls over the top, which seems like it would be a huge time delay. However, I can't find any references on $FAST_CLOCK's max and min values, and how/when it rolls over -- the System Variables manual shows all these as "Not Available" :icon_rolleyes:.


    But watching this program run, DO111 is coming on almost immediately after F7 is set On and DO112 is set Off. So there must be something about $FAST_CLOCK that I'm not understanding correctly.


    I have done a full program dump and confirmed that DO111 is not turned On from any other logic in the controller.

  • I'm guessing that since there is a <= for the fast clock evaluation, it is evaluated true immediately.


    I think $FAST_CLOCK is an integer, so its max and min should be +/- 2 billion.


    Is DO[111] set to the complementary for DO[112]?

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • I'm guessing that since there is a <= for the fast clock evaluation, it is evaluated true immediately.

    D'oh! I should have realized that. Of course, that raises the question of why the original programmer used any of this logic anyway.

    Is DO[111] set to the complementary for DO[112]?

    Nope, completely independent signals. DO[112] and the Flags are controlled by the foreground task, but DO[111] is only controlled from the BG. The idea seems to be that the foreground task could trigger this handshake cycle with a remote device by setting the Flag and DO[112], then the BG would handle turning on DO[111], then turning it off once the handshake came back on DI[102].

Advertising from our partners