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

Example:

Call Program.7

8.4.1.8 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

8.4.1.9 Formula

This program instruction can be used to enter a formula or assignment into a program. All SM-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 11). 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

8.4.1.10 Label:

The Label: instruction is used in conjunction with the GoTo 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 string of 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 ":". When using the Label: instruction, a ":" will be automatically inserted for the user.

Labels are not case sensitive.

Example:

Start:

Index.1.Initiate

Wait For Index.AnyCommandComplete

If (EZInput.2 = ON) Then

GoTo Start:

EndIf

EZOutput.1 = ON

End

See GoTo instruction for additional examples.

8.4.1.11 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

GoTo RunIndex1: 'Go to RunIndex1 label Else

70

www.emersonct.com

SM-EZMotion Module User Guide

Page 84
Image 84
Emerson P/N 400361-00 manual 1.8 End, Formula, Label, See GoTo instruction for additional examples