6 wait statement, 7 goto statement & labels, 10 scanned event statements – Lenze PM94P01C User Manual
Page 48: Programming

PM94P01C
46
Programming
2.9.6 WAIT Statement
The WAIT statement is used to suspend program execution until or while a condition is true, for a specified time period
(delay) or until motion has been completed. The simplified syntax for the WAIT statement is:
WAIT UNTIL
WAIT WHILE
WAIT TIME
2.9.7 GOTO Statement & Labels
The GOTO statement can be used to transfer program execution to a new point marked by a label. This statement is
often used as the action of an IF statement. The destination label may be above or below the GOTO statement in the
application program.
Labels may be any alphanumeric string 64 characters in length beginning with a letter and ending with a colon “:”.
GOTO TestInputs
…statements
TestInputs:
…statements
IF (IN_A1) GOTO TestInputs
Table 14 provides a short description of the instructions used for program branching.
Table 14: Program Branching Instructions
Name
Description
GOTO
Transfer code execution to a new line marked by a label
DO/UNTIL
Do once and keep doing until conditions becomes true
IF and IF/ELSE
Execute if condition is true
RETURN
Return from subroutine
WAIT
Wait fixed time or until condition is true
WHILE
Execute while a condition is true
GOSUB
Go to subroutine
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. 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 first be
enabled. Events can be enabled or disabled from the user program, from another event or from itself (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 you want output 3 to come ON when the position is greater than 4 units, or if you need to turn output 4 ON
whenever input 2 and 3 are ON, you may use the following scanned event statements.
EVENT
PositionIndicator APOS > 4
OUT3=1
ENDEVENT
EVENT
Inputs3and4
IN_A4 & IN_B1
OUT4=1
ENDEVENT