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 391

Application Examples • Feed-To-Length Application
369
Publication 1398-PM601A-EN-P — October 2000
APPENDIXES
IF COUNT<>0 PRINT 3,14 "/",COUNT,5,0
FEED20:
REL_LEN = UTOC1 OUT_LEN
;Calculate new relative output length
;REL_LEN is position where anticipate output will
; turn on
REL_LEN = @PCMD + REL_LEN
IF BACKUP ON REL_LEN = REL_LEN + UTOC1 BACK_LEN
S1 ON
;Enable scanned event S1
WAIT READY ON
;Wait for ready input
DIST = LENGTH + KERF
;Add Kerf to move length
;If backup enabled add backup distance to move length
IF BACKUP ON DIST = DIST + BACK_LEN
;If registration enabled add correction to move
: length
IF REGISTER ON DIST = DIST + CORRECT
MOVD DIST,V=SPEED
;Measured registration distance is difference between
; position command and the position latched by the
; registration mark
REG_DIST = @PCMD - @LPOS
IF REGISTER OFF JMP FEED30
;Calculate registration error in counts
REG_ERR = CREG_LEN - REG_DIST
CORRECT = CTOU1 REG_ERR
;Convert to user units
IF CORRECT >= LENGTH CORRECT=0
FEED30:
ANTICIPATE OFF
;Anticipate output off
CUT ON
;Cut output on
DWELL TIME
IF BACKUP OFF JMP FEED40
WAIT CONTINUE ON
;Wait for continue input
MOVD -BACK_LEN,V=SPEED
;Backup move
FEED40:
CUT OFF
;Cut output off
TEMP_CNT = TEMP_CNT + 1
IF TEMP_CNT<0 TEMP_CNT=0
IF COUNT=0 JMP FEED10
IF TEMP_CNT<=COUNT JMP FEED10
BATCH_CMPLT ON
;Batch Complete output on
TEMP_CNT=0
STATE = 2
IF SCREEN<>3 JMP FEED50
CLEAR 2
CLEAR 3
PRINT 3,3 "BATCH COMPLETE"
FEED50:
JMP FEEDLOOP
END
NOTE: The correction distance is calculated in encoder counts so the distance is still properly calcu-
lated if the internal position counter rolls over