Difference between revisions of "TestIT:Programming Functions"

From Nolek Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
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.
 
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.
  
===5.3.1 Functions===
+
==5.3.1 Functions==
====5.3.1.1 If====
+
===If===
  
 
'''Description:''' <br />
 
'''Description:''' <br />
Line 36: Line 36:
 
|}
 
|}
  
====5.3.1.2 IfMinMax====
+
===IfMinMax===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
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.  
 
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.  
Line 65: Line 65:
 
|}
 
|}
  
====5.3.1.3 EndIf====
+
===EndIf===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It is used together with If or IfMinMax. It will stop the if code.
 
It is used together with If or IfMinMax. It will stop the if code.
Line 76: Line 76:
 
''No parameters''
 
''No parameters''
  
====5.3.1.4 Wait====
+
===Wait===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will wait until the time has run out or criteria is met.  
 
It will wait until the time has run out or criteria is met.  
Line 118: Line 118:
 
|}
 
|}
  
====5.3.1.5 Sub====
+
===Sub===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
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.  
 
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.  
Line 139: Line 139:
 
|}
 
|}
  
====5.3.1.6 EndSub====
+
===EndSub===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It is the end mark of a sub.  
 
It is the end mark of a sub.  
Line 150: Line 150:
 
''No parameters''
 
''No parameters''
  
====5.3.1.7GoSub====
+
===GoSub===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will jump to a specific sub.  
 
It will jump to a specific sub.  
Line 169: Line 169:
 
|}
 
|}
  
====5.3.1.8 Label====
+
===Label===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will set a fix point to jump to.
 
It will set a fix point to jump to.
Line 188: Line 188:
 
|}
 
|}
  
====5.3.1.9 GoLabel====
+
===GoLabel===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will jump to a specific label.
 
It will jump to a specific label.
Line 207: Line 207:
 
|}
 
|}
  
====5.3.1.10Delay====
+
===Delay===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will delay the program, for a specified time.
 
It will delay the program, for a specified time.
Line 230: Line 230:
 
|}
 
|}
  
====5.3.1.11 StopTest====
+
===StopTest===
 
'''Description:'''<br />
 
'''Description:'''<br />
 
It will go to EndSub() in main sub.  
 
It will go to EndSub() in main sub.  
Line 239: Line 239:
 
'''No parameters'''
 
'''No parameters'''
  
====5.3.1.12 NewPart====
+
===NewPart===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will clear the production window, the results, and prepare the production to run a new product.
 
It will clear the production window, the results, and prepare the production to run a new product.
Line 253: Line 253:
 
:<code>Function.GoLabel(lbl_newPart)</code>
 
:<code>Function.GoLabel(lbl_newPart)</code>
  
====5.3.1.13 IsValue====
+
===IsValue===
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will convert a symbol to a numeric value if it is possible.
 
It will convert a symbol to a numeric value if it is possible.
Line 279: Line 279:
 
|String value to test
 
|String value to test
 
|}
 
|}
 +
 +
[[TestIT:Programming#5.3_Commands|Back to Programming - Commands]]

Latest revision as of 15:14, 11 September 2019

5.3 Functions Window

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.

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

Back to Programming - Commands