Reference – Lenze PM94P01C User Manual

Page 89

Advertising
background image

PM94P01C

87

Reference

Table 31: EVENT

EVENT

Starts Event handler

Statement

Purpose

EVENT keyword is used to create scanned events within the user program.
Statement also sets one of 4 possible types of events.

Syntax

Any one of the 4 syntax examples herein may be used:
1.

EVENT <name> INPUT <inputname> RISE

2.

EVENT <name> INPUT <inputname> FALL

3.

EVENT <name> TIME <period>

4.

EVENT <name> <expression>

name

any valid alphanumeric string

inputname

any valid input “IN_A1 - IN_C4”

period

any integer number. Expressed in ms

expression

any arithmetic or logical expression

The following statements can not be used within event’s handler:

MOVE,MOVED,MOVEP,MOVEDR,MOVEPR,MDV

MOTION SUSPEND

MOTION RESUME

STOP MOTION

DO UNTIL

GOTO

GOSUB

HALT

VELOCITY ON/OFF

WAIT

WHILE

While GOTO or GOSUB are restricted, a special JUMP statement can be used for program flow change from
within event handler. See JUMP statement description in Language Reference section.

Remarks
For syntax 1 and 2:

The Event will occur when the input with the <name/number> transition from L(Low) to H (High), for syntax 1 (RISE) and
from H (High) to L(Low) for syntax 2 (FALL).

For syntax 3:

The Event will occur when the specified , <period>, period of time has expired. This event can be used as periodic event to
check for some conditions.

For syntax 4

The Event will occur when the expression, <expression>, evaluates to be true. The expression can be any valid arithmetic
or logical expression or combination of the two. This event can be used when implementing soft limit switches or when
changing the program flow based on some conditions. Any variable, (user and system), or constants can be used in the
expression. The event will only trigger when the logic transitions from False to True. Further occurrence of the event will not
occur while the condition remains true.

See Also

ENDEVENT, EVENT ON, EVENT OFF

Example:
EVENT InEvent IN_A1 RISE

V0 = V0+1

;

V0 increments by 1 each time IN_A1 transitions from low to high

ENDEVENT
EVENT period TIME 1000

;1000 ms = 1Sec

V3=V0-V1

;Event subtracts V1 from V0 and stores result in V3 every second (1000mS)

ENDEVENT
;------------------------------------------------------------------------------

EVENT InEvent ON

EVENT period ON

{program statements}

END

Advertising