7events, Events, 7 events – Lenze PMSS1000 Simple Servo User Manual

Page 18

Advertising
background image

Indexer-Programmer-Manual.pdf REV 1.3

1.7 Events


Scanned Events
A Scanned Event is a small program that runs independently of the main program. To establish Scanned
Event we need to specify condition to scan in event header and write statements to perform when
condition is true. Finally we need to turn Event On by executing Event <eventname> ON statement. To
learn more about Scanned Events refer to the Section 2.12. We will use Scanned Events to implement a
programmable limit switch. A programmable limit switch is a mechanism that can be programmed to turn
on at specific position. We will set up a Scanned Event to check if the current position (system variable
APOS) is greater than or equal to a given value (3) and less than or equal to another given value (6). If it
is, Output 0 is turned ON. Otherwise it is OFF.


UNITS =1
;
;
EVENT

InLimits

1==1 ; always true so event scanned every

;256uS

;

OUT1= APOS>=3 && APOS<=6

;

ENDEVENT
;
ENABLE

;APOS and TPOS are initialized to 0

EVENT InLimits ON

;turns Event InLimits ON

;Make some moves so we can go in and out ;of the specified limits of
MAXV=200

;200

Rpm

ACCEL=10

;10

Rps*s

DECEL=10

;same

as

ACCEL



ProgramStart:
MOVE 10

;move to 10 revs position

MOVE

0

;move

back

to

0

GOTO ProgramStart

;loop it forever

END

When this program run motor will move 10 revs CW and than move back to initial position. Output 0 will
be ON during motor shaft position within the window 3 to 6 revs inclusively and low all the other times.
There are certain restrictions when writing code for event handlers. Refer to section 2.1 for additional
information on scanned events.

18

Advertising