21 Appendix
114 Accel 100,100
115 Return
116 '
117 '### Transportation data setting processing ###
118 *S40DTSET
119 PTBASE=P_100(PWK.X) 'Create reference position
120 TrBase PTBASE,MBENCNO% 'Tracking base setting
121 PGT=PTBASE*POFSET 'Suction position setting
122 GoSub *S46ACSET 'Interrupt definition
123 Return
124 '
125 '### Interrupt definition processing 1 ###
126 *S46ACSET
127 Select PTN.X 'Conveyer position pattern number
128 Case 1 'Front right -> left
129 MSTP1=PRNG.Z 'Following stop distance
130 Def Act 1,P_Fbc(1).Y>MSTP1 GoTo *S91STOP 'To *S91STOP if followed far long
131 Break
132 Case 2 'Front left -> right
133 MSTP1=-PRNG.Z
134 Def Act 1,P_Fbc(1).Y<MSTP1 GoTo *S91STOP
135 Break
136 Case 3 'Left side rear -> front
137 Case 5 'Right side rear -> front
138 MSTP1=PRNG.Z
139 Def Act 1,P_Fbc(1).X>MSTP1 GoTo *S91STOP
140 Break
141 Case 4 'Left side front -> rear
142 Case 6 'Right side front -> rear
143 MSTP1=-PRNG.Z
144 Def Act 1,P_Fbc(1).X<MSTP1 GoTo *S91STOP
145 Break
146 End Select
147 Return
148 '
149 '### Workpiece position confirmation processing ###
150 'PX50CUR:Current workpiece position
151 'MX50ST:Tracking start range
152 'MX50ED:Tracking end range
153 'MX50PAT:Conveyer position pattern number
154 'MY50STS:Result (1: Wait/2: Start tracking/3: Next workpiece)
155 *S50WKPOS
156 MY50STS=0 'Clear return value
157 Select MX50PAT 'Conveyer pattern
158 Case 1 'Front right -> left
159 M50STT=-MX50ST 'The start side has a negative value
160 M50END=MX50ED
161 If PosCq(PX50CUR)=1 And PX50CUR.Y>=M50STT And PX50CUR.Y<=M50END Then
162 MY50STS=2 'Tracking possible
163 Else 'If tracking not possible
164 If PX50CUR.Y<0 Then MY50STS=1 'Wait
165 If PX50CUR.Y>M50END Then MY50STS=3 'Move onto the next workpiece
166 If PosCq(PX50CUR)=0 And PX50CUR.Y>=M50STT And PX50CUR.Y<=M50END Then
MY50STS=3 'Outside the movement range
167 EndIf
168 Break
169 Case 2 'Front left -> right
170 M50STT=MX50ST
171 M50END=-MX50ED 'The end side has a negative value
172 If PosCq(PX50CUR)=1 And PX50CUR.Y<=M50STT And PX50CUR.Y>=M50END Then
Sample Programs 21-129