Reference – Lenze E94P PositionServo with MVOB User Manual

Page 92

Advertising
background image

90

L

PM94H201B_13xxxxxx_EN

Reference

Table 35: GOSUB

GOSUB

Go To subroutine

Statement

Purpose

GOSUB transfers control to subroutine.

Syntax

GOSUB <subname>

<subname>

a valid subroutine name

Remarks

After return from subroutine program resumes from next statement after GOSUB

See Also

GOTO, JUMP, RETURN

Example:

DO

GOSUB CALCMOVE

;Go to CALCMOVE Subroutine

MOVED V1

;Move distance calculated in Subroutine

UNTIL INA1

END
SUB CALCMOVE:

V1=(V2+V3)/2

;Subroutine statement, Calculates value for V1

RETURN

;Return to main program execution

Table 36: GOTO

GOTO

Go To

Statement

Purpose

Transfer program execution to label following the GOTO instruction.

Syntax

GOTO <label>

Remarks

<Label> must be a valid program reference label (alphanumeric string, 64 characters in length, and
ending with a colon “:”) contained within the user program. The GOTO statement can be located
either above or below the program label in the user code.

See Also

GOSUB, JUMP

Example:

GOTO Label2

{Statements…}
Label2:
{Statements…}

Table 37: HALT

HALT

Halt the program execution

Statement

Purpose

Used to halt main program execution. Events are not halted by the HALT statement. Event code can
restart main program execution by issuing the RESET statement or by executing a JUMP to a Main
Program Label from the EVENT handler. With the RESET statement, Main Program execution will
recommence on the code line immediately following the HALT Statement. With a Jump command
program execution is forced to the program label defined within the argument of the JUMP command.

Syntax

HALT

Remarks

This statement is convenient when writing event driven programs.

See Also

RESET, JUMP, EVENT

Example:

{Statements…}

HALT

;halt main program execution and wait for event

Advertising