Appendixes – Rockwell Automation 1398-PDM-xxx IQ Master Version 3.2.4 for IA-2000 and IQ-5000 Positioning Drive Modules, IQ-55 User Manual

Page 418

Advertising
background image

396

Application Examples • Vertical, Form, Fill and Seal

Publication 1398-PM601A-EN-P — October 2000

APPENDIXES

CLEAR

PRINT "LENGTH = " ,BOTL_LEN

PRINT 2,1 "NUMBER = " ,BOTL_NUM

PRINT 3,1 "LIMIT = " ,POS_LIM

PRINT 4,1 "X1:LEN X2:NUM X3:LIM"

XEND

;Main Program

X1 CONT

;Enable the Xkey routines for continuous operation

X2 CONT

X3 CONT

CLEAR

PRINT "LENGTH = " ,BOTL_LEN

PRINT 2,1 "NUMBER = " ,BOTL_NUM

PRINT 3,1 "LIMIT = " ,POS_LIM

PRINT 4,1 "X1:LEN X2:NUM X3:LIM"

ALL OFF

;Initialize all outputs off

MOVP 0

;Move fillerhead to home position (home position

; must first be defined using the home routine)

BOTL_LEN = 0

;Initialize variables

BOTL_NUM = 0

POS_LIM=0

GEAR = 2

LAST_BTL = @POS2

;Initialize positions

FILLER_HOM = POS1

CFILLER_HOM = UTOC1 FILLER_HOM

WAIT BOTL_LEN <> 0

WAIT BOTL_NUM <> 0

WAIT POS_LIM <> 0

FILL_LEN = BOTL_LEN * BOTL_NUM

CFILL_LEN = UTOC2 FILL_LEN

CBOTL_LEN = UTOC2 BOTL_LEN

S1 CONT

;Scanned event enabled to continuously detect the

; event

MAIN:

NEXT_BTL= LAST_BTL + CFILL_LEN

;Calculate next fill position

V20 = 2 * NEXT_BTL

;Scale next fill position according

; to gear ratio

REL_POS = CFILLER_HOM - V20

;Calculate target relative

; position between fill position

;and fillerhead

TEMP1 = NEXT_BTL - CBOTL_LEN

WAIT @POS2 >= TEMP1

;Wait for botl_num - 1 empty bottles to pass

IF @POS2>=NEXT_BTL JMP PSN_ERR

;If botl_num or more empty

; bottles have passed, go to psn_err

INT1 ON

;Enable interrupt to capture next bottle

WAIT I11 ON

;Wait for a bottle

GEAREN ON

;Begin gearing

LAST_BTL = NEXT_BTL

;Store last fill position

DELAY .01

WAIT INPOSN ON

;Wait until fillerhead is tracking fill position

SINT2

;Generate interrupt to latch pos1 and pos2

V20 = 2*@I2P2

V21 = @I2P1 - V20

;Calculate relative position

; between fill position and fillerhead

MAKE_UP = V21 - REL_POS

;Calculate difference from target

MAKE_UP = CTOU1 MAKE_UP

MOVD -MAKE_UP

;Execute correction move

WAIT INPOSN ON

FILL_EN ON

;Filling operation output on

WAIT FILL_CMPLT ON

;Wait until the fill operation has completed

FILL_EN OFF

;Turn off filling machine

GEAREN OFF

;Turn off electronic gearing

Advertising