valid range for the numbers provided is 0 to 2147483647.
Example:
For Count = 1 to 5
Index.1.Initiate
Dwell For Time 1.000 'seconds
Next
Example:
For Count = 1 To 10
Wait For ModuleInput.1 = ON
Index.0.Initiate
Wait For Index.AnyCommandComplete
EZOutput.1=ON
Wait For Time 1.000 'seconds
EZOutput.1=OFF
Next
8.4.1.4 Do While/Loop
This program instruction is used for repeating a sequence of code as long as an expression is true. To loop forever use "TRUE" as the test expression as shown in the third example below. The test expression is tested before the loop is entered. If the test expression is evaluated as False
(0) the code in the loop will be skipped over.
Logical tests (AND, OR, NOT) can be used in the Do While/ Loop instruction. Parenthesis "()" can be used to group the logical tests.
Example:
Do While EZInput.1=ON
Index.1.Initiate
Dwell For Time 1.000 'seconds
Loop
Example:
Do While (Slot2.Input.4=ON AND
Slot2.Input.4=OFF)
Index.1.Initiate
Dwell For Time 1.000 'seconds
Loop
Example:
Do While (TRUE)
Index.1.Initiate
Dwell For Time 1.000 'seconds
Loop
8.4.1.5 Wait For
This program flow instruction is used to halt program execution until an expression becomes true. Once the expression becomes true the program continues on with the next line of code.
Logical tests (AND, OR, NOT) can be used in the Wait For instruction. Output events (EZ=ON, AtVel, etc.) as well as comparisons (PosnFeedback > 1234, VelFeedback < 100, etc.) can be used in a Wait For instruction.
Example:
Wait For (EZInput.1=ON AND
EZInput.2=OFF)
Index.0.Initiate
Example:
Wait For Index.AnyCommandComplete
If (EZInput.2=ON) Then
Jog.0.PlusInitiate 'Vel=20in/s
Wait For EZInput.2=OFF
Jog.Stop
Endif
If (SPInput.6=ON) Then
Jog.0.MinusInitiate 'Vel=20in/s
Wait For SPInput.6=OFF
Jog.Stop
Endif
Example:
Wait For (MasterAxis.PosnFeedback >
1000.00)
EZOutput.1 = ON
Example:
Wait For (VelFeedback > 50.00)
EZOutput.2 = ON
8.4.1.6 Wait For Time
This program instruction is used to halt program execution for a specified period of time. This instruction is not a motion instruction and can be used while a motion instruction is executing.
Units: Seconds, Resolution: 0.001 seconds
A comment is automatically inserted after the "Wait For Time" instruction which notes that the time is in units of seconds. The comment starts with the apostrophe ' character.
The accuracy of the Wait For Time instruction is dependant on the Trajectory Update Rate found on the Setup view. The actual accuracy for this instruction is +/- 1 Trajectory Update. Therefore, if the Trajectory Update Rate is set to 2msec, then the
Example:
Wait For Time 5.000 'seconds
Do While (TRUE)
Index.1.Initiate
Wait For AtVel
EZOutput.1=ON
Wait For Time 1.000 'seconds
EZOutput.1=OFF
Wait For Index.AnyCommandComplete
Loop
8.4.1.7 Call Program
This program flow instruction is used to call another program. When the called program finishes the controller
How User Programs Work | www.emersonct.com | 69 |