Reference – Lenze PM94P01C User Manual

Page 94

Advertising
background image

PM94P01C

92

Reference

Table 41: IF

IF

IF/ENDIF

Statement

Purpose

The IF statement tests for a condition and then executes the specific action(s) between the IF and
ENDIF statements if the condition is found to be true. If the condition is false, no action is taken and
the instructions following the ENDIF statement are executed. Optionally, using the ELSE statement, a
second series of statements may be specified to be executed if the condition is false.

Syntax

IF <condition>

{statements 1}

ELSE

{statements 2}

ENDIF

Remarks
See Also

WHILE, DO

Example:

IF APOS > 4

;If actual position is greater than 4 units

V0=2

ELSE

;otherwise... (actual position equal or less than 4)

V0=0

ENDIF
;----------------------------------------------------------
If V1 <> V2 && V3>V4

;If V1 doesn’t equal V2 AND V3 if greater than V4

V2=9

ENDIF

Table 42: JUMP

JUMP

Jump to label from Event handler

Statement

Purpose

This is a special purpose statement to be used only in the Event Handler code. When the EVENT is
triggered and this statement is processed, execution of the main program is transferred to the <label>
argument called out in the “JUMP” statement. The Jump statement is useful when there is a need for
the program’s flow to change based on some event(s). Transfer program execution to the instruction
following the label.

Syntax

JUMP <label>
<label> is any valid program label

Remarks

Can be used in EVENT handler only.

See Also

EVENT

Example:

EVENT ExternalFault INPUT IN_A4 RISE ;activate Event when IN_A4 goes high

JUMP ExecuteStop

;redirect program to <ExecuteStop>

ENDEVENT
StartMotion:

EVENT ExternalFault ON

ENABLE

MOVED 20

MOVED -100

{statements}

END
ExecuteStop:

STOP MOTION

;Motion stopped here

DISABLE

;drive disabled

Wait Until !IN_A4

;Wait Until Input A4 goes low

GOTO StartMotion

Advertising