This example illustrates how to create a time-out. After issuing a move command, the user program has a time-out period (this example will use 5000 milliseconds) in which the axis must reach position. If the axis does not reach position within the time-out period, a discrete output turns on. If the axis does reach position within the time-out period, a different discrete output turns on.
This example makes use of the _SysMS tag. The _SysMS tag holds the number of milliseconds since the RMC powered up. It is a 32-bit DINT, and will wrap around to -2147483648 after it reaches its maximum value of 2147483647.
If you need a time-out that tracks values less then one millisecond (e.g. the loop time is less then one millisecond), then you may wish to use the _Controller.SysTime_usec tag instead, which has units of microseconds.
Example
Define a Variable
Define a variable, called StartTime. Define it as a DINT:
Write a User Program
The User Program will consist of the following:
Turn off the discrete outputs.
Set the StartTime variable to the current value of the _SysMS.
Issue the move.
Wait until either the axis gets into position, or 5000 milliseconds have passed since the move was issued. Jump to the correct step based on which of these events occurs first. The step that is jumped to will set one of the discrete outputs to indicate whether a time-out occurred or the axis reached position successfully.
See Also
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion