Introduction – Lenze PM94P01C User Manual

Page 21

Advertising
background image

PM94P01C

19

Introduction

Read Digital Inputs

The Pick and Place example program has been modified below to utilize the “WAIT UNTIL” inputs statements in place
of the “WAIT TIME” statements.

IN_A1 and IN_A4 will be used as proximity sensors to detect when the pick and place

arm is extended and when it is retracted. When the arm is extended,

IN_A1 will be in an ON state and will equal “1”.

When the arm is retracted,

IN_A4 will be in an ON state and will equal “1”.

;********************* Main Program ****************************************
RESET_DRIVE:

;Place holder for Fault Handler Routine

WAIT UNTIL IN_A3

;Make sure that the Enable input is made before continuing

ENABLE
PROGRAM_START:
WAIT UNTIL IN_A4==1

;Make sure Arm is retracted

MOVEP 0

;Move to Pick position

OUT1 = 1

;Turn on output 1 to extend Pick arm

WAIT UNTIL IN_A1==1

; Arm extend

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

;Make sure Arm is retracted

MOVED -10

;Move 10 REVs to Place position

OUT1 = 1

;Turn on output 1 on to extend Pick arm

WAIT UNTIL IN_A1==1

; 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

;Arm is retracted

GOTO PROGRAM_START
END
Once the above modifications have been made, export the program to file and save it as “Pick and Place with I/O”, then
compile, download and test the program.

ASSIGN & INDEX - Using inputs to generate predefined indexes

“INDEX” is a variable on the drive that can be configured to represent a certain group of inputs as a binary number.
“ASSIGN” is the command that designates which inputs are utilized and how they are configured.

Below the Pick and Place program has been modified to utilize this “INDEX” function. The previous example program
simply picked up a part and moved it to a place location. For demonstration purposes we will add seven different place
locations. These locations will be referred to as Bins. What Bin the part is placed in will be determined by the state of
three inputs, B1, B2 and B3.

Bin 1

-

Input B1 is made

Bin 2

-

Input B2 is made

Bin 3

-

Inputs B1 and B2 are made

Bin 4

-

Input B3 is made

Bin 5

-

Inputs B1 and B3 are made

Bin 6

-

Inputs B2 and B3 are made

Bin 7

-

Inputs B1, B2 and B3 are made

The “ASSIGN” command is used to assign the individual input to a bit in the “INDEX” variable. ASSIGN INPUT <input
name> AS BIT <bit #>
;*********************** Initialize and Set Variables *******************
ASSIGN INPUT IN_B1 AS BIT 0 ;Assign the Variable INDEX to equal 1 when IN_B1 is made
ASSIGN INPUT IN_B2 AS BIT 1 ;Assign the Variable INDEX to equal 2 when IN_B2 is made
ASSIGN INPUT IN_B3 AS BIT 2 ;Assign the Variable INDEX to equal 4 when IN_B4 is made

Advertising