📄 freqen.lst
字号:
359 2 }
360 1
361 1 //--------------------------------------------------------------------
362 1
363 1 if(danwei=='K' && point==1)
364 1
365 1 {
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 7
366 2
367 2 temp=1000000/temp;
368 2
369 2 temp&=0x0000ffff;
370 2
371 2 temp_to_tempx(temp);
372 2
373 2 danwei_t='u';
374 2
375 2 }
376 1
377 1 if(danwei=='K' && point==2)
378 1
379 1 {
380 2
381 2 temp=100000000/temp;
382 2
383 2 temp&=0x0000ffff;
384 2
385 2 temp_to_tempx(temp);
386 2
387 2 danwei_t='n';
388 2
389 2 }
390 1
391 1 if(danwei=='M' && point==0)
392 1
393 1 {
394 2
395 2 temp=10000000/temp;
396 2
397 2 temp&=0x0000ffff;
398 2
399 2 temp_to_tempx(temp);
400 2
401 2 danwei_t='n';
402 2
403 2 }
404 1
405 1 if(danwei=='M' && point==1)
406 1
407 1 {
408 2
409 2 temp=1000000/temp;
410 2
411 2 temp&=0x0000ffff;
412 2
413 2 temp_to_tempx(temp);
414 2
415 2 danwei_t='n';
416 2
417 2 }
418 1
419 1
420 1
421 1 dis_one_zi(2,0,x51,1,1);//周
422 1
423 1 dis_one_zi(2,1,x52,1,1);//期
424 1
425 1 dis_one_char(2,11,0x7f,0);
426 1
427 1 dis_one_char(2,12,danwei_t,1);
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 8
428 1
429 1 dis_one_char(2,13,'S',1);
430 1
431 1 dis_one_char(2,14,0x7f,0);
432 1
433 1 dis_one_char(2,15,0x7f,0);
434 1
435 1 dis_one_char(2,4,0x7f,0);
436 1
437 1 if(temp==65535)
438 1
439 1 {
440 2
441 2 dis_one_char(2,6,'O',1);
442 2
443 2 dis_one_char(2,7,'V',1);
444 2
445 2 dis_one_char(2,8,'E',1);
446 2
447 2 dis_one_char(2,9,'R',1);
448 2
449 2 dis_one_char(2,10,'!',1);
450 2
451 2 }
452 1
453 1 else
454 1
455 1 {
456 2
457 2 dis_one_char(2,6,temp0+0x30,1);
458 2
459 2 if(temp0==0)
460 2
461 2 dis_one_char(2,6,0x7f,0);
462 2
463 2
464 2
465 2 dis_one_char(2,7,temp1+0x30,1);
466 2
467 2 if(temp0==0 && temp1==0)
468 2
469 2 dis_one_char(2,7,0x7f,0);
470 2
471 2
472 2
473 2 dis_one_char(2,8,temp2+0x30,1);
474 2
475 2 if(temp0==0 && temp1==0 && temp2==0)
476 2
477 2 dis_one_char(2,8,0x7f,0);
478 2
479 2
480 2
481 2 dis_one_char(2,9,temp3+0x30,1);
482 2
483 2 if(temp0==0 && temp1==0 && temp2==0 && temp3==0)
484 2
485 2 dis_one_char(2,9 ,0x7f,0);
486 2
487 2
488 2
489 2 dis_one_char(2,10,temp4+0x30,1);
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 9
490 2
491 2 }
492 1
493 1 }
494
495 //--------------------------------------------------------------------
496
497 void delay_1(uchar time)
498
499 {
500 1
501 1 while(--time!=0)
502 1
503 1 delay(50000);
504 1
505 1 }
506
507 //--------------------------------------------------------------------
508
509 void freq() //频率计子程序
510
511 {
512 1
513 1 unsigned long temp=0x30;
514 1
515 1 uchar del=5;
516 1
517 1 timer_init();
518 1
519 1 reset: gate=4;
520 1
521 1 sel_x(100);
522 1
523 1 a1=1;
524 1
525 1 a2='M';
526 1
527 1 while(1)
528 1
529 1 {
530 2
531 2 //---------------------------------------------------
532 2
533 2 key1=1;
534 2
535 2 key0=1;
536 2
537 2 delay_1(5);
538 2
539 2 if(key0==0 || key1==0)
540 2
541 2 goto exit;
542 2
543 2 temp=temp_h*256+temp_l;
544 2
545 2 if(TF1)
546 2
547 2 {
548 3
549 3 TF1=0;
550 3
551 3 TH1=0;
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 10
552 3
553 3 TL1=0;
554 3
555 3 dis_cls();
556 3
557 3 dis_one_zi(0,0,x43,1,1);
558 3
559 3 dis_one_zi(0,1,x44,1,1);
560 3
561 3 dis_one_zi(0,2,x45,1,1);
562 3
563 3 dis_one_zi(0,3,x46,1,1);
564 3
565 3 dis_one_zi(0,4,x47,1,1);
566 3
567 3 dis_one_zi(0,5,x48,1,1);
568 3
569 3 dis_one_zi(0,6,x49,1,1);
570 3
571 3 dis_one_zi(0,7,x50,1,1);
572 3
573 3 goto reset;
574 3
575 3 }
576 2
577 2 temp=temp_h*256+temp_l;
578 2
579 2 if(sel_100==1 && temp<=5000 && gate==4)
580 2
581 2 {
582 3
583 3 sel_x(10);
584 3
585 3 a1=0;
586 3
587 3 a2='M';
588 3
589 3 delay_1(del);
590 3
591 3 }
592 2
593 2 temp=temp_h*256+temp_l;
594 2
595 2 if(sel_10==1 && temp<=5000 && gate==4)
596 2
597 2 {
598 3
599 3 sel_x(1);
600 3
601 3 a1=2;
602 3
603 3 a2='K';
604 3
605 3 delay_1(del);
606 3
607 3 }
608 2
609 2 temp=temp_h*256+temp_l;
610 2
611 2 if(sel_1==1 && temp<=5000 && gate==4)
612 2
613 2 {
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 11
614 3
615 3 gate=40;
616 3
617 3 a1=1;
618 3
619 3 a2='K';
620 3
621 3 delay_1(del);
622 3
623 3 }
624 2
625 2 //---------------------------------------------------
626 2
627 2 temp=temp_h*256+temp_l;
628 2
629 2 if(sel_1==1 && temp>50010 && gate==40)
630 2
631 2 {
632 3
633 3 gate=4;
634 3
635 3 a1=2;
636 3
637 3 a2='K';
638 3
639 3 delay_1(del);
640 3
641 3 }
642 2
643 2
644 2
645 2 temp=temp_h*256+temp_l;
646 2
647 2 if(sel_1==1 && temp>50010 && gate==4)
648 2
649 2 {
650 3
651 3 sel_x(10);
652 3
653 3 a1=0;
654 3
655 3 a2='M';
656 3
657 3 delay_1(del);
658 3
659 3 }
660 2
661 2 temp=temp_h*256+temp_l;
662 2
663 2 if(sel_10==1 && temp>50010 && gate==4)
664 2
665 2 {
666 3
667 3 sel_x(100);
668 3
669 3 a1=1;
670 3
671 3 a2='M';
672 3
673 3 delay_1(del);
674 3
675 3 }
C51 COMPILER V7.50 FREQEN 03/13/2008 13:49:22 PAGE 12
676 2
677 2 if(temp>50000)
678 2
679 2 goto reset;
680 2
681 2
682 2
683 2 dis_mod(temp,a1,a2);
684 2
685 2 //---------------------------------------------------
686 2
687 2 }
688 1
689 1 exit: TMOD=0x00; //T1 做门控计数
690 1
691 1 ET0=0;
692 1
693 1 EA=0;
694 1
695 1 TR0=0;
696 1
697 1 TR1=0;
698 1
699 1 p3_5=0;
700 1
701 1 delay_1(10);
702 1
703 1 keyfuncindex=0;
704 1
705 1 d0();
706 1
707 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1718 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 13
IDATA SIZE = ---- ----
BIT SIZE = 5 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -