📄 cm160128.lst
字号:
538 2 DISHAZIT(17,8*9,0x05);
539 2 }
540 1
541 1 switch(ucAmpMW)
542 1 {
543 2 case 0x02:
544 2 case 0x0a:
545 2 ucAmpMW = 4;
546 2 break;
547 2 case 0x03:
548 2 case 0x0b:
549 2 ucAmpMW = 16;
550 2 break;
551 2 case 0x04:
C51 COMPILER V7.06 CM160128 03/08/2008 16:45:23 PAGE 10
552 2 case 0x0c:
553 2 ucAmpMW = 64;
554 2 break;
555 2 default:
556 2 ucAmpMW = 1;
557 2 break;
558 2 }
559 1
560 1 DISDASC(0x0b,0x0b,0x96);
561 1 DISDASC(0x0d,0x0b,0x80+(ucAmpMW/10)*2);
562 1 DISDASC(0x0e,0x0b,0x80+(ucAmpMW%10)*2);
563 1 }
564 //显示负高压值
565 void DispVoltege(unsigned char ucData)
566 {
567 1 unVolt = HVOLT[ucData];
568 1
569 1 if(unVolt < 200)//高压小于200时显示为"0"
570 1 {
571 2 unVolt = 0;
572 2 }
573 1
574 1 DISDASC(0x0b,0x0d,0x9c);
575 1
576 1 DISDASC(0x0f,0x0d,0x80+(unVolt%10)*2);
577 1 unVolt /= 10;
578 1 DISDASC(0x0e,0x0d,0x80+(unVolt%10)*2);
579 1 unVolt /= 10;
580 1 DISDASC(0x0d,0x0d,0x80+(unVolt%10)*2);
581 1 unVolt /= 10;
582 1 DISDASC(0x0c,0x0d,0x80+(unVolt%10)*2);
583 1 DISDASC(0x10,0x0d,0xa4);
584 1 }
585
586 void InitTimer0(void)
587 {
588 1 TMOD=(TMOD&0xf0)|0x01;//MODE 1
589 1 ET0=1;//
590 1 TH0=0;
591 1 TL0=0;
592 1 TR0=1;//
593 1 }
594
595 //波特率发生器9600bps
596 void inittimer1()
597 { TMOD=0x21;
598 1 TCON=0x44;
599 1 PCON=0;
600 1 SCON=0x50;
601 1 ES=1;
602 1 TH1=0xfd;
603 1 TL1=0Xfd;
604 1 //TH1=0xfa;
605 1 //TL1=0Xfa;
606 1 TR1=1;
607 1 }
608
609 void delay_ms(int ms)
610 {
611 1 int i = 0;
612 1 int j = 0;
613 1
C51 COMPILER V7.06 CM160128 03/08/2008 16:45:23 PAGE 11
614 1 for(i = ms; i > 0; i--)
615 1 {
616 2 j = 1000;
617 2 while(j--)
618 2 {
619 3 }
620 2 }
621 1 }
622 //-------------main function-------------------
623 void main()
624 {
625 1 int i = 0;
626 1 int j = 0;
627 1 unsigned char data h = 0;
628 1
629 1 INT_1(); /* 初始化函数 */
630 1 CLEAR(); /* 清屏函数 */
631 1 inittimer1(); //初始化定时计数器T1
632 1 InitTimer0(); //初始化定时计数器T0
633 1 ET0 = 0;
634 1 EA = 1; //开中断
635 1 ShowWelcome();//开机画面
636 1 delay_ms(500);
637 1 CLEAR();
638 1
639 1 //显示"仪器正在预热"
640 1 ShowHeat();
641 1
642 1 while(!bStart)//"bStart = 0"仪器处于预热状态
643 1 {
644 2 INT_1(); /* 初始化函数 */
645 2 //显示"仪器正在预热"
646 2 ShowHeat();
647 2 //CLEAR(); /* 清屏函数 */
648 2 for(i = 0x14; i < 0x17; i++)
649 2 {
650 3 DISHAZIT(14,8*7,i);
651 3 DISHAZIT(15,8*7,i);
652 3 DISHAZIT(16,8*7,i);
653 3 DISHAZIT(17,8*7,i);
654 3 delay_ms(20);
655 3 }
656 2 }
657 1 INT_1(); /* 初始化函数 */
658 1 CLEAR(); /* 清屏函数 */
659 1 CGRAM(); /* 建立CGRAM内字库函数 */
660 1 ShowSample();
661 1 ShowEXG();
662 1 ShowMIN();
663 1 DISDASC(18,0x05,0x9e);//显示"m"
664 1 DISDASC(19,0x05,0x9a);//显示"V"
665 1
666 1 ET0 = 1;
667 1 while(1)
668 1 {
669 2 INT_1(); /* 初始化函数 */
670 2 /* 汉字写入(文本方式)*/
671 2 //CLEAR();
672 2 if(unLCDRefresh > 1000) //由定时器T0实现延时的刷屏操作约为:71秒
673 2 {
674 3 unLCDRefresh = 0;
675 3 CLEAR();
C51 COMPILER V7.06 CM160128 03/08/2008 16:45:23 PAGE 12
676 3 CGRAM(); /* 建立CGRAM内字库函数 */
677 3 ShowSample();
678 3 ShowEXG();
679 3 ShowMIN();
680 3 DISDASC(18,0x05,0x9e);//显示"m"
681 3 DISDASC(19,0x05,0x9a);//显示"V"
682 3 //DispSampleVoltage(intSmpVal);
683 3 }
684 2 //if(bUpdateSV)
685 2 //{
686 2 DispSampleVoltage(intSmpVal);//显示采样值
687 2 //bUpdateSV = 0;
688 2 //}
689 2 //if(bUpdateSmpT)
690 2 {
691 3 DispSampleTime(ucSmpT);//显示采样时间
692 3 //bUpdateSmpT = 0;
693 3 }
694 2 //if(bUpdateMW)
695 2 //{
696 2 DispAmpMultiple(ucMW2);//显示放大倍数
697 2 //bUpdateMW = 0;
698 2 //}
699 2 //if(bUpdateVolt)
700 2 //{
701 2 DispVoltege(ucVolt);//显示负高压值
702 2 // bUpdateVolt = 0;
703 2 //}
704 2 }
705 1 }
706
707 void T0_Serve() interrupt 1
708 {
709 1 TH0=0;// 500次/s,50ms为基本单位
710 1 TL0=0;
711 1
712 1 if(bStart) unLCDRefresh ++;
713 1 }
714
715 void SCom_Serve(void) interrupt 4 using 2 //S_COM Interrupt serve
716 {
717 1 unsigned char ucDataL = 0;
718 1 unsigned char ucDataH = 0;
719 1
720 1 if(RI == 1)//getting message
721 1 {
722 2 ucDataL = SBUF&0x0f;//temporary store the SBUF's low 4 bits data
723 2 ucDataH = SBUF&0xf0;//temporary store the SBUF's high 4 bits data
724 2 switch(ucDataH)
725 2 {
726 3 case 0x10://receive the low 4 bits of Sample Voltage
727 3 intTmpSmpVal = ucDataL;
728 3 bUpdateSV1 = 1;//
729 3 break;
730 3 case 0x20://receive the middle 4 bits of Sample Voltage
731 3 if(bUpdateSV1)
732 3 {
733 4 intTmpSmpVal += ucDataL*0x10;
734 4 bUpdateSV2 = 1;
735 4 }
736 3 break;
737 3 case 0x30://receive the high 4 bits of Sample Voltage
C51 COMPILER V7.06 CM160128 03/08/2008 16:45:23 PAGE 13
738 3 if(bUpdateSV1 & bUpdateSV2)
739 3 {
740 4 intTmpSmpVal += ucDataL*0x0100;
741 4 intSmpVal = intTmpSmpVal;
742 4 bUpdateSV = 1;//success in receiving the Value of Sample Voltage
743 4 bUpdateSV1 = 0;
744 4 bUpdateSV2 = 0;
745 4 if(!bStart)//"bStart = 0" means the equipment is in heating.
746 4 {
747 5 intTestVolt[countVolt++] = intTmpSmpVal;
748 5 if(countVolt > 1)
749 5 {
750 6 countVolt = 0;
751 6 }
752 5 if(abs(intTestVolt[1] - intTestVolt[0]) < 20)//预热判断
753 5 {
754 6 countSuccess++;
755 6 if(countSuccess > 50)
756 6 {
757 7 bStart = 1;//预热结束
758 7 }
759 6 }
760 5 else
761 5 {
762 6 countSuccess = 0;
763 6 }
764 5 }
765 4 }
766 3 break;
767 3 case 0x40://receive the data of measure width (Amplify)
768 3 ucMW2 = ucDataL;
769 3 bUpdateMW = 1;
770 3 break;
771 3 case 0x50://receive the data of the interval of sampling
772 3 ucSmpT = ucDataL;
773 3 bUpdateSmpT = 1;
774 3 break;
775 3 case 0x60://receive the low 4 bits data of minus high voltage
776 3 ucTmpVolt = ucDataL;
777 3 bUpdateVolt1 = 1;
778 3 break;
779 3 case 0x70://recefive the high 4 bits data of minus high voltage
780 3 if(bUpdateVolt1 == 1)
781 3 {
782 4 ucTmpVolt += ucDataL*0x10;
783 4 bUpdateVolt = 1;//success in receiving the data of minus high voltage
784 4 bUpdateVolt1 = 0;
785 4 ucVolt = ucTmpVolt;
786 4 }
787 3 break;
788 3 }
789 2 RI = 0;
790 2 }
791 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2741 ----
CONSTANT SIZE = 6262 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 34 35
C51 COMPILER V7.06 CM160128 03/08/2008 16:45:23 PAGE 14
IDATA SIZE = ---- ----
BIT SIZE = 9 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -