📄 main.lst
字号:
397 5 now.minute++;
398 5 if(now.minute==60) now.minute=0;
399 5 write_time(1,4,now.minute);
400 5 gotoxy(2,5);
401 5 }
402 4 if(mode_num==6)
403 4 {
404 5 now.second++;
405 5 if(now.second==60) now.second=0;
406 5 write_time(2,7,now.second);
407 5 gotoxy(2,8);
408 5 }
409 4 }
410 3 }
411 2 if(dec==0)
412 2 {
413 3 delay(5);
414 3 if(dec==0)
415 3 { dec=1;
416 4 while(!dec);
417 4 if(mode_num==1)
418 4 {
419 5 today.year--;
420 5 write_riqi(1,today.year/100);
421 5 write_riqi(3,today.year%100);
422 5 gotoxy(1,12);
423 5 display_week();
424 5 gotoxy(1,4);
425 5 }
426 4 if(mode_num==2)
C51 COMPILER V8.02 MAIN 05/14/2008 01:19:09 PAGE 8
427 4 {
428 5 today.month--;
429 5 if(today.month==0) today.month=12;
430 5 write_riqi(6,today.month);
431 5 gotoxy(1,12);
432 5 display_week();
433 5 gotoxy(1,7);
434 5 }
435 4 if(mode_num==3)
436 4 {
437 5 today.day--;
438 5 if(today.day==0)
439 5 today.day=monthday(today.year,today.month);
440 5 write_riqi(9,today.day);
441 5 gotoxy(1,12);
442 5 display_week();
443 5 gotoxy(1,10);
444 5 }
445 4 if(mode_num==4)
446 4 {
447 5 now.hour--;
448 5 if(now.hour<0) now.hour=23;
449 5 write_time(0,1,now.hour);
450 5 gotoxy(2,2);
451 5 }
452 4 if(mode_num==5)
453 4 {
454 5 now.minute--;
455 5 if(now.minute<0) now.minute=59;
456 5 write_time(1,4,now.minute);
457 5 gotoxy(2,5);
458 5 }
459 4 if(mode_num==6)
460 4 {
461 5 now.second--;
462 5 if(now.second<0) now.second=59;
463 5 write_time(2,7,now.second);
464 5 gotoxy(2,8);
465 5 }
466 4 }
467 3 }
468 2 }
469 1 /* ss=int_to_char[now.hour/10];//时十位
470 1 sg=int_to_char[now.hour%10];//时个位
471 1 fs=int_to_char[now.minute/10];//分十位
472 1 fg=int_to_char[now.minute%10];// 分各位
473 1 ms=int_to_char[now.second/10];//秒十位
474 1 mg=int_to_char[now.second%10];//秒个位 */
475 1 }
476
477
478 /**********************************************************/
479 void belay(unsigned char x) //x*0.14MS
480 {
481 1 unsigned char i;
482 1 while(x--)
483 1 {
484 2 for (i = 0; i<13; i++) {}
485 2 }
486 1 }
487
488 /**********************************************************/
C51 COMPILER V8.02 MAIN 05/14/2008 01:19:09 PAGE 9
489
490
491 void display_temp()
492 {
493 1 uint wendu;
494 1 uchar A1,A2;
495 1 tmpchange();
496 1 wendu=tmp();
497 1 A1=wendu/10;
498 1 A2=wendu%10;
499 1 gotoxy(2,10);
500 1 display_data(3,A1);
501 1 display_string(".");
502 1 write_date(int_to_char[A2]);
503 1 displaybuffer[3]=A1/10;
504 1 displaybuffer[2]=A1%10;
505 1 displaybuffer[1]=A2%10;
506 1 }
507
508 void timer0(void) interrupt 1
509 {
510 1 TR0=0;
511 1 TL0=(TIMER0_COUNT & 0X00FF);//设置Timer0低八位数值
512 1 TH0=(TIMER0_COUNT >> 8);//设置Timer0高八位数值
513 1 TR0=1;
514 1 count++;
515 1 if(count==30) display_temp();
516 1 if(count==200)
517 1 {
518 2 count=0;
519 2 now.second++;
520 2 if(now.second==60)
521 2 {
522 3 now.second=0;
523 3 now.minute++;
524 3 if(now.minute==60)
525 3 {
526 4 now.minute=0;
527 4 now.hour++;
528 4 if(now.hour==24)
529 4 {
530 5 now.hour=0;
531 5 today.day++;
532 5 if(today.day>monthday(today.year,today.month))
533 5 {
534 6 today.day=1;
535 6 today.month++;
536 6 if(today.month==13)
537 6 {
538 7 today.month=1;
539 7 today.year++;
540 7 }
541 6 write_riqi(6,today.month);
542 6 }
543 5 write_riqi(9,today.day);
544 5 gotoxy(1,12);
545 5 display_week();
546 5 }
547 4
548 4 write_time(0,1,now.hour);
549 4 }
550 3
C51 COMPILER V8.02 MAIN 05/14/2008 01:19:09 PAGE 10
551 3 write_time(1,4,now.minute);
552 3 }
553 2
554 2
555 2
556 2 write_time(2,7,now.second);
557 2 }
558 1
559 1 }
560
561 void main()
562 {
563 1 IE = 0x85; //允许总中断中断,使能 INT0 外部中断
564 1 TCON = 0x01; //触发方式为脉冲负边沿触发
565 1
566 1 IRIN=1;
567 1 init_lcd();
568 1
569 1
570 1 timer0_initialize();
571 1 gotoxy(1,1);
572 1 display_string("2008/01/29 ");
573 1 display_week();
574 1 gotoxy(2,1);
575 1 display_string("00:00:00");
576 1 gotoxy(2,10);
577 1 display_string("00.0C");
578 1 while(1) ;//keyscan();
579 1
580 1 }
581
582
583
584
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2215 ----
CONSTANT SIZE = 80 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 56 10
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -