Introduction – Lenze E94P PositionServo with MVOB User Manual

Page 32

Advertising
background image

30

L

PM94H201B_13xxxxxx_EN

Introduction

;**************************** Main Program ********************************

WAIT UNTIL IN_A3

;Make sure the Enable input is made before continuing

ENABLE

OUT1 = 0

;Initialize Pick Arm - Place in Retracted Position

WAIT UNTIL IN_A4==1

;Check Pick Arm is in Retracted Position

PROGRAM_START:

MOVEP 0

;Move to position 0 to pick part

OUT1 = 1

;Turn on output 1 to extend Pick arm

WAIT UNTIL IN_A1==1

;Check input to make sure Arm is extended

OUT2 = 1

;Turn on output 2 to Engage gripper

WAIT TIME 1000

;Delay 1 sec to Pick part

OUT1 = 0

;Turn off output 1 to Retract Pick arm

WAIT UNTIL IN_A4==1

;Check input to make sure Arm is retracted

MOVED 100,C

;Move to Place position and continue code execution

WAIT UNTIL APOS >25

;Wait until pos is greater than 25

OUT3 = 1

;Turn on output 3 to spray part

WAIT UNTIL APOS >=75

;Wait until pos is greater than or equal to 75

OUT3 = 0

;Turn off output 3 to shut off spray guns

WAIT UNTIL APOS >=95

;Wait until move is almost done before extending arm

OUT1 = 1

;Turn on output 1 to extend Pick arm

WAIT UNTIL IN_A1==1

;Check input to make sure Arm is extended

OUT2 =0

;Turn off output 2 to Disengage gripper

WAIT TIME 1000

;Delay 1 sec to Place part

OUT1 = 0

;Retract Pick arm

WAIT UNTIL IN_A4==1

;Check input to make sure Arm is retracted

GOTO PROGRAM_START

END

When the “C” argument is added to the standard MOVED and MOVEP statements, program execution is not interrupted
by the execution of the motion command. Note: with an MDV move the execution of the program is never suspended.

Generated motion profiles are stored directly to the Motion Queue and are then executed in sequence. If the MOVED
and MOVEP statements don’t have the “C” modifier, then the motion profiles generated by these statements go to the
motion stack and the program is suspended until each profile has been executed.

1.11 Subroutines and Loops

1.11.1 Subroutines

Often it is necessary to repeat a series of program statements in several places in a program. Subroutines are typically
used where code is used multiple times and within various sections of the main program. Subroutines are placed after
the main program, i.e. after the END statement, and must start with the subname: label (where subname is the name of
subroutine), and must end with a statement RETURN.

Note that there can be more than one RETURN statement in a subroutine. Subroutines are called using the GOSUB
statement.

Advertising