Safet
Introducti
Inst
Pow
Pro Sof
C
How
How
C
S
S
Pa
rameter
Dr
iv
Di
agn
Gl
ossary
Inde
EZMotion User/Programming Guide
161
Revision A8
www.controltechniques.com
Call Program
This program flow instruction is used to call another program. When the called program finishes the controller picks up where
it left off in the program that called it. This is often used when a section of code is used in multiple places in a program. By
moving the code to another program and then calling that program, the total number of program lines can be reduced. This
can also make the program easier to understand. Care should be taken not to "nest" more than four program calls due to
processor stack overflow. Therefore, no more than four different programs should be called without returning to the original
program.
In the diagram below, => Represents a Call Program instruction.
Example:
Call Program.10
‘Program 10 contains a complex home
‘routine.
Example:
Call Program.100
‘Program 100 contains a “teach position”
‘routine.
Case
When the Switch Instruction value and the case number instruction match, all the instructions that follow the case instruction
up to a Break or EndSwitch are executed. This includes instructions following the next Case instructions and the default
instruction found. Duplicate "Case numbers" are not allowed.
Default:
The default is an optional statement within the switch instruction. It must follow all the case instruction within a Switch
instruction. When none of the case instruction numbers match the switch expression value the program instructions following
the Default instruction are executed. They are also executed if there is no break instruction in the previous case statements
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
Else
This program flow instruction is used in conjunction with the If/Then/Endif instruction. If the If/Then test condition evaluates to
true the code after the If/Then and before the Else is executed. If the test evaluates to false the code between the Else and the
Endif is executed.
Example:
If EZInput.1=ON Then
EZOutput.1=ON
EZOutput.2=OFF
Else
EZOutput.1=OFF
EZOutput.2=ON
Endif
Example:
If (SPInput.5=ON) Then
Jog.0.Vel = 1.0 'in/s
Else
Jog.0.Vel = 0.1 'in/s
Endif
Program0=>Program1=>Program2=>Program3=>Program4 => NO MORE THAN 4!
Summary of Contents for EZMotion
Page 2: ......
Page 12: ...x EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 18: ...6 EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 36: ...24 EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 158: ...146 EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 186: ...174 EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 266: ...256 EZMotion User Programming Guide www controltechniques com Revision A8 ...
Page 267: ......