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

📄 main.lst

📁 此程序用于恒温箱控制
💻 LST
📖 第 1 页 / 共 2 页
字号:
 156   6                                      {Hot_times=8;}
 157   6                               
 158   6                                else if(comparetemp>=0x10)
 159   6                                      {if(comparetemp>=pre_comparetemp)
 160   7                                                  {same_tempcha_times++; 
 161   8                                                   if(same_tempcha_times>=0x06)
 162   8                                                      {adj_hot_times--;same_tempcha_times=0;pre_comparetemp=comparetemp;}
 163   8                                                  }
 164   7                                       else  {pre_comparetemp=comparetemp;same_tempcha_times=0;}
 165   7                                        comparetemp&=0x00000f0;     
 166   7                                        switch(comparetemp)
 167   7                                        
 168   7                                                  {
 169   8                                                 // case  0x80:     Hot_times=(adj_hot_times-18);break;
 170   8                                                  case  0x70:     Hot_times=(adj_hot_times-13);break;
 171   8                                                   case  0x60:     Hot_times=(adj_hot_times-12);break;
 172   8                                                   case  0x50:     Hot_times=(adj_hot_times-11);break;
 173   8                                                   case  0x40:     Hot_times=(adj_hot_times-10);break;
 174   8                                                   case  0x30:     Hot_times=(adj_hot_times-9);break;
 175   8                                                   case  0x20:     Hot_times=(adj_hot_times-8);break;
 176   8                                                   case  0x10:     Hot_times=(adj_hot_times-7);break;
 177   8                                                      default:_nop_();
 178   8                                                  }
 179   7                                      }
C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 4   

 180   6                                else if(comparetemp>=2)       
 181   6                                {
 182   7                                            if(comparetemp>=pre_comparetemp)
 183   7                                                  {same_tempcha_times++; 
 184   8                                                   if(same_tempcha_times>= 0x15)
 185   8                                                  {adj_hot_times--;same_tempcha_times=0;pre_comparetemp=comparetemp;}
 186   8                                                  }
 187   7                                       else  {pre_comparetemp=comparetemp;same_tempcha_times=0;}
 188   7                                      if((comparetemp<=0xf)&&(comparetemp>10))
 189   7                                                   Hot_times=(adj_hot_times-6);
 190   7                                       else if((comparetemp<= 10)&&(comparetemp>6))
 191   7                                                    Hot_times=(adj_hot_times-5);           
 192   7                                       else if((comparetemp<= 6)&&(comparetemp>3))
 193   7                                                    Hot_times=(adj_hot_times-4);
 194   7                                        else Hot_times=(adj_hot_times-3);
 195   7                                           
 196   7                                }  
 197   6                                else Hot_times=(adj_hot_times-2);
 198   6                                }//if(Hot_times>15)
 199   5                               }//else
 200   4                   if( (Hot_times<71)&&(Hot_times>7)) 
 201   4                   { 
 202   5                    if (Hot_times>heat_value)
 203   5                    {temp2=Hot_times-heat_value; heat_bit=1;}
 204   5                      else 
 205   5                   {temp2=heat_value-Hot_times; heat_bit=0; }
 206   5                      heat_value=Hot_times;
 207   5                       x9318(heat_bit,temp2);
 208   5                   }
 209   4                 }//if(t1s2)   
 210   3               }//if(t1s1)
 211   2             } //while(1)                
 212   1           }
 213          void init_CPU()
 214          {
 215   1       
 216   1              /*SCON=0x50;*/
 217   1              TMOD=0x21; // T1:baut,T0:Time 16bit
 218   1              TCON=0x50; // TR0,TR1=1.低电平触发,IT0=IT1=0; 
 219   1              TH1=0xfd;TL1=0xfd;PCON=0; // Uart Baut=9600
 220   1              TH0=0x4c;TL0=0x00;  // T0=50ms
 221   1              //T2CON=0x04; // T2:Time 16bit
 222   1              //RCAP2H=0x00;RCAP2L=0x00;
 223   1              IE=0x92; //开全局中断,定时器0。串口中断。/关两个外部中断EX0=EX1=0;
 224   1              IP=0x10; // UART高
 225   1              //AUXR=0x00;//内部XRAM,ALE为1/6FOSC,AUXR=0x10外部XRAM
 226   1              AUXR=0x01; //ALE IS common 
 227   1      }
 228           
 229           
 230           
 231          void T0_int() interrupt 1 using 2
 232          {       TR0=0;
 233   1              TH0=0x4c;
 234   1              TL0=0x00; // T0=50ms
 235   1              t50ms++;
 236   1              t1s2++;         
 237   1              if(t50ms>=20)
 238   1              {
 239   2                      t50ms=0;                
 240   2                      t1s1++; 
 241   2                      t1s2++; 
C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 5   

 242   2              }
 243   1              //if(t1s2>=20)
 244   1              //{    
 245   1                      //t1s2=0;       
 246   1                      //flagtemp=0; 
 247   1              //}
 248   1              
 249   1              
 250   1              TR0=1;
 251   1      }
 252           
 253          void x9318(bit ud, uchar dat)
 254            {
 255   1          CS=0;
 256   1          if(ud) UD=1;//为UP
 257   1           else  UD=0;//为DOWN
 258   1            
 259   1              for(;dat>0;dat--) 
 260   1              {
 261   2                INC=1;
 262   2                delay(1);
 263   2                INC=0;
 264   2                 delay(1);
 265   2               } 
 266   1               INC=1;
 267   1               delay(1);
 268   1                CS=1;
 269   1                      
 270   1        }
 271          void delay(uint dat)      //延时秒位单位
 272           { 
 273   1        
 274   1               uchar i;
 275   1              while(dat--)
 276   1              {
 277   2                      WDT=1;
 278   2                      for(i=0;i<120;i++)
 279   2                      {;}
 280   2              }
 281   1        
 282   1       }
 283           
 284          void reset_5045()
 285            { 
 286   1              uchar i;
 287   1              for(i=0;i<9;i++)
 288   1               {
 289   2               Byte_Write(0,i,0);     
 290   2               }      
 291   1               Byte_Write(0,10,10);   
 292   1                x9318(0,100);
 293   1         }    
 294          
 295          
 296          
 297           
 298          
 299           
 300           
 301           
 302           

C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 6   


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1228    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     10       5
   IDATA SIZE       =     10    ----
   BIT SIZE         =      1       1
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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