4.4
Program Instruction Types
4.4.1
Program Flow Instructions
Break
For Switch instruction, break stops the instruction execution flow and continues execution after the EndSwitch instruction. A
break is required to prevent the Case instruction flow continuing the executing through to the next case or default instructions.
For "Do While" instruction, break stops the instruction execution flow and continues execution after the Loop instruction.
For the "For Count" instruction, break stops the instruction execution flow and continues execution after the Next instruction.
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 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
Program0=>Program1=>Program2=>Program3=>Program4 => NO MORE THAN 4!
Example:
Call Program.10
Example:
Call Program.100
Case:
When the Switch expression 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 number" 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 DriveInput.1=ON
Index.1.Initiate
Dwell For Time 1.000
Loop
Example:
Do While (DriveInput.1=ON AND DriveInput.2=OFF)
Index.1.Initiate
Dwell For Time 1.000
Loop
Example:
Do While (TRUE)
Index.1.Initiate
Dwell For Time 1.000
Loop
Epsilon EP-P Drive Reference Manual
Revision A4
'Program 10 contains a complex home
'routine.
'Program 100 contains a "teach position"
'routine.
'Repeat the three lines of code below
'as long as DriveInput.1 is ON.
'Incremental,Dist=5.250in,Vel=10.0in/s
'seconds
'Repeat the three lines of code below
'as long as DriveInput.1 is ON and
'DriveInput.2=OFF.
'Incremental,Dist=5.250in,Vel=10.0in/s
'seconds
'Repeat until the program is halted
'Incremental,Dist=5.250in,Vel=10.0in/s
'seconds
www.controltechniques.com
121
Need help?
Do you have a question about the Epsilon EP-P and is the answer not in the manual?