📄 twoscoremid.lst
字号:
162 1 {
163 2 MotorLeft((Speed-1),1); // in the current version moving forward
164 2 _nop_(); // in the reality 0
165 2 MotorRight((Speed-2),1);
166 2 _nop_();
167 2 //SensorSta();
168 2 Stop();
169 2 Delay(50000); //for test
170 2
171 2 }
172 1 if( !( (HozSensor1) && (MidSensor2) &&
173 1 (MidSensor1)))
174 1 {
175 2 Delay(7500);
176 2
177 2 Stop();
178 2 Delay(1000);
C51 COMPILER V7.09 TWOSCOREMID 06/03/2004 19:30:55 PAGE 4
179 2 while(HozSensor2 == 1) // left hoz sensor
180 2 //use driect Hozsensor flag
181 2 {
182 3 MotorLeft(5,1); //deccerate 3
183 3 _nop_ ();
184 3 MotorRight(5,0); //Right: Speed 3 backward
185 3 _nop_ ();
186 3 //pressume the distance between sensor and the rotate origin is 30 cm
187 3 //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available
188 3 UpdateStatus(); // prepare for FollowLine
189 3 }
190 2
191 2 while(MidSensor2 == 1) //use driect sensor flag
192 2 {
193 3 MotorLeft(3,1); //left: speed 2 forward
194 3 _nop_ ();
195 3 MotorRight(3,0); //Right: Speed 2 backward
196 3 _nop_ ();
197 3 //pressume the distance between sensor and the rotate origin is 30 cm
198 3 //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available
199 3 UpdateStatus(); //
200 3 }
201 2 ImpulseLeft();
202 2
203 2 }
204 1 while(iFollowLineTime < TwoSensorMid)
205 1 {
206 2 SensorSta();
207 2 FollowLine((Speed-2));
208 2 iFollowLineTime++;
209 2 }
210 1 iFollowLineTime = 0;
211 1
212 1 }
213 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 void TwoScoreMidRightBack(char Speed)
216 // from right side to Two Score Zone using back sensor
217 {
218 1 while(iFollowLineTime < 1500)
219 1 {
220 2 SensorSta();
221 2 FollowLineBack((Speed+1));
222 2 iFollowLineTime++;
223 2 }
224 1 iFollowLineTime = 0;
225 1
226 1 MotorLeft((Speed+3),0);
227 1 _nop_();
228 1 MotorRight((Speed+1),0);
229 1 _nop_();
230 1 Delay(20000);
231 1
232 1 //leaing left
233 1 MotorLeft((Speed+2),0); // in the current version moving forward
234 1 _nop_(); // in the reality 0
235 1 MotorRight((Speed-2),0);
236 1 _nop_();
237 1 Delay(35000);
238 1
239 1
240 1 while((LineSensor1) || (BackSensor1))
C51 COMPILER V7.09 TWOSCOREMID 06/03/2004 19:30:55 PAGE 5
241 1 {
242 2 MotorLeft((Speed-1),0); // in the current version moving forward
243 2 _nop_(); // in the reality 0
244 2 MotorRight((Speed-3),0);
245 2 _nop_();
246 2 }
247 1
248 1
249 1 if( !( (LineSensor1) && (BackSensor2) &&
250 1 (BackSensor1)))
251 1 {
252 2 Delay(7500);
253 2
254 2 Stop();
255 2 Delay(1000);
256 2 Stop();
257 2 Delay(50000); //for test
258 2 Delay(50000); //for test
259 2 while(LineSensor2 == 1) // left hoz sensor
260 2 //use driect Hozsensor flag
261 2 {
262 3 MotorLeft(5,0); //deccerate 3
263 3 _nop_ ();
264 3 MotorRight(5,1); //Right: Speed 3 backward
265 3 _nop_ ();
266 3
267 3 UpdateStatus(); // prepare for FollowLine
268 3 }
269 2 while(BackSensor2 == 1) //use driect sensor flag
270 2 {
271 3 MotorLeft(3,0); //left: speed 2 forward
272 3 _nop_ ();
273 3 MotorRight(3,1); //Right: Speed 2 backward
274 3 _nop_ ();
275 3 UpdateStatus(); //
276 3 }
277 2
278 2 Stop();
279 2 Delay(500);
280 2 while(//(iTurnTime < 1000)&&
281 2 (BackSensor1 == 1)||(BackSensor2 == 1))
282 2 {
283 3 MotorLeft(5,1);
284 3 _nop_();
285 3 MotorRight(5,0);
286 3 _nop_();
287 3 iTurnTime++;
288 3 }
289 2 iTurnTime = 0;
290 2
291 2 Stop();
292 2
293 2 Delay(50000); //for test
294 2 Delay(50000); //for test
295 2 }
296 1
297 1 MotorLeft((Speed-2),0);
298 1 _nop_();
299 1 MotorRight((Speed-2),0);
300 1 _nop_();
301 1 Delay(5000);
302 1
C51 COMPILER V7.09 TWOSCOREMID 06/03/2004 19:30:55 PAGE 6
303 1 while(iFollowLineTime < TwoSensorMid)
304 1 {
305 2 SensorSta();
306 2 FollowLineBack((Speed-2));
307 2 iFollowLineTime++;
308 2 }
309 1 iFollowLineTime = 0;
310 1
311 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 931 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 3 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -