
89
Programming
Wait For Time 1.000 ‘seconds
DriveOutput.1=OFF
Wait For Index.AnyCommandComplete
Loop
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
Examples:
Call Program.10 ‘Program 10 contains a complex home
‘routine.
Call Program.100 ‘Program 100 contains a “teach position”
‘routine.
End
This program flow instruction is used to halt the execution of the program. It can be used in
multiple places within the program. It is not required on the last line of every program. It is
implied that after the controller executes the last line of code in a program the program will halt.
It is commonly used inside of If/Then/Endif constructs to end the program if a certain condition
has been met.
Examples:
If DriveInput.1=OFF Then
End
Endif
If DriveInput.1=ON Then
DriveOutput.1=ON
End
Endif
Program0=>Program1=>Program2=>Program3=>Program4 => NO MORE THAN 4!
Komentarze do niniejszej Instrukcji