Lenze PMSS1000 Simple Servo User Manual

Page 45

Advertising
background image

Indexer-Programmer-Manual.pdf REV 1.3

Caution should be taken when using MOVED,MOVEP and MOVE statements. If any of the MOVE
instructions without ",C" modifier is executed dead lock will result because it will be placed in the stack
and program will be suspended until it is executed. In the turn execution will not happened until enabled
so program will be waiting infinitely.

Conditional moves (MOVE WHILE/UNTIL)
Statement MOVE UNTIL <expression> or MOVE WHILE <expression> will start motion with set
acceleration and velocity and continues until <expression> became TRUE for MOVE UNTIL or while
<expression> is true for MOVE WHILE. Expression can be any valid arithmetic or logical expressions or
their combination. Here is some examples:

MOVE WHILE APOS<20

;Move before position becomes less then 20 , then ;stop with current

deceleration rate.

MOVE UNTIL APOS<V1

;Move positive until position less the position value contained in user variable V1

MOVE BACK UNTIL APOS<V1

;Same as above but direction of move changed. (Going negative)


MOVE WHILE IN_A1 ;Move positive while input 0 is activated.
MOVE WHILE !IN_A1 ;Move positive while input 0 is not activated. The exclamation mark (!) in front of
IN_A1 inverts (or negates) value of IN_A1.

Last example is a convenient way to find a sensor or switch.

Motion Queue and statements execution while in motion

By default when program executes MOVE, MOVED or MOVEP statements it waits until motion complete
before to go to the next statement. This effectively will suspend the program until requested motion is
done. Note those events are not suspended however and keep on executing in parallel. While this is
convenient for simple motion program it could be a troublesome when trying to do monitoring and
controlling I/O at the same time when execute motion. Consider a short program:

;This program monitors I/O in parallel with motion:
START:

MOVED 100,C

;start moving max 100 revs

WHILE FLAG_MOTION

;while moving

IF IN_A2 == 1

;if sensor detected

OUT1=1 ;turn

ON

output

for

WAIT TIME 10

;10 mS

OUT1=0 ;turn

output

OFF

ENDIF
ENDWHILE
;Return mechanism back
MOVED

-100

;Return

back

WAIT TIME 1000

;wait time

GOTO START

;and start all over

END

45

Advertising