Installation manual

87
Programming
For Count/Next
This instruction is used to execute section of code a specific number of times.
Examples:
For Count = 1 to 5
Index.1.Initiate ‘Incremetal,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000 ‘seconds
Next
For Count = 1 To 10
Wait For ModuleInput.1 = ON
Index.0.Initiate ‘Incremetal,Dist=5.000in,Vel=50in/s
Wait For Index.AnyCommandComplete
ModuleOutput.1=ON ‘Turn ModuleOutput.1 On
Wait For Time 1.000 ‘seconds
ModuleOutput.1=OFF ‘Turn ModuleOutput.1 Off
Next
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.
Examples:
Do While ModuleInput.1=ON ‘Repeat the three lines of code below
‘as long as ModuleInput.1 is ON.
Index.1.Initiate ‘Incremental,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000 ‘seconds
Loop
Do While (ModuleInput.1=ON AND ModuleInput.2=OFF)
‘Repeat the three lines of code below
‘as long as ModuleInput.1 is ON and
‘ModuleInput.2=OFF.
Index.1.Initiate ‘Incremental,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000 ‘seconds
Loop
Do While (TRUE) ‘Repeat until the program is halted
Index.1.Initiate ‘Incremental,Dist=5.250in,Vel=10.0in/s