Epsilon EP-P Drive Reference Manual
121
Revision A4
www.controltechniques.com
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
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 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
‘Repeat the three lines of code below
‘as long as DriveInput.1 is ON.
Index.1.Initiate
‘Incremental,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000
‘seconds
Loop
Example:
Do While (DriveInput.1=ON AND DriveInput.2=OFF)
‘Repeat the three lines of code below
‘as long as DriveInput.1 is ON and
‘DriveInput.2=OFF.
Index.1.Initiate
‘Incremental,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000
‘seconds
Loop
Example:
Do While (TRUE)
‘Repeat until the program is halted
Index.1.Initiate
‘Incremental,Dist=5.250in,Vel=10.0in/s
Dwell For Time 1.000
‘seconds
Loop
Program0=>Program1=>Program2=>Program3=>Program4 => NO MORE THAN 4!
Содержание Epsilon EP-P
Страница 2: ......
Страница 14: ...xii Epsilon EP P Drive Reference Manual www controltechniques com Revision A4 Glossary 225 Index 231...
Страница 124: ...110 Epsilon EP P Drive Reference Manual www controltechniques com Revision A4...
Страница 200: ...186 Epsilon EP P Drive Reference Manual www controltechniques com Revision A4...
Страница 218: ...204 Epsilon EP P Drive Reference Manual www controltechniques com Revision A4...
Страница 238: ...224 Epsilon EP P Drive Reference Manual www controltechniques com Revision A4...
Страница 244: ...230 Epsilon EP P Drive Reference Manual www controltechniques com Revision A4...
Страница 247: ......