Ifif/then/else statement, If/then/else statement – Lenze PMSS1000 Simple Servo User Manual

Page 61

Advertising
background image

Indexer-Programmer-Manual.pdf REV 1.3




Example:

EVENT LimitSwitch IN_A1 RAISE ; limit switch event

Jump LimitSwitchHandler ; jump to process limit switch


ENDEVENT
V0=0
EVENT LimitSwitch ON

Again:

HALT

;system

controlled

by

interface


LimitSwitchHandler:

EVENTS OFF

;turn off all events

ICONTROL OFF

;disable interface control

STOP MOTION QUICK

;

DISABLE

;optional

DISABLE

V0=1

;indicate fault condition to the interface

ICONTROL ON
EVENTS ON
GOTO AGAIN


IF

If/Then/Else

Statement


Purpose

The IF statement tests for a condition and then executes the specific action(s)
between IF and ENDIF statements if condition is satisfied. If condition is false, no
action is taken and the instruction following ENDIF statement is executed. Optionally,
a second action(s) may be specified to be executed if the condition is false.


Syntax

IF

<condition>

{statements

1}

[

ELSE

{statements 2}

]

ENDIF

<condition>

The condition to be tested. The condition may be a comparison, an input

being TRUE or FALSE (H or L) system flag or a variable used as flag (if 0 - false, else
- true ).

Comparisons compare the values of two operands and determine if the condition is

TRUE or FALSE. A comparison may be greater (>), less than
(<), less than or equal (<=), or greater than or equal to (>=). The

61

Advertising