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
- 1 5.3.1 Functions
- 2 5.3.2 Functions
- 2.1 Move
- 2.2 Set
- 2.3 Reset
- 2.4 SetUniqueID
- 2.5 GetUniqueID
- 2.6 AddResult
- 2.7 AddResultValidate
- 2.8 ValidateObject
- 2.9 IsNewProduct
- 2.10 IsDeviceActive
- 2.11 GetBatchNumber
- 2.12 GetProductName
- 2.13 GetCurrentLanguage
- 2.14 GetTestCountOK
- 2.15 GetTestCountNOK
- 2.16 GetUserName
- 2.17 GetGuideObjectID
- 2.18 StartFlash
5.3.1 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()
| 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 |
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 | ||
|---|---|---|
| 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 | ||
|---|---|---|
| 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 |
Sub
Description:
It is used to split the program up in smaller programs. The main sub is the sub which TestIT always starts in. The program cannot run if there is no main sub. It must always end with an EndSub.
Code example:
Function.Sub(1000)'Execute this sub routine
Function.EndSub()
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Sub name | String | Name of the sub. Must be unique in the program |
EndSub
Description:
It is the end mark of a sub.
Code example:
Function.Sub(1000)'Execute this sub routine
Function.EndSub()
No parameters
GoSub
Description:
It will jump to a specific sub.
Code example:
Function.GoSub(1000)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Sub name | String | Name of the sub. |
Label
Description:
It will set a fix point to jump to.
Code example:
Function.Label(startLoop)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Label name | String | Name of the label. Must be unique within the sub |
GoLabel
Description:
It will jump to a specific label.
Code example:
Function.GoLabel(startLoop)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Label name | String | Name of the label |
Delay
Description:
It will delay the program, for a specified time.
Code example:
Function.Delay(30,S)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Delay time | Int or Int symbol | Delay time |
| Time unit | String | Time unit |
StopTest
Description:
It will go to EndSub() in main sub.
Code example:
Function.StopTest()
No parameters
NewPart
Description:
It will clear the production window, the results, and prepare the production to run a new product.
Code example:
Function.NewPart()
No parameters
The command is often used together with a label that jumps to the beginning of the program.
Code example:
Function.NewPart()Function.GoLabel(lbl_newPart)
IsValue
Description:
It will convert a symbol to a numeric value if it is possible.
Code example:
Function.IsValue(_D01,_B01,_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Double symbol | Value or symbol to use |
| IsValue | Bool symbol | Time unit |
| ValueToTest | String or String symbol | String value to test |
5.3.2 Functions
Move
Description:
It will move a value into a symbol.
Code example:
Misc.Move(_IN01,2)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Symbol | Int symbol or Double symbol | Symbol to move value to |
| Value | Int, Double, Int symbol or Double symbol | Value to move into symbol |
Set
Description:
It will set symbols in symbol array to true.
Code example:
Misc.Set(_B01;_B02;_B03)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Bool Symbols | Symbol array | Bool symbols to set |
Reset
Description:
It will reset symbols in symbol array to false.
Code example:
Misc.Reset(_B01;_B02;_B03)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Bool Symbols | Symbol array | Bool symbols to reset |
SetUniqueID
Description:
It will set the Unique ID to the value. The Unique ID will be logged together with results in the database.
Code example:
Misc.SetUniqueID(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Unique ID | String symbol | Unique ID |
GetUniqueID
Description:
It will return a Unique ID for the Unique ID Device. The Unique ID will be logged together with results in the database.
Code example:
Misc.GetUniqueID(Unique,_ST01,_B01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Device name | String or String symbol | The device name |
| Unique ID | String symbol | Receive the unique ID from the device |
| Set as Object ID | Bool symbol | If true, the Object ID in the production will be set to this unique ID. If Object ID is selected, max length is 50 |
AddResult
Description:
It will add a result to the production window. If LogToDB is set to true, the result will be logged to the database as well.
All the results which are logged in the database can be found in Report/Results.
Code example:
Misc.AddResult(1010,"Leak result","Result from S9",_ST01,LeakResult,"Pa",0,2,3,ObjectStatus,AlwON)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Number | Int or Int symbol | Result number |
| Result name | String or String symbol | Result name (Max 50 char) |
| Description Short | String or String symbol | Description Short (Max 50 char) |
| Description Long | String or String symbol | Description Long (Max 250 char, is not shown on screen) |
| Result Symbol | Number symbol | Symbol value will be logged as result |
| Unit | String or String symbol | String to describe the unit |
| Min | Int, Double, Int symbol or Double symbol | Minimum value |
| Max | Int, Double, Int symbol or Double symbol | Maximum value |
| Icon | Int | Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning) |
| Object Status | Bool symbol | Symbol value will be logged as overall result |
| LogToDB | Bool symbol | Log to database if true |
AddResultValidate
Description:
It will add a result to the production window and validate OK/NOK. If LogToDB is set to true, the result will be logged to the database as well. It will show the OK/NOK icon according to the validation and set the object status as well.
All the results which are logged in the database can be found in Report/Results.
Code example:
Misc.AddResultValidate(1010,"Leak result","Result from S9",_ST01,LeakResult,"Pa",0,2,3,2,ObjectStatus,AlwON)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Number | Int or Int symbol | Result number |
| Result name | String or String symbol | Result name (Max 50 char) |
| Description Short | String or String symbol | Description Short (Max 50 char) |
| Description Long | String or String symbol | Description Long (Max 250 char, is not shown on screen) |
| Result Symbol | Number symbol | Symbol value will be logged as result |
| Unit | String or String symbol | String to describe the unit |
| Min | Int, Double, Int symbol or Double symbol | Minimum value |
| Max | Int, Double, Int symbol or Double symbol | Maximum value |
| IconOK | Int | Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning) |
| IconNOK | Int | Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning) |
| Object Status | Bool symbol | Symbol value will be logged as overall result |
| LogToDB | Bool symbol | Log to database if true |
ValidateObject
Description:
It will validate the status of the actual object and show the Icons Good or Bad in the production window.
Code example:
Misc.ValidateObject(ValidationResult,ObjectResult,3,Retest,Lamp01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol | Symbol to receive result [1:Retest,2:Can retest,3:Max retest,4:Failed,5:TestOK] |
| Object result | Bool symbol | Symbol representing the object status |
| Max retest | Int or Int symbol | Max retest count |
| Actual test count | Int symbol | Symbol to hold actual retest count |
| Object Failed | Bool symbol | Set true if failed. Can turn on indicator if failed |
IsNewProduct
Description:
It will return a Boolean whether the current product is running for the first time or not
Code example:
Misc.IsNewProduct(_B01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| IsNewProduct | Bool symbol | Symbol for is new product |
IsDeviceActive
Description:
It will check if the device is set to active.
Code example:
Misc.IsDeviceActive(_B01, _ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Bool symbol | True if device is active |
| Device name | String or String symbol | Name of the device |
GetBatchNumber
Description:
It will return the current batch number.
Code example:
Misc.GetBatchNumber(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Receive current batch number |
GetProductName
Description:
It will return the current product name.
Code example:
Misc.GetProductName(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Receive current product name |
GetCurrentLanguage
Description:
It will return the language TestIT is set to.
Code example:
Misc.GetCurrentLanguage(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Get current language code |
GetTestCountOK
Description:
It will return the current OK test count.
Code example:
Misc.GetTestCountOK(_IN01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol | Receive current OK test count |
GetTestCountNOK
Description:
It will return the current NOK test count.
Code example:
Misc.GetTestCountNOK(_IN01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol | Receive current NOK test count |
GetUserName
Description:
It will return the username of the active user.
Code example:
Misc.GetUserName(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Receive current user name |
GetGuideObjectID
Description:
It will return the object ID from the current guide.
Code example:
Misc.GetGuideObjectID(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Receive current guide objectID |
StartFlash
Description:
It will start flashing a bool symbol, and continues the code.
Code example:
Misc.StartFlash(_B01,500,1000,MS,_B02)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Symbol to flash | Bool symbol | Symbol to flash |
| On time | Int or Int symbol | Length of on/set state |
| Off time | Int or Int symbol | Length of off/reset state |
| Time unit | String | Time unit |
| Stop flash symbol | Bool symbol | Set symbol to stop flash |