Timer, Gear - subroutine – Yaskawa MotionWorks+ Windows Software User Manual

Page 197

Advertising
background image

MotionWorks+™

Standardized Template Project

191

Timer

The last few blocks (7-10) are com-
prised of SET VARIABLE and timer
blocks. Some special attention should
be brought up regarding the TIMER
block. The TIMER block, while it
has two OUT ports, the FALSE port
should always be looped back to the
IN port of the block. Time only accumulates while the block is being executed, thus the
need for the loop back. The timer may take additional time to complete if items are con-
nected between the FALSE port and the IN port. For example, if a block is inserted
between the FALSE port and the return to the TRUE port, and it takes one scan to execute
that block, the amount of time will be doubled. One last thing to remember about the
Timer block is that the time value in it is retentive. In other words, if the timer starts tim-
ing and for some reason gets interrupted, (program is halted, etc.) upon re-entering said
timer block it will finish timing.

There is an alternative way to construct a timer using the system variable mTime, which
counts milliseconds. Capture the value of mTime in a SET VARIABLE block. In the next
block, an IF EVENT block, compare if mTime > CaptureTime + DesiredTime. While that
condition is false, the program can monitor other events and return to the IN port of the IF
EVENT block. Be careful with this method, as the timed value can vary if there is a lot of
logic between the FALSE port and the return to the IN port.

Gear - Subroutine

The Gear subroutine is fairly straightforward, for discussion purposes it is broken down
into two sections. The two sections include: Engaging/Disengaging, and Running.

Advertising