Difference between revisions of "TestIT:Programming Functions"

From Nolek Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 +
==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.
 
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.
 
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.
 
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===
===If===
+
====5.3.1.1 If====
 +
 
 
'''Description:''' <br />
 
'''Description:''' <br />
 
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.
 
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.
Line 33: Line 36:
 
|}
 
|}
  
===IfMinMax===
+
====5.3.1.2 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 62: Line 65:
 
|}
 
|}
  
===EndIf===
+
====5.3.1.3 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 73: Line 76:
 
''No parameters''
 
''No parameters''
  
===Wait===
+
====5.3.1.4 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 115: Line 118:
 
|}
 
|}
  
===Sub===
+
====5.3.1.5 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 136: Line 139:
 
|}
 
|}
  
===EndSub===
+
====5.3.1.6 EndSub====
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It is the end mark of a sub.  
 
It is the end mark of a sub.  
Line 147: Line 150:
 
''No parameters''
 
''No parameters''
  
===GoSub===
+
====5.3.1.7GoSub====
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will jump to a specific sub.  
 
It will jump to a specific sub.  
Line 166: Line 169:
 
|}
 
|}
  
===Label===
+
====5.3.1.8 Label====
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will set a fix point to jump to.
 
It will set a fix point to jump to.
Line 185: Line 188:
 
|}
 
|}
  
===GoLabel===
+
====5.3.1.9 GoLabel====
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will jump to a specific label.
 
It will jump to a specific label.
Line 204: Line 207:
 
|}
 
|}
  
===Delay===
+
====5.3.1.10Delay====
 
'''Description:''' <br />
 
'''Description:''' <br />
 
It will delay the program, for a specified time.
 
It will delay the program, for a specified time.
Line 227: Line 230:
 
|}
 
|}
  
===StopTest===
+
====5.3.1.11 StopTest====
 
'''Description:'''<br />
 
'''Description:'''<br />
 
It will go to EndSub() in main sub.  
 
It will go to EndSub() in main sub.  
Line 236: Line 239:
 
'''No parameters'''
 
'''No parameters'''
  
===NewPart===
+
====5.3.1.12 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 250: Line 253:
 
:<code>Function.GoLabel(lbl_newPart)</code>
 
:<code>Function.GoLabel(lbl_newPart)</code>
  
===IsValue===
+
====5.3.1.13 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.

Revision as of 13:47, 10 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

5.3.1.1 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

5.3.1.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

5.3.1.3 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

5.3.1.4 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

5.3.1.5 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

5.3.1.6 EndSub

Description:
It is the end mark of a sub.

Code example:

Function.Sub(1000)
'Execute this sub routine
Function.EndSub()

No parameters

5.3.1.7GoSub

Description:
It will jump to a specific sub.

Code example:

Function.GoSub(1000)
Parameters
Parameter Type Description
Sub name String Name of the sub.

5.3.1.8 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

5.3.1.9 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

5.3.1.10Delay

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

5.3.1.11 StopTest

Description:
It will go to EndSub() in main sub.

Code example:

Function.StopTest()

No parameters

5.3.1.12 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)

5.3.1.13 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