"Stopwatch" instruction
This instruction is used to measure a time during the execution of the part-program.
The time measured is accurate to two thousandths of a second.
It is possible to integrate up to 5 stopwatches into a part-program. These are numbered according to the position of the instruction that starts the stopwatch in the program, so stopwatch n°1 is the one that is placed at the top of the program, the stopwatch placed at the bottom will be n°2 etc.
The feedback variable of this stopwatch corresponds to the time that elapsed between the start and stop of the stopwatch. This time is returned in TIME format (in [ms]).
The reset function stops the stopwatch and resets its value.
Use of the instruction
To use the stopwatch instruction, you must first declare a variable of type "TIME" to be able to view the time value (see figure 1). You can activate the visualization using the "visualize" button on the main menu.
Figure 1: Declaration of the stopwatch feedback variable
Then, you must place the instruction in the part-program where you want to start, stop and reset the stopwatch.
You must also, in the variable line, select the "TIME" return variable created previously.
Figure 2: Using the stopwatch instruction
Below is a list of the instruction's input and output parameters:
Parameter name |
Declaration |
Type of data |
Default value |
Description |
---|---|---|---|---|
Function |
Input |
-- |
Start |
Start, stop or reset the stopwatch value |
Variable [ms] |
Output |
TIME |
-- |
Elapsed time |
Table 1: List of instruction parameters
Warning, if no stop or reset is programmed, the chronometer value will continue to increase until its value reaches 2,000,000,000,000 ms.
Example of use: In this example, we want to measure over several cycles of a program, the time required to achieve an absolute positioning of 2.5mm. ![]() Figure 3: Using the stopwatch instruction |