Emerson EZMotion User Manual page 174

Table of Contents

Advertisement

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.
Example:
If EZInput.1=OFF Then
End
Endif
Example:
If EZInput.1=ON Then
EZOutput.1=ON
End
Endif
For Count/Next
This instruction is used to execute a section of code a specific number of times.
The user must enter the two numbers that control the repeat count. This instruction can either count up or count down. If the first
number provided by the user is larger than the second number, then the instruction will count down. If the first number provided by
the user is smaller than the second number, then the instruction will count up. The valid range for the numbers provided is 0 to
2147483647.
Example:
For Count = 1 to 5
Index.1.Initiate
Dwell For Time 1.000 'seconds
Next
Example:
For Count = 1 To 10
Wait For ModuleInput.1 = ON
Index.0.Initiate
Wait For Index.AnyCommandComplete
EZOutput.1=ON
Wait For Time 1.000 'seconds
EZOutput.1=OFF
Next
Formula
This program instruction can be used to enter a formula or assignment into a program. All EZMotion parameters are available for
use in a formula. They may be dragged and dropped into a formula, but the program User Level will determine how many appear for
dragging and dropping (see User Levels on page 16). Formulas can also be created by simply typing them into the program. This
instruction was created to inform the user that formulas can be used in a program.
Examples:
Index.1.Vel = 20.0
Index.0.Dist = Index.2.Dist + 0.1
EZOutput.1 = ON
Index.0.Accel = (Index.0.Accel*1000)+5.00
For<var>
This program instruction is used to execute a section of code as long as the end number is not reached.
For <variable> = <start> to <end> step <increment> ... Next
<variable> = A single user variable that will be set and incremented by this instruction.
<start> = A value that the <variable> will be initialized to at the start of the instruction.
<end> = A number that is used to exit the For<var> loop. For a positive increment, when <variable> is Great than or equal
to <end> the loop is exited. For negative increment, when <variable> is Less than or equal to <end> the loop is exited.
<increment> = A value that the <variable> will be incremented by at the end of the loop. Expression is a mathematical
formula including variables, numbers, and math operators that represent a single value when executed.
GoTo
The GoTo instruction is used in conjunction with the Label: instruction to cause program flow to transfer to a specified location within
a program. The destination label is allowed to be above or below the GoTo instruction within the same program. It is not possible to
GoTo a label outside of the program containing the GoTo instruction, nor is it possible to use a GoTo/Label: to exit out of a For Count/
Next loop. In either of these conditions, a Red Dot error will be generated.
The Label to which program flow transfers is a character string up to 50 characters in length and can be made up of any
alphanumeric character. The label name must not start with a number, and must end with a colon character ":".
Labels are not case sensitive.
Example:
Do While (TRUE)
If (EZInput.1 = ON) Then
162
www.controltechniques.com
EZMotion User/Programming Guide
Revision: A8

Advertisement

Table of Contents
loading

Table of Contents