Programming, 10 scanned event statements – Lenze E94P PositionServo with MVOB User Manual

Page 49

Advertising
background image

PM94H201B_13xxxxxx_EN

L

47

Programming

2.10 Scanned Event Statements

A Scanned Event is a small program that runs independently of the main program. SCANNED EVENTS are very useful
when it is necessary to trigger an action (i.e. handle I/O) while the motor is in motion or other tasks within the Main
Program are executing. When setting up Events, the first step is to define both the action that will trigger the event
as well as the sequence of statements to be executed once the event has been triggered. Events are scanned every
512µs. Before an Event can be scanned however it must be enabled. Events can be enabled or disabled from the user
program or from another event (see explanations below). Once the Event is defined and enabled, the Event will be
constantly scanned until the trigger condition is met, this scan rate is independent of the main program’s timing. Once
the trigger condition is met, the Event statements will be executed independently of the user program.
Scanned events are used to record events and perform actions independent of the main body of the program. For
example, if the programmer wants output 3 to come ON when the position is greater then 4 units, or if he needs to turn
output 4 ON whenever inputs A4 and B1 are ON, he could use the following scanned event statements.

EVENT

PositionIndicator APOS > 4

OUT3=1

ENDEVENT

EVENT

InputsLogic

IN_A4

&

IN_B1

OUT4=1

ENDEVENT

Scanned events may also be used with a timer to perform an action on a periodic time basis.
The program statements contained in the scanned event code cannot include any that are related to the command of
Motion from the motor or that result in a delay to program execution. A full list of illegal event code statements is given
in section 3.1. Syntax for defining Events is as follows.

EVENT <name> INPUT <inputname> RISE

This scanned event statement is used to execute a block of code each time a specified input <inputname> changes its
state from low to high.

EVENT <name> INPUT <inputname> FALL

This scanned event statement is used to execute a block of code each time a specified input <inputname> changes its
state from high to low.

EVENT <name> TIME <timeout>

This scanned event statement is used to execute a block of code with a repetition rate specified by the <timeout>
argument. The range for “timeout” is 0 - 50,000ms (milliseconds). Specifying a timeout period of 0 ms will result in the
event running every event cycle (512ms).

EVENT <name> expression

This scanned event statement is used to execute a block of code when the expression evaluates as true.

EVENT <name> ON/OFF

This statement is used to enable/disable a scanned event.
Table 14 contains a summary of instructions that relate to scanned events. Refer to Section 3 “Language Reference”
for more detailed information.

Table 14: Scanned Events Instructions

Name

Description

EVENT <name> ON/OFF

enable / disable event

EVENT <name> INPUT <inputname> RISE

Scanned event when <input name> goes low to high

EVENT <name> INPUT <inputname> FALL

Scanned event when <input name> goes high to low

EVENT <name> TIME <value>

Periodic event with <value> repetition rate.

EVENT <name> expression

Scanned event on expression = true

Advertising