📄 dian.lst
字号:
263 2 break;
264 2 }
265 1 }
266 void DownDisplay(void) //下移
267 {
268 1 uchar i,j,k,scan;
269 1 char temp=30;
270 1 for(i=0;i<6;)
271 1 {
272 2 if(DownFlag==1)
273 2 {
274 3 for(k=0;k<speed;k++)
275 3 {
276 4 scan=0;
277 4 if(DownFlag==1)
278 4 {
279 5 for(j=temp;j<31;j+=2) //开始j=30
280 5 {
281 6 ST=0;
282 6 SendByte(hanzi[i+3][j+1]);
283 6 SendByte(hanzi[i+3][j]);
284 6 SendByte(hanzi[i+2][j+1]);
285 6 SendByte(hanzi[i+2][j]);
286 6 SendByte(hanzi[i+1][j+1]);
287 6 SendByte(hanzi[i+1][j]);
288 6 SendByte(hanzi[i][j+1]);
289 6 SendByte(hanzi[i][j]);
290 6 ST=1;
291 6 EN=0;
292 6 P2=scan;
293 6 delay(5);
294 6 EN=1;
295 6 scan++;
296 6 }
297 5 }
298 4 else
299 4 break;
300 4 }
301 3 temp-=2;
302 3 if(temp==-2)
303 3 {
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 6
304 4 temp=30;
305 4 i+=4;
306 4 }
307 3 }
308 2 else
309 2 break;
310 2 }
311 1 }
312 void ZJDisplay1(void) //只在下移基础上稍微改下(综合上移和下移)
313 {
314 1 uchar i,j,k,scan,temp;
315 1 for(i=0;i<6;)
316 1 {
317 2 if(ZJ1Flag==1)
318 2 {
319 3 for(k=0;k<speed;k++)
320 3 {
321 4 scan=0;
322 4 if(ZJ1Flag==1)
323 4 {
324 5 for(j=0;j<2*temp+1;j+=2)
325 5 {
326 6 ST=0;
327 6 SendByte(hanzi[i+3][j+1]);
328 6 SendByte(hanzi[i+3][j]);
329 6 SendByte(hanzi[i+2][j+1]);
330 6 SendByte(hanzi[i+2][j]);
331 6 SendByte(hanzi[i+1][j+1]);
332 6 SendByte(hanzi[i+1][j]);
333 6 SendByte(hanzi[i][j+1]);
334 6 SendByte(hanzi[i][j]);
335 6 ST=1;
336 6 EN=0;
337 6 P2=scan;
338 6 delay(5);
339 6 EN=1;
340 6 scan++;
341 6 }
342 5 }
343 4 else
344 4 break;
345 4 }
346 3 temp++;
347 3 if(temp==16)
348 3 {
349 4 temp=0;
350 4 i+=4;
351 4 }
352 3 }
353 2 else
354 2 break;
355 2 }
356 1 }
357 void ZJDisplay2(void) //只在下移基础上稍微改下(综合上移和下移)
358 {
359 1 uchar i,j,k,scan,z=0;
360 1 char temp=30;
361 1 for(i=0;i<6;)
362 1 {
363 2 if(ZJ2Flag==1)
364 2 {
365 3 for(k=0;k<speed;k++)
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 7
366 3 {
367 4 scan=15-z; //z作译码控制
368 4 if(ZJ2Flag==1)
369 4 {
370 5 for(j=temp;j<31;j+=2)
371 5 {
372 6 ST=0;
373 6 SendByte(hanzi[i+3][j+1]);
374 6 SendByte(hanzi[i+3][j]);
375 6 SendByte(hanzi[i+2][j+1]);
376 6 SendByte(hanzi[i+2][j]);
377 6 SendByte(hanzi[i+1][j+1]);
378 6 SendByte(hanzi[i+1][j]);
379 6 SendByte(hanzi[i][j+1]);
380 6 SendByte(hanzi[i][j]);
381 6 ST=1;
382 6 EN=0;
383 6 P2=scan;
384 6 delay(5);
385 6 EN=1;
386 6 scan++;
387 6 }
388 5 }
389 4 else
390 4 break;
391 4 }
392 3 temp-=2;
393 3 z++;
394 3 if(temp==-2)
395 3 {
396 4 temp=30;
397 4 i+=4;
398 4 z=0; //z=15时就复位了
399 4 }
400 3 }
401 2 else
402 2 break;
403 2 }
404 1 }
405 void ClearFlag(void) //清标志位,调用子程序方便
406 {
407 1 LeftFlag=0;
408 1 RightFlag=0;
409 1 UpFlag=0;
410 1 DownFlag=0;
411 1 ZJ1Flag=0;
412 1 ZJ2Flag=0;
413 1 }
414 void KeyScan(void)
415 {
416 1 if(K1==0)
417 1 {
418 2 delay(10);
419 2 if(K1==0)
420 2 {
421 3 while(!K1);
422 3 ClearFlag();
423 3 LeftFlag=1;
424 3 }
425 2 }
426 1 if(K2==0)
427 1 {
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 8
428 2 delay(10);
429 2 if(K2==0)
430 2 {
431 3 while(!K2);
432 3 ClearFlag();
433 3 RightFlag=1;
434 3 }
435 2 }
436 1 if(K3==0)
437 1 {
438 2 delay(10);
439 2 if(K3==0)
440 2 {
441 3 while(!K3);
442 3 ClearFlag();
443 3 UpFlag=1;
444 3 }
445 2 }
446 1 if(K4==0)
447 1 {
448 2 delay(10);
449 2 if(K4==0)
450 2 {
451 3 while(!K4);
452 3 ClearFlag();
453 3 DownFlag=1;
454 3 }
455 2 }
456 1 if(K5==0)
457 1 {
458 2 delay(10);
459 2 if(K5==0)
460 2 {
461 3 while(!K5);
462 3 ClearFlag();
463 3 ZJ1Flag=1;
464 3 }
465 2 }
466 1 if(K6==0)
467 1 {
468 2 delay(10);
469 2 if(K6==0)
470 2 {
471 3 while(!K6);
472 3 ClearFlag();
473 3 ZJ2Flag=1;
474 3 }
475 2 }
476 1 }
477 void main(void)
478 {
479 1 TMOD=0X01;
480 1 TH0=(65535-1000)/256;
481 1 TL0=(65535-1000)%256;
482 1 ET0=1;
483 1 EA=1;
484 1 TR0=1;
485 1 while(1)
486 1 {
487 2 if(LeftFlag==1)
488 2 {
489 3 LeftDisplay();
C51 COMPILER V7.06 DIAN 10/20/2008 10:56:41 PAGE 9
490 3 }
491 2 if(RightFlag==1)
492 2 {
493 3 RightDisplay();
494 3 }
495 2 if(UpFlag==1)
496 2 {
497 3 UpDisplay();
498 3 }
499 2 if(DownFlag==1)
500 2 {
501 3 DownDisplay();
502 3 }
503 2 if(ZJ1Flag==1)
504 2 {
505 3 ZJDisplay1();
506 3 }
507 2 if(ZJ2Flag==1)
508 2 {
509 3 ZJDisplay2();
510 3 }
511 2 }
512 1 }
513 void timer0(void) interrupt 1
514 {
515 1 TH0=(65535-1000)/256;
516 1 TL0=(65535-1000)%256;
517 1 KeyScan();
518 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2001 ----
CONSTANT SIZE = 320 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 1 5
IDATA SIZE = ---- ----
BIT SIZE = 6 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -