TestIT:Programming Functions
The function window encompasses all the codes, which can be inserted in the program. To get information about the function, then, press on the wanted line and use the info button. When a function is going to be created, the wanted function can be selected, or if the code is known then it is possible to write it. To get help with filling in the function, the Config button can be selected and it will show the parameters. In symbol handler, it is possible to add a symbol, and it is also possible to insert a symbol in the function. To insert a symbol, just double-click on the wanted symbol.
Contents
5.3 Functions
If
Description:
Evaluates a statement and continues if true and skips if it is not true. It compares two values and is always used together with EndIf.
Code example:
Function.If(_B01,=,1)'Code will only be executed if _B01 = 1
Function.EndIf()
IfMinMax
Description:
Evaluates a value against a min. and max. It continues if the value is between the min. and max, and skips if it is not.
Code example:
Function.IfMinMax(_IN01,1,5)'Code will only be executed if _IN01 is between 1 and 5
Function.EndIf()
Parameters:
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Value/Symbol to compare | Number or number symbol | Value 1 |
| Min value | Number or number symbol | Minimum value |
| Max value | Number or number symbol | Maximum value |
EndIf
Description:
It is used together with If or IfMinMax. It will stop the if code.
Code example:
Function.If(_B01,=,1)'Code will only be executed if _B01 = 1
Function.EndIf()
No parameters
Wait
Description:
It will wait until the time has run out or criteria is met.
Code example:
Function.Wait(_D01,>,10,30,S,_TO01)Function.If(_TO01, =, 1)'Code will enter if wait times out
Function.EndIf()
Parameters:
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Criteria1 | Number or number symbol | Value 1 |
| Sign | Sign | Select sign to use for comparison. Must be (<,>, <>,=, >=, ⇐) |
| Criteria2 | Number or number symbol | Value 2 |
| Timeout | Int or Int symbol | Time before command times out |
| Time unit | String | Select the time unit from the list |
| Timeout active | Bool symbol | True if wait command times out |