Examples and tips
PROGRAMMING MANUAL
292
Revi
si
on 3.0
Example
fig. 56
'================================================
'BAG FEEDER program
'================================================
'Working with marks, if any mark is missing, feed the
'theoretical distance. But if the mark is missing for
'a number of consecutive bags, stop the operation.
'A digital output is activated a certain time to cut
'the bag.
'================================================
'Variable initialisation
start_signal=7
max_fail=3
program_alarm=0
failed=0
feeder_axis=2
BASE(feeder_axis)
'Position counter (MPOS,DPOS) goes from 0 to 999999
'and 0 again
UNITS=27
SPEED=100
ACCEL=1000
DECEL=1000
REP_DIST=1000000
REP_OPTION=1
SERVO=ON
WDOG=ON
'Main program
loop:
'Define current position as zero
DEFPOS(0)
'Wait for rising edge in Digital Input
'"start_signal"
WAIT UNTIL IN(start_signal)=0
WAIT UNTIL IN(start_signal)=1
Time
Time
Position
Speed
IN(start_signal)
REG_POS
MOVEABS
REGIST(1)
MOVEABS
REGIST(1)
MARK=TRUE
MOVEMODIFY
MARK=FALSE
Mark not detected,
no correction
WAIT IDLE
DEFPOS(0)
WAIT IDLE
DEFPOS(0)
MOVEABS
Bag_distance
Bag_distance-expecREG_POS
I52E-EN-03.book Seite 292 Freitag, 29. Juni 2007 11:55 11