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

📄 wash.lst

📁 单片机仿真51设计1.洗衣机控制C语言版
💻 LST
📖 第 1 页 / 共 2 页
字号:
 222   4                              delay1ms();  
 223   4                              if(P0_2==0) 
 224   4                              {
 225   5                                      if(strong==1)  //strong__强洗 
 226   5                                      {
 227   6                                              power=1;
 228   6                                              dispbuf[0]=power%10; 
 229   6                                              dispbuf[1]=power/10;
 230   6                                      }
 231   5                                      if(weak==1)   //weak__弱洗 
 232   5                                      {
 233   6                                              power=2;
 234   6                                              dispbuf[0]=power%10; 
 235   6                                              dispbuf[1]=power/10; 
 236   6                                      }
 237   5                                      if(hwtime==1) //hwtime__洗衣时间
 238   5                                      {
 239   6                                              delay02s();
 240   6                                              htime++;
 241   6                                              dispbuf[0]=htime%10; 
C51 COMPILER V8.02   WASH                                                                  06/05/2008 18:57:26 PAGE 5   

 242   6                                              dispbuf[1]=htime/10;            
 243   6                                      }
 244   5                                      if(uwtime==1) //uwtime__脱水时间
 245   5                                      {
 246   6                                              delay02s();
 247   6                                              utime++;
 248   6                                              dispbuf[0]=utime%10; 
 249   6                          dispbuf[1]=utime/10;                        
 250   6                                      }  
 251   5                                      if(count==1)  //count__洗涤次数
 252   5                                      {
 253   6                                              delay02s();
 254   6                                              cnt++;
 255   6                                              dispbuf[0]=cnt%10; 
 256   6                                              dispbuf[1]=cnt/10;              
 257   6                                      }
 258   5                              }
 259   4                      }
 260   3                      //减键功能// 
 261   3                      if(P0_3==0)        
 262   3              { 
 263   4                              delay1ms(); 
 264   4                              if(P0_3==0) 
 265   4                              {
 266   5                                      if(strong==1)  //strong__强洗
 267   5                                      {}
 268   5                                      if(weak==1)  //weak__弱洗 
 269   5                                      {}
 270   5                          if(hwtime==1) //hwtime__洗衣时间
 271   5                                      {
 272   6                                              delay02s();
 273   6                                              htime--;
 274   6                                              dispbuf[0]=htime%10; 
 275   6                                              dispbuf[1]=htime/10;
 276   6                                      }
 277   5                              if(uwtime==1) //uwtime__脱水时间
 278   5                                      {
 279   6                                              delay02s();
 280   6                                              utime--;
 281   6                                              dispbuf[0]=utime%10; 
 282   6                                              dispbuf[1]=utime/10;
 283   6                                      }
 284   5                                      if(count==1)  //count__洗涤次数
 285   5                                      {
 286   6                                              delay02s();
 287   6                                              cnt--;
 288   6                                              dispbuf[0]=cnt%10; 
 289   6                                              dispbuf[1]=cnt/10;
 290   6                                      }
 291   5                              }
 292   4                      }
 293   3              }
 294   2      //确认执行洗衣//
 295   2      st:while(startok==1)
 296   2         {
 297   3                      keye=0;
 298   3                      P2_0=1;              //进水水龙头开
 299   3                      ready=0;
 300   3                      strong=0;
 301   3                      weak=0;
 302   3                      hwtime=0;
 303   3                      uwtime=0;
C51 COMPILER V8.02   WASH                                                                  06/05/2008 18:57:26 PAGE 6   

 304   3                      count=0;
 305   3                      while(full==1)                   //水满
 306   3                      {
 307   4                              P0_5=1;
 308   4                              P0_6=1;
 309   4                              P0_7=0;
 310   4                              P2_0=0;                 //进水水龙头关          
 311   4                              minite=htime;
 312   4                              TR0=1;                  //启动计时              
 313   4                              while(minite!=0)
 314   4                              {}
 315   4                              TR0=0;           
 316   4                              while(1)
 317   4                              { 
 318   5                                      P2_1=1;         //出水水龙头开
 319   5                                      full=0;
 320   5                                      while(empty==1)
 321   5                                      {
 322   6                                              empty=0;
 323   6                                              P2_1=0;         //出水水龙头关
 324   6                                              cnt--;
 325   6                                              while(cnt!=0)
 326   6                                              {goto st;}
 327   6                                              P0_5=1;
 328   6                                          P0_6=1;
 329   6                                              P0_7=1; 
 330   6                                              minite=utime;
 331   6                                              //强洗模式//      
 332   6                                              while(power==1)
 333   6                                              {       
 334   7                                                      TR0=1;                  //启动计时        
 335   7                                                  P2_3=1;             //强洗 电机开
 336   7                                                      P2_4=0;
 337   7                                                      while(minite==0)
 338   7                                                      {
 339   8                                                              TR0=0;
 340   8                                                              P2_3=0;   //关电机      
 341   8                                                              P2_0=0;
 342   8                                                              P2_1=0;
 343   8                                                              P2_7=1;   //蜂鸣器发声
 344   8                                                              while(1)
 345   8                                                              {
 346   9                                                                      for(i=0;i<=200;i++)
 347   9                                                                      {
 348  10                                                                               P2_7=~P2_7;
 349  10                                                                               if(P1_0==0)
 350  10                                                                      {
 351  11                                                                                      delay1ms();  
 352  11                                                                              if(P0_1==0) 
 353  11                                                                                      {goto rst;}
 354  11                                                                              }
 355  10                                                                      }
 356   9                                                              }                       
 357   8                                                      }
 358   7                                              } 
 359   6                                              //弱洗模式//
 360   6                                              while(power==2)
 361   6                                              { 
 362   7                                                  TR0=1;                      //启动计时
 363   7                                                      P2_3=1;
 364   7                                                      P2_4=0;
 365   7                                                      while((minite/5)>=1)    //弱洗 电机开
C51 COMPILER V8.02   WASH                                                                  06/05/2008 18:57:26 PAGE 7   

 366   7                                                      {
 367   8                                                              temp=P2_3;
 368   8                                                              P2_3=P2_4;       
 369   8                                                              P2_4=temp;
 370   8                                                       }
 371   7                                                  while(minite==0)
 372   7                                                      {
 373   8                                                              TR0=0;
 374   8                                                              P2_3=0;   //关电机
 375   8                                                              P2_4=0;
 376   8                                                              empty=0; 
 377   8                                                              P2_0=0;
 378   8                                                              P2_1=0;
 379   8                                                              P2_7=1;   //蜂鸣器发声
 380   8                                                              while(1)
 381   8                                                              {
 382   9                                                                      for(i=0;i<=200;i++)
 383   9                                                                      {
 384  10                                                                              P2_7=~P2_7;
 385  10                                                                              if(P1_0==0)
 386  10                                                                              {
 387  11                                                                                      delay1ms();  
 388  11                                                                                      if(P0_1==0) 
 389  11                                                                                      {goto rst;}
 390  11                                                                              }
 391  10                                                                      }
 392   9                                                              }                               
 393   8                                                      }                         
 394   7                                              }
 395   6                                      }
 396   5                              } 
 397   4                      }
 398   3              }       
 399   2              }
 400   1      }
 401                   
 402          //计时中断**********************************************************************
 403          void t0(void) interrupt 1 using 0 
 404          { 
 405   1              tcnt++; 
 406   1              if(tcnt==4000) 
 407   1              { 
 408   2                      tcnt=0; 
 409   2                      second++; 
 410   2                      if(second==60) 
 411   2                      { 
 412   3                              second=0;
 413   3                              minite--; 
 414   3                      }        
 415   2                      dispbuf[0]=minite%10; 
 416   2                      dispbuf[1]=minite/10;    
 417   2              } 
 418   1      } 
 419          //数码管扫屏**********************************************************************
 420          void t1(void) interrupt 3 using 0 
 421          {  
 422   1              TH1=(65536-10000)/256; 
 423   1              TL1=(65536-10000)%256; 
 424   1              mstcnt++; 
 425   1              mstcnt=0;   
 426   1              P3=0xff;      //关闭所有显示
 427   1              P1=dispcode[dispbuf[dispbitcnt]]; 
C51 COMPILER V8.02   WASH                                                                  06/05/2008 18:57:26 PAGE 8   

 428   1              P3=dispbitcode[dispbitcnt]; 
 429   1              dispbitcnt++; 
 430   1              if(dispbitcnt==8) 
 431   1              { 
 432   2                      dispbitcnt=0; 
 433   2              }
 434   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    972    ----
   CONSTANT SIZE    =     11    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     32    ----
   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 + -