⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 自己写的测试程序,调试已通过,可以直接使用, 而且有的还有详细的注释.红外测试软件
💻 LST
📖 第 1 页 / 共 5 页
字号:
 708   1         if(temp<-880|temp>2000|temp==-1)
 709   1                         {if(j<=3){write_word(0,y,28,&chinese[51]);
 710   3                                                write_word(0,y,44,&chinese[52]);}
 711   2                                               else{write_word(1,y,28,&chinese[51]);
 712   3                                                write_word(1,y,44,&chinese[52]);}      
 713   2                                                    err=1;                 // err control r ,l
 714   2                                                  }
 715   1         if(temp<0){temp*=(-1);qq=1;}                 // qq control z ,f
 716   1         temp*=0.0625;                  
 717   1                                                   if(~err)
 718   1                                                                                                  {
 719   2                                                                                                       read_iic_data(1,&iic_read,0,8);        //继电器
 720   2                                                                                                         if(iic_read[3]==1){down=iic_read[1]*(-1);}
 721   2                                                                                                             else down=iic_read[1];
 722   2                                                                                                          if(iic_read[4]==1){up=iic_read[2]*(-1);}
 723   2                                                                                                              else {up=iic_read[2];}
 724   2                                                       if(temp<=down|temp>=up)
 725   2                                                                                                         {
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 13  

 726   3                                                                                                          call=0;
 727   3                                                                                                         }
 728   2                                                                                                   }
 729   1       
 730   1           h=temp/100;
 731   1        if(j<=3){ if(h==0){w0-=7;}                   //w0    
 732   2      
 733   2         write_byte(0,y,7,&number[25]);
 734   2         write_byte(0,y,18,&number[22]);
 735   2      
 736   2         
 737   2       
 738   2       if(~err){if(qq){write_byte(0,y,23,&number[25]);}   //负号!
 739   3                write_byte(0,y,w0+18,&number[26]);
 740   3                write_byte(0,y,w0+26,&number[12]);}
 741   2        
 742   2        write_byte(0,y,0,&number[i+10]);
 743   2        write_byte(0,y,12,&number[j]);    
 744   2         if(~err){               
 745   3        if(h==1)
 746   3           {
 747   4         write_byte(0,y,w0,&number[h]);}
 748   3        z=(temp-(h*100))/10;
 749   3         write_byte(0,y,w0+7,&number[z]);
 750   3        z=temp%10;
 751   3         write_byte(0,y,w0+14,&number[z]);
 752   3         }}
 753   1        else
 754   1        {
 755   2           if(h==0){w1-=7;}
 756   2        write_byte(1,y,10,&number[25]);
 757   2        write_byte(1,y,21,&number[22]);    //:
 758   2        if(~err){if(qq){write_byte(1,y,26,&number[25]);}   //负号!
 759   3                write_byte(1,y,w1+26,&number[12]);  
 760   3                write_byte(1,y,w1+18,&number[26]);
 761   3                }
 762   2      
 763   2      
 764   2       
 765   2        write_byte(1,y,3,&number[i+10]);
 766   2        write_byte(1,y,15,&number[j]);
 767   2      
 768   2        if(~err)
 769   2          {                         
 770   3        
 771   3        if(h==1){
 772   4         write_byte(1,y,w1,&number[h]);}
 773   3        z=(temp-(h*100))/10;
 774   3         write_byte(1,y,w1+7,&number[z]);
 775   3        z=temp%10;
 776   3         write_byte(1,y,w1+14,&number[z]);
 777   3         }}
 778   1                                  // SEND RS485
 779   1                            if(err){t_buf[(i*6+j)*2-1]=i*6+j; t_buf[(i*6+j)*2]=0xfe;}
 780   1                             else {t_buf[(i*6+j)*2-1]=i*6+j; t_buf[(i*6+j)*2]=temp&0xff; }  
 781   1              
 782   1       }
 783          /********************  display single temp *********************************************/
 784          void display_temp_single(unsigned i,unsigned char j,short int temp)
 785          {
 786   1       unsigned char y,z,h,w0,w1;
 787   1       signed char down,up;
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 14  

 788   1       bit err,qq;                                                            
 789   1       err=0;
 790   1       qq=0;
 791   1       w0=28;w1=31;
 792   1        
 793   1       z=0;
 794   1       if(j==1|j==4){y=2;}
 795   1       if(j==2|j==5){y=4;}
 796   1       if(j==3|j==6){y=6;}
 797   1      // if(j==4|j==8){y=6;}
 798   1                                                     if(j<=3){
 799   2                                                    //      write_byte(0,y,23,&number[19]); 
 800   2                                                   //        write_byte(0,y,31,&number[19]); 
 801   2                                                   //        write_byte(0,y,39,&number[19]);
 802   2                                                   //         write_byte(0,y,47,&number[19]); 
 803   2                                                           write_byte(0,y,55,&number[19]); }
 804   1                                                    if(j>3){ write_byte(1,y,23,&number[19]); 
 805   2                                                      //     write_byte(1,y,31,&number[19]); 
 806   2                                                     //      write_byte(1,y,39,&number[19]);
 807   2                                                     //       write_byte(1,y,47,&number[19]); 
 808   2                                                           write_byte(1,y,55,&number[19]); }
 809   1      
 810   1         if(temp<-880|temp>2000|temp==-1)
 811   1                         {if(j<=3){write_word(0,y,28,&chinese[51]);
 812   3                                                write_word(0,y,44,&chinese[52]);}
 813   2                                               else{write_word(1,y,28,&chinese[51]);
 814   3                                                write_word(1,y,44,&chinese[52]);}      
 815   2                                                    err=1;                 // err control r ,l
 816   2                                                  }
 817   1         if(temp<0){temp*=(-1);qq=1;}                 // qq control z ,f
 818   1         temp*=0.0625;                  
 819   1                                                   if(~err)
 820   1                                                                                                  {
 821   2                                                                                                       read_iic_data(1,&iic_read,0,8);        //继电器
 822   2                                                                                                         if(iic_read[3]==1){down=iic_read[1]*(-1);}
 823   2                                                                                                             else down=iic_read[1];
 824   2                                                                                                          if(iic_read[4]==1){up=iic_read[2]*(-1);}
 825   2                                                                                                              else {up=iic_read[2];}
 826   2                                                       if(temp<=down|temp>=up)
 827   2                                                                                                         {
 828   3                                                                                                          call=0;
 829   3                                                                                                         }
 830   2                                                                                                   }
 831   1                              // SEND RS485
 832   1                            if(err){t_buf[(i*6+j)*2-1]=i*6+j; t_buf[(i*6+j)*2]=0xfe;}
 833   1                             else {t_buf[(i*6+j)*2-1]=i*6+j; t_buf[(i*6+j)*2]=temp&0xff; }  
 834   1       
 835   1                       
 836   1           h=temp/100;                   
 837   1        if(j<=3){ if(h==0){w0-=7;}                   //w0    
 838   2                      
 839   2         write_byte(0,y,7,&number[25]);             //-
 840   2         write_byte(0,y,18,&number[22]);           //:
 841   2      
 842   2      
 843   2      
 844   2        
 845   2       if(~err){if(qq){write_byte(0,y,23,&number[25]);}   //负号!
 846   3                write_byte(0,y,w0+18,&number[26]);
 847   3                write_byte(0,y,w0+26,&number[12]);}
 848   2                        
 849   2                        
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 15  

 850   2        write_byte(0,y,0,&number[j+10-1]);
 851   2        write_byte(0,y,12,&number[1]);    
 852   2         if(~err){            
 853   3        if(h==1)
 854   3           {
 855   4         write_byte(0,y,w0,&number[h]);}
 856   3        z=(temp-(h*100))/10;
 857   3         write_byte(0,y,w0+7,&number[z]);
 858   3        z=temp%10;
 859   3         write_byte(0,y,w0+14,&number[z]);
 860   3         }}
 861   1        else
 862   1        {  
 863   2                                                           
 864   2      
 865   2           if(j>3){j-=3;}
 866   2           if(h==0){w1-=7;}
 867   2        write_byte(1,y,10,&number[25]);
 868   2        write_byte(1,y,21,&number[22]);    //:
 869   2        if(~err){if(qq){write_byte(1,y,26,&number[25]);}   //负号!
 870   3                write_byte(1,y,w1+26,&number[12]);  
 871   3                write_byte(1,y,w1+18,&number[26]);
 872   3                }
 873   2      
 874   2      
 875   2       
 876   2        write_byte(1,y,3,&number[j+10-1]);
 877   2        write_byte(1,y,15,&number[2]);
 878   2      
 879   2        if(~err)
 880   2          {                         
 881   3        
 882   3        if(h==1){
 883   4         write_byte(1,y,w1,&number[h]);}
 884   3        z=(temp-(h*100))/10;
 885   3         write_byte(1,y,w1+7,&number[z]);
 886   3        z=temp%10;
 887   3         write_byte(1,y,w1+14,&number[z]);
 888   3         }}
 889   1                             
 890   1              
 891   1       }
 892          
 893          /**************  timer interrupt 0 *********************************/
 894           void time_0(void)interrupt 1 using 3
 895           {
 896   1         
 897   1        ch451_clk=0;
 898   1        ch451_clk=1;
 899   1        base_time=!base_time;
 900   1      
 901   1        TH0=0x00;
 902   1        TL0=0x00;
 903   1      //  if(flag_s){ok_es++;if(ok_es>500){ok_es=0;ES=0;}}
 904   1        if(flag_exit){ok_n_times++;}
 905   1        if(ok_n_times>100){flag_exit_ok=1;ok_n_times=0;}
 906   1      
 907   1       }
 908          
 909          ///////////////////////////////////////////////////////////////////////////////////////////////////////
 910          ///////////////////////////////////////////////////////////////////////////////////////////////////////
 911          
C51 COMPILER V7.06   MAIN                                                                  03/26/2008 16:30:50 PAGE 16  

 912          /*********   ch451 init *************************/
 913          void ch451_init(void)
 914          {
 915   1       ch451_din=0;
 916   1       ch451_din=1;
 917   1       
 918   1       ch451_load=1;
 919   1       ch451_clk=1;
 920   1       _nop_();
 921   1       }
 922          /************  write 12 bit to ch451 *************/
 923          void ch451_write(unsigned short int command)
 924          {
 925   1       unsigned char i;
 926   1       EX1=0;
 927   1       ch451_load=0;
 928   1       for(i=0;i<12;i++)
 929   1        {
 930   2         ch451_din=command&1;
 931   2         ch451_clk=0;
 932   2         command>>=1;
 933   2         ch451_clk=1;
 934   2         }
 935   1        ch451_load=1;
 936   1       EX1=1;
 937   1       }
 938          
 939          /**********  CH451 interrupt **************************/
 940          
 941          void ch451_inter() interrupt 2 using 1
 942          {
 943   1       key_flag=1;
 944   1      }
 945          /**********   bring a key code  ************************/
 946          unsigned char key_code()
 947          {
 948   1       unsigned char i;
 949   1       unsigned char command,keycode;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -