Link Type: |
TimerSt/Exp (T, hex 0x54, dec 84) - Start Timer/Timer Expired |
Link Value: |
0 to start timer, otherwise timer preset in milliseconds |
Range: |
0 to start timer, or 1 to 65,535 milliseconds |
Note: This feature is supported in RMC100 CPU firmware dated 20010420 or later.
These link types are used to start a timer and to wait for the timer to reach a preset. The DelayMS (D) link type offers similar functionality. However, while the DelayMS link type starts the timer when the event step is reached, the Timer (T and t) link types separate the starting and checking of the timer into two or more steps. This allows the following capabilities that are not available using the Delay (D) link type:
The timer can be started at the beginning of a sequence of steps and checked after the sequence has completed. In effect, this timer can be used to check how much time has passed since the beginning of a section of the process rather than simply pausing for a fixed amount of time as the DelayMS (D) link type does. See Example 1 below.
The Timer (T and t) link types can be used in a polling loop. See the Poll (?) command for details. One common use for polling link types is to keep track of a timeout. The DelayMS (D) link type does not work in these situations because it restarts its timer each time that step is reached. See Examples 2 and 3 below.
The Timer (T and t) link types allow multiple times to be checked since the beginning of a process. That is, the timer can be started at the beginning of a cycle. Then, later in the process, two or more Timer (T) link types can be used with different values to trigger events at different times since the beginning of the cycle. See Example 4 below.
To support these various features, the Timer (T and t) link types come in three forms. Details for entering these forms into an Event Step table are given at the end of this topic.
To start the timer, use a TimerSt/Exp (T) link type with a 0 link value. This will start the timer on the axis currently running this event sequence. This type should not be used with the Poll (?) command. See all four examples below.
To follow the link if the timer has reached its preset, use a TimerSt/Exp (T) link type with the preset value in milliseconds in the link value. This type can be used either with or without the Poll (?) command.
When used with the Poll (?) command, the link will jump to the Link Next step if the timer has reached its preset, and will otherwise jump to the next step in the sequence. See Example 2 below.
When used without the Poll (?) command, the link will wait until the timer reaches the preset value and then jump to the Link Next step. See Examples 1 and 4 below.
To follow the link if the timer has not reached its preset, use a TimerNExp (t) link type with the preset value in milliseconds in the link value. This type should only be used with the Poll (?) command, because using it without the Poll (?) command causes the link to wait until the timer is not expired, which is almost never the desired behavior. See Example 3 below.
There is one timer per axis. The Timer (T and t) link types use the timer of the axis running the current event sequence. Therefore, it is possible to have as many timers running as axes are available, but no more. However, the timer used by this link type is separate from the timer used by the DelayMS (D) link type. Therefore, it is possible to have one or more DelayMS (D) link types in a process that is also being timed by a Timer (T or t) link type.
Note: This timer is only accurate to within one control loop (1 or 2 ms). For example, if a Timer (T) link type is used with a preset of one millisecond, then the link may be taken either on the first control loop or the second control loop of an RMC with a one-millisecond control loop. This will not affect most applications since much larger timeouts will be used with lower resolution requirements.
Example 1:
In this example, the user wants to make two moves, wait for each to complete, and then wait until ten seconds has passed since the beginning of the cycle before repeating.
|
Step 10 |
Step 11 |
Step 12 |
Step 13 |
Mode |
0x0000 |
0x0081 |
0x0081 |
0x0000 |
Accel |
0 |
100 |
100 |
0 |
Decel |
0 |
100 |
100 |
0 |
Speed |
0 |
10000 |
10000 |
0 |
Command Value |
0 |
4000 |
8000 |
0 |
Command |
|
G |
G |
|
Commanded Axes |
Default |
Default |
Default |
Default |
Link Type |
TimerSt/Exp |
BitsON |
BitsON |
TimerSt/Exp |
Link Value |
0 |
0x0001 |
0x0001 |
10000 |
Link Next |
11 |
12 |
13 |
10 |
Step 10 starts the timer and links immediately to step 11.
Step 11 starts a move to the first position and waits for the axis to get in position using the BitsON (B) link type, at which time control moves to step 12.
Step 12 starts a move to the second position and waits for the axis to get in position using the BitsON (B) link type, at which time control moves to step 13.
Step 13 waits for the timer to reach ten seconds, at which time control jumps back to step 10.
Example 2:
In this example, the user wants to move to a position, but if the axis does not get in position within five seconds, he/she wants to turn on discrete output 0. The following sequence accomplishes this:
|
Step 10 |
Step 11 |
Step 12 |
Step 13 |
Step 14 |
& |
Mode |
0x0081 |
0x0081 |
0x0081 |
0x0081 |
0x0000 |
|
Accel |
100 |
100 |
100 |
100 |
0 |
|
Decel |
100 |
100 |
100 |
100 |
0 |
|
Speed |
10000 |
10000 |
10000 |
10000 |
0 |
|
Command Value |
4000 |
0 |
0 |
0 |
0x0001 |
|
Command |
G |
? |
? |
|
[ |
|
Commanded Axes |
Default |
Default |
Default |
Default |
Default |
|
Link Type |
TimerSt/Exp |
BitsON |
TimerSt/Exp |
DelayMS |
DelayMS |
|
Link Value |
0 |
0x0001 |
5000 |
0 |
0 |
|
Link Next |
11 |
15 |
14 |
11 |
15 |
|
Step 10 initiates the move to 4000, starts the timer, and links immediately to step 11.
Step 11 checks the In Position bit of the Status Word using the BitsON (b) link type. Therefore, if the axis is in position, then the link is taken to step 15. Otherwise, control passes to step 12.
Step 12 checks if 5000 ms (five seconds) have expired since the timer was started in step 10. If the timer is expired, then control passes to step 14. Otherwise, control passes to step 13.
Step 13 immediately links back to step 11 to restart the polling loop. Notice that this extra step does take one control loop to process and therefore increases the time taken to process the entire polling loop by one control loop (1 or 2 ms).
Step 14 handles the timeout condition by turning on discrete output 0.
Now, compare this method of implementing a timeout with the one used in the next example, which is a little more difficult to follow but removes the need for the extra do-nothing step in the polling loop (step 13 above).
Example 3:
This example offers an alternative approach to the same problem as Example 2: the user wants to make a move and wait for the move to complete or a timeout to occur. It is a little more difficult to follow, but removes one step from the polling loop, therefore reducing the amount of time taken to catch any condition. Keep in mind that for many applications, this slight gain in performance will not justify the reduction in clarity.
|
Step 10 |
Step 11 |
Step 12 |
Step 13 |
& |
Mode |
0x0081 |
0x0081 |
0x0081 |
0x0000 |
|
Accel |
100 |
100 |
100 |
0 |
|
Decel |
100 |
100 |
100 |
0 |
|
Speed |
10000 |
10000 |
10000 |
0 |
|
Command Value |
4000 |
0 |
0 |
0x0001 |
|
Command |
G |
? |
? |
[ |
|
Commanded Axes |
Default |
Default |
Default |
Default |
|
Link Type |
TimerSt/Exp |
BitsON |
TimerNExp |
DelayMS |
|
Link Value |
0 |
0x0001 |
5000 |
0 |
|
Link Next |
11 |
14 |
11 |
14 |
|
Step 10 initiates the move to 4000, starts the timer, and links immediately to step 11.
Step 11 checks the In Position bit of the Status Word using the BitsON (b) link type. Therefore, if the axis is in position, then the link is taken to step 14. Otherwise, control passes to step 12.
Step 12 checks if 5000 ms (five seconds) have expired since the timer was started in step 10. Notice that, this time, the Timer Not Expired (t) link type is used. Therefore, if the timeout has not occurred, then control jumps back to step 11. If the timeout has occurred, then control passes to step 13.
Step 13 handles the timeout condition by turning on discrete output 0.
Here is a summary of the advantages and disadvantages of doing a polled loop using this method versus the method shown in Example 2:
The advantage of this method is that the timeout and the In Position bit will be checked every two control loops since there are only two steps in the polling loop (steps 11 and 12).
The disadvantage of this method is that many users will find it confusing to have to reverse the sense of the last condition in the polling loop. That is, the user has to use the Timer Not Expired (t) link type instead of the more intuitive Timer Expired (T) link type. This situation is not unique to using the Timer link types, but will occur with any series of polling link types for the last condition in the polling cycle.
Example 4:
In this example, the user wants to complete a move, and then turn on and off discrete output 0 at five and ten seconds respectively since the start of the move.
|
Step 10 |
Step 11 |
Step 12 |
Step 13 |
Step 14 |
Mode |
0x0000 |
0x0081 |
0x0000 |
0x0000 |
0x0000 |
Accel |
0 |
100 |
0 |
0 |
0 |
Decel |
0 |
100 |
0 |
0 |
0 |
Speed |
0 |
10000 |
0 |
0 |
0 |
Command Value |
0 |
4000 |
0 |
0x0001 |
0x0001 |
Command |
|
G |
|
[ |
] |
Commanded Axes |
Default |
Default |
Default |
Default |
Default |
Link Type |
TimerSt/Exp |
BitsON |
TimerSt/Exp |
TimerSt/Exp |
DelayMS |
Link Value |
0 |
0x0001 |
5000 |
10000 |
0 |
Link Next |
11 |
12 |
13 |
14 |
0 |
Step 10 starts the timer and links immediately to step 11.
Step 11 starts the move and waits for the move to complete using the BitsON (B) link type before linking to step 12.
Step 12 waits until five seconds have expired since the timer was started in step 10 before linking to step 13.
Step 13 turns on discrete output 0 and waits until ten seconds have expired since the timer was started in step 10 before linking to step 14.
Step 14 turns discrete output 0 back off before linking back to step 0.
Using with the Link Type and Link Value Dialog Box
Under Link Type Category, select System-wide (Basic, non-axis).
Under Link Type, select Timer.
Under Link Condition, select one of the following:
If you want to start the timer, select Start the Timer and Link to the Link Next.
If you want to take the link when the timer reaches or passes its preset, select Link if the Timer is Expired.
If you want to take the link when the timer has not yet reached its preset, select Link if the Timer is Not Expired. This is only useful when used with the Poll (?) command.
If you selected either the second or third option above, then type the preset (timeout) value in the Timer Value text box.
Click OK.
Using without the Link Type and Link Value Dialog Box
Enter a Link Type:
If you want to start the timer, enter 'T'.
If you want to take the link when the timer is expired, enter 'T'.
If you want to take the link if the timer is not expired, enter 't'. This is only useful when used with the Poll (?) command.
Enter a Link Value
If you want to start the timer, enter 0.
Otherwise, enter the preset value in milliseconds.
See also:
Copyright (c) 1997-2015 by Delta Computer Systems, Inc.