📄 mstimer.lst
字号:
390 1 minuteOld = minute;
391 1 hourOld = hour;
392 1 yearOld = year;
393 1 monthOld = month;
394 1 dayOld = day;
395 1 }
396
397 void msTimer(void) interrupt 0 using 0 {
398 1 if (++msCNT == 1) { /* 1s */
399 2 Tsecond++; /* second counter */
400 2 msCNT = 0; /* clear int counter */
401 2 }
402 1 }
403
404 main()
405 {
406 1 UART_Init();
407 1 delay1s();
408 1 delay100ms();
409 1 putchar(15); // Set VFD brightness
410 1 delay100ms();
411 1 putchar(0x20); // Lowest brightness to reduce power consumption
412 1
413 1 // user-defined char #1: \05 \01; show with \01
414 1 putchar(5); putchar(1);
415 1 // SHI: 02 39 17 EE 45 A2 B1 C8 04 06 00
416 1 putchar(0x02);
417 1 putchar(0x39);
418 1 putchar(0x17);
419 1 putchar(0xEE);
420 1 putchar(0x45);
421 1 putchar(0xA2);
422 1 putchar(0xB1);
423 1 putchar(0xC8);
424 1 putchar(0x04);
425 1 putchar(0x06);
426 1 putchar(0x00);
427 1 // user-defined char #2: \05 \02; show with \02
C51 COMPILER V8.05a MSTIMER 03/18/2007 20:51:48 PAGE 8
428 1 putchar(5); putchar(2);
429 1 // JIAN: 40 17 90 4B A5 52 E9 54 BA 43 00
430 1 putchar(0x40);
431 1 putchar(0x17);
432 1 putchar(0x90);
433 1 putchar(0x4B);
434 1 putchar(0xA5);
435 1 putchar(0x52);
436 1 putchar(0xE9);
437 1 putchar(0x54);
438 1 putchar(0xBA);
439 1 putchar(0x43);
440 1 putchar(0x00);
441 1 // user-defined char #3: \05 \03; show with \03
442 1 putchar(5); putchar(3);
443 1 // RI: 00 1F 08 84 43 E1 10 88 7C 00 00
444 1 putchar(0x00);
445 1 putchar(0x1F);
446 1 putchar(0x08);
447 1 putchar(0x84);
448 1 putchar(0x43);
449 1 putchar(0xE1);
450 1 putchar(0x10);
451 1 putchar(0x88);
452 1 putchar(0x7C);
453 1 putchar(0x00);
454 1 putchar(0x00);
455 1 // user-defined char #4: \05 \04; show with \04
456 1 putchar(5); putchar(4);
457 1 // QI: 50 7F 95 4E E7 52 BB F4 AA 55 01 =or= 50 7D D4 AE 77 2A 9F EA A5 95 80
458 1 putchar(0x50);
459 1 putchar(0x7F);
460 1 putchar(0x95);
461 1 putchar(0x4E);
462 1 putchar(0xE7);
463 1 putchar(0x52);
464 1 putchar(0xBB);
465 1 putchar(0xF4);
466 1 putchar(0xAA);
467 1 putchar(0x55);
468 1 putchar(0x01);
469 1
470 1 putchar(22); // Hide cursor
471 1 putchar(13); // Reset display
472 1 putchar(1);
473 1 putchar(2);
474 1 putchar(':');
475 1 putchar(16); // Set cursor position
476 1 putchar(11);
477 1 putchar(3);
478 1 putchar(4);
479 1 putchar('-');
480 1
481 1 delay1s();
482 1 DP8573A_Init();
483 1 P1 = 0x7F; // P1: 1DO + 7DI
484 1 delay1s();
485 1
486 1 // Used to set RTC
487 1 /* DP8573MSR = 0x40;
488 1 DP8573RTMR = 0x00;
489 1 DP8573MIN = 54;
C51 COMPILER V8.05a MSTIMER 03/18/2007 20:51:48 PAGE 9
490 1 DP8573HOUR = 24;
491 1 DP8573DAY = 24;
492 1 DP8573MONTH = 3;
493 1 DP8573YEAR = 7;
494 1 DP8573MSR = 0x40;
495 1 DP8573RTMR = 0x08;
496 1 */
497 1 DisplayRTC();
498 1 delay1s();
499 1 delay1s();
500 1 CmdOld = KeyScan();
501 1
502 1 while(1)
503 1 {
504 2 hour = DP8573HOUR; // Hour
505 2 if (hour != hourOld) {
506 3 putchar(16); // Set cursor position
507 3 putchar(0);
508 3 timeH = hour >> 4;
509 3 putchar(timeH+48);
510 3 timeL = hour % 16;
511 3 putchar(timeL+48);
512 3 putchar(':');
513 3 hourOld = hour;
514 3 }
515 2 minute = DP8573MIN; // Minute
516 2 if (minute != minuteOld) {
517 3 putchar(16); // Set cursor position
518 3 putchar(3);
519 3 timeH = minute >> 4;
520 3 putchar(timeH+48);
521 3 timeL = minute % 16;
522 3 putchar(timeL+48);
523 3 putchar(':');
524 3 minuteOld = minute;
525 3 }
526 2 second = DP8573SEC; // Second
527 2 if (second != secondOld) {
528 3 putchar(16); // Set cursor position
529 3 putchar(6);
530 3 timeH = second >> 4;
531 3 putchar(timeH+48);
532 3 timeL = second % 16;
533 3 putchar(timeL+48);
534 3 secondOld = second;
535 3 }
536 2 year = DP8573YEAR;
537 2 if (year != yearOld) {
538 3 putchar(16); // Set cursor position
539 3 putchar(10);
540 3 timeH = year >> 4;
541 3 putchar(timeH+48);
542 3 timeL = year % 16;
543 3 putchar(timeL+48);
544 3 yearOld = year;
545 3 }
546 2 month = DP8573MONTH;
547 2 if (month != monthOld) {
548 3 putchar(16); // Set cursor position
549 3 putchar(12);
550 3 timeH = month >> 4;
551 3 putchar(timeH+48);
C51 COMPILER V8.05a MSTIMER 03/18/2007 20:51:48 PAGE 10
552 3 timeL = month % 16;
553 3 putchar(timeL+48);
554 3 yearOld = year;
555 3 }
556 2 day = DP8573DAY;
557 2 if (day != dayOld) {
558 3 putchar(16); // Set cursor position
559 3 putchar(14);
560 3 timeH = day >> 4;
561 3 putchar(timeH+48);
562 3 timeL = day % 16;
563 3 putchar(timeL+48);
564 3 dayOld = day;
565 3 }
566 2
567 2 KeyCmd = KeyScan();
568 2 if (KeyCmd == 1) { // RTC adjustment
569 3 AdjustRTC();
570 3 DisplayRTC();
571 3 }
572 2 }
573 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2215 ----
CONSTANT SIZE = 40 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 25 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -