📄 laserscanning.lst
字号:
199 1 P1 = 0xFF;
200 1 }
201 //********************************************************************************************************
-*****
202 void UpdataScreen(unsigned char Mode)
203 {
204 1 switch(Mode)
205 1 {
206 2 case 0x00:
207 2 GotoXY(0,0);
208 2 Print("[Square] R=");
209 2 if(!Running)
210 2 {
211 3 GotoXY(0,1);
212 3 Print(" OFF S=");
213 3 }
214 2 else
215 2 {
216 3 GotoXY(0,1);
217 3 Print(" ON S=");
218 3 }
219 2 IntToStr(ScanRange,&IntToStrTemp[0],3);
220 2 GotoXY(13,0);
221 2 Print(&IntToStrTemp[0]);
222 2 IntToStr(MotorPlusDelay,&IntToStrTemp[0],3);
223 2 GotoXY(13,1);
224 2 Print(&IntToStrTemp[0]);
225 2 break;
226 2 case 0x01:
227 2 GotoXY(0,0);
228 2 Print("[Round] R=");
229 2 if(!Running)
230 2 {
231 3 GotoXY(0,1);
232 3 Print(" OFF S=");
233 3 }
234 2 else
235 2 {
C51 COMPILER V7.09 LASERSCANNING 05/28/2005 15:04:13 PAGE 5
236 3 GotoXY(0,1);
237 3 Print(" ON S=");
238 3 }
239 2 IntToStr(ScanRange,&IntToStrTemp[0],3);
240 2 GotoXY(13,0);
241 2 Print(&IntToStrTemp[0]);
242 2 IntToStr(MotorPlusDelay,&IntToStrTemp[0],3);
243 2 GotoXY(13,1);
244 2 Print(&IntToStrTemp[0]);
245 2 break;
246 2 case 0x02:
247 2 GotoXY(0,0);
248 2 Print("[Emendation] ");
249 2 GotoXY(0,1);
250 2 Print(" Press Key...");
251 2 break;
252 2 default: break;
253 2 }
254 1 }
255
256 //Rect
257 char code RectX[] = { 0, 0, 1, 1, 1, 0,-1,-1,-1};
258 char code RectY[] = { 0, 1, 1, 0,-1,-1,-1, 0, 1};
259 //Round
260 char code CodeXSin[128] = {0x00,0x06,0x0C,0x13,0x19,0x1F,0x25,0x2B,0x31,0x37,
261 0x3C,0x42,0x47,0x4C,0x51,0x56,0x5A,0x5E,0x63,0x66,
262 0x6A,0x6D,0x70,0x73,0x76,0x78,0x7A,0x7C,0x7D,0x7E,
263 0x7F,0x7F,0x7F,0x7F,0x7F,0x7E,0x7D,0x7C,0x7A,0x78,
264 0x76,0x73,0x70,0x6D,0x6A,0x66,0x63,0x5E,0x5A,0x56,
265 0x51,0x4C,0x47,0x42,0x3C,0x37,0x31,0x2B,0x25,0x1F,
266 0x19,0x13,0x0C,0x06,0x00,0xFB,0xF5,0xEE,0xE8,0xE2,
267 0xDC,0xD6,0xD0,0xCA,0xC5,0xBF,0xBA,0xB5,0xB0,0xAB,
268 0xA7,0xA3,0x9E,0x9B,0x97,0x94,0x91,0x8E,0x8B,0x89,
269 0x87,0x85,0x84,0x83,0x82,0x82,0x81,0x82,0x82,0x83,
270 0x84,0x85,0x87,0x89,0x8B,0x8E,0x91,0x94,0x97,0x9B,
271 0x9E,0xA3,0xA7,0xAB,0xB0,0xB5,0xBA,0xBF,0xC5,0xCA,
272 0xD0,0xD6,0xDC,0xE2,0xE8,0xEE,0xF5,0xFB };
273
274 char code CodeYCos[128] = {0x7F,0x7F,0x7F,0x7E,0x7D,0x7C,0x7A,0x78,0x76,0x73,
275 0x70,0x6D,0x6A,0x66,0x63,0x5E,0x5A,0x56,0x51,0x4C,
276 0x47,0x42,0x3C,0x37,0x31,0x2B,0x25,0x1F,0x19,0x13,
277 0x0C,0x06,0x00,0xFB,0xF5,0xEE,0xE8,0xE2,0xDC,0xD6,
278 0xD0,0xCA,0xC5,0xBF,0xBA,0xB5,0xB0,0xAB,0xA7,0xA3,
279 0x9E,0x9B,0x97,0x94,0x91,0x8E,0x8B,0x89,0x87,0x85,
280 0x84,0x83,0x82,0x82,0x81,0x82,0x82,0x83,0x84,0x85,
281 0x87,0x89,0x8B,0x8E,0x91,0x94,0x97,0x9B,0x9E,0xA3,
282 0xA7,0xAB,0xB0,0xB5,0xBA,0xBF,0xC5,0xCA,0xD0,0xD6,
283 0xDC,0xE2,0xE8,0xEE,0xF5,0xFB,0x00,0x06,0x0C,0x13,
284 0x19,0x1F,0x25,0x2B,0x31,0x37,0x3C,0x42,0x47,0x4C,
285 0x51,0x56,0x5A,0x5E,0x63,0x66,0x6A,0x6D,0x70,0x73,
286 0x76,0x78,0x7A,0x7C,0x7D,0x7E,0x7F,0x7F };
287
288
289 void SetScanRange(unsigned char Range)
290 {
291 1 ScanRange = Range;
292 1 }
293
294 void TimerEvent(void)
295 {
296 1 int Value;
297 1 int RoundValueX,RoundValueY,RoundTemp;
C51 COMPILER V7.09 LASERSCANNING 05/28/2005 15:04:13 PAGE 6
298 1
299 1 if(RunMode == 0x00 && Running) //矩形
300 1 {
301 2 if(RectCodeIndex==0)
302 2 {
303 3 if(ScanRange!=0)
304 3 Value = MotorXPosion;
305 3 else
306 3 {
307 4 MotorXOneStep(1);
308 4 Value = MotorXPosion;
309 4 }
310 3 }
311 2 else
312 2 Value = RectX[RectCodeIndex]*(RingIndex+1);
313 2
314 2 if(Value == MotorXPosion)
315 2 {
316 3 MotorXArrival = 1;
317 3 }
318 2 else if(Value > MotorXPosion)
319 2 {
320 3 MotorXOneStep(1);
321 3 }
322 2 else if(Value < MotorXPosion)
323 2 {
324 3 MotorXOneStep(0);
325 3 }
326 2
327 2 if(RectCodeIndex==0)
328 2 {
329 3 if(ScanRange!=0)
330 3 {
331 4 MotorYOneStep(1);
332 4 Value = MotorYPosion;
333 4 }
334 3 else
335 3 Value = MotorYPosion;
336 3 }
337 2 else
338 2 {
339 3 Value = RectY[RectCodeIndex]*(RingIndex+1);
340 3 }
341 2
342 2 if(Value == MotorYPosion)
343 2 {
344 3 MotorYArrival = 1;
345 3 }
346 2 else if(Value > MotorYPosion)
347 2 {
348 3 MotorYOneStep(1);
349 3 }
350 2 else if(Value < MotorYPosion)
351 2 {
352 3 MotorYOneStep(0);
353 3 }
354 2
355 2 if(MotorXArrival&MotorYArrival)
356 2 {
357 3 MotorXArrival = 0;
358 3 MotorYArrival = 0;
359 3 RectCodeIndex = (RectCodeIndex+1)%9;
C51 COMPILER V7.09 LASERSCANNING 05/28/2005 15:04:13 PAGE 7
360 3 if(RectCodeIndex==0)
361 3 RingIndex = (RingIndex+1)%(ScanRange+1);
362 3 }
363 2 }
364 1 else if(RunMode == 0x01 && Running) //圆形
365 1 {
366 2 RoundTemp = CodeXSin[RoundCodeIndex]*(RingIndex+1);
367 2 RoundValueX = RoundTemp/128;
368 2 if(RoundTemp%128 > 63) RoundValueX++;
369 2
370 2 RoundTemp = CodeYCos[RoundCodeIndex]*(RingIndex+1);
371 2 RoundValueY = RoundTemp/128;
372 2 if(RoundTemp%128 < -64) RoundValueY--;
373 2
374 2 if(RoundValueX == MotorXPosion)
375 2 {
376 3 MotorXArrival = 1;
377 3 }
378 2 else if(RoundValueX > MotorXPosion)
379 2 {
380 3 MotorXOneStep(1);
381 3 }
382 2 else if(RoundValueX < MotorXPosion)
383 2 {
384 3 MotorXOneStep(0);
385 3 }
386 2
387 2 if(RoundValueY == MotorYPosion)
388 2 {
389 3 MotorYArrival = 1;
390 3 }
391 2 else if(RoundValueY > MotorYPosion)
392 2 {
393 3 MotorYOneStep(1);
394 3 }
395 2 else if(RoundValueY < MotorYPosion)
396 2 {
397 3 MotorYOneStep(0);
398 3 }
399 2
400 2 if(MotorXArrival&MotorYArrival)
401 2 {
402 3 MotorXArrival = 0;
403 3 MotorYArrival = 0;
404 3 RoundCodeIndex = (RoundCodeIndex+1)%128;
405 3 if(RoundCodeIndex==0)
406 3 {
407 4 if(RunDirection)
408 4 {
409 5 RingIndex = (RingIndex+ScanRange)%(ScanRange+1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -