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

📄 main.lst

📁 air-contronin controning air in or out,big or small check the temprature.
💻 LST
📖 第 1 页 / 共 3 页
字号:
 290   1              {
 291   2                      ref=0;
 292   2              }
 293   1      }
 294           
 295          void ee_fresh(void)
 296          {
 297   1              byte flag1;
 298   1              //delay 5s after storing data updated
 299   1              //than write to ee
 300   1              if(ee_changed)
 301   1              {
 302   2                      if(state_Ee==0)
 303   2                      {
C51 COMPILER V8.05a   MAIN                                                                 06/05/2007 06:25:16 PAGE 6   

 304   3                              cnt_Ee=0;
 305   3                              F5sEe=0;
 306   3                              state_Ee=1;     
 307   3                      }
 308   2                      else if((state_Ee==1)&&(F5sEe==1))
 309   2                      {
 310   3                              F5sEe=0;
 311   3                              state_Ee=0;
 312   3                              ee_changed=0;
 313   3                              EE_Erase(0x2800);
 314   3                              flag1=0x33;
 315   3                              EE_Write(0x2900,&flag1,1);
 316   3                              EE_Write(0x2901,&flag1,1);
 317   3                              EE_Write(0x2800,&da_TA,1);
 318   3                      }
 319   2              }
 320   1      }
 321           
 322          //state_sens:0->after sens failure,caculate count for checking again 
 323          //                       1->when time come ,check the sens state
 324          void disp_sens(void)
 325          {
 326   1              unsigned int Vd;
 327   1              byte da;
 328   1              if((pwon)&&(alarm==0)&&(cnt_main%255==0))
 329   1              {
 330   2                      Vd=sample_adc(4);
 331   2                      //temperature circle open
 332   2                      //checking voltage less than 0.5v       
 333   2                      //other 0.5v equal when the temperature is great than 70C
 334   2                       if(Vd<=102)
 335   2                       {
 336   3                              alarm|=0x04;
 337   3                              alarm&=0xf7;
 338   3                              state_Sens=0;
 339   3                       }
 340   2                       else if(Vd<690)                //checking voltage great than 3.36v     
 341   2                       {                                              //other 3.36v equal when the temperature is less than -10C
 342   3                              Vd=sample10_adc4();
 343   3                              da_TC=ct(Vd);
 344   3                              da=da_TC/10;
 345   3                              dp_chara(da,0,1,30,6);
 346   3                              da=da_TC%10;
 347   3                              dp_chara(da,0,1,36,6);
 348   3                       }
 349   2                      //temperature circle short
 350   2                      //checking voltage more than 3.36v
 351   2                       else if(Vd>=690)
 352   2                       {
 353   3                              alarm|=0x08;
 354   3                              alarm&=0xfb;
 355   3                              state_Sens=0;
 356   3                       }
 357   2              }
 358   1              if(alarm&0x0c)
 359   1              {
 360   2                                                      //sensor failure --alarm:bit2 open --00
 361   2                                                      //                                               bit3 short --50
 362   2                              //temperature circle open
 363   2                              //checking voltage less than 0.5v or great than 3.36v 
 364   2                      if(state_Sens==0)
 365   2                      {
C51 COMPILER V8.05a   MAIN                                                                 06/05/2007 06:25:16 PAGE 7   

 366   3                         F5sSens=0;
 367   3                         cnt_Sens=0;
 368   3                         state_Sens=1;
 369   3                      }
 370   2                      if((state_Sens==1)&&(F5sSens==1))
 371   2                      {       
 372   3                              F5sSens=0;
 373   3                              Vd=sample_adc(4);
 374   3                              //temperature circle open
 375   3                              //checking voltage less than 2.0v or great than 2.7v 
 376   3                              if(Vd<102)
 377   3                              {
 378   4                                      alarm|=0x04;
 379   4                                      alarm&=0xf7;
 380   4                                      state_Sens=0;
 381   4                              }
 382   3                              else if(Vd<690)
 383   3                              {
 384   4                                      alarm&=0xf3;
 385   4                                      if(alarm==0)
 386   4                                      {
 387   5                                              alarm_Resume=1;
 388   5                                      }
 389   4                                      state_Sens=0;
 390   4                              }
 391   3                              else
 392   3                              {
 393   4                                      alarm|=0x08;
 394   4                                      alarm&=0xfb;
 395   4                                      state_Sens=0;
 396   4                              }
 397   3                      }               
 398   2              }       
 399   1      }
 400          
 401          void disp_fa(void)
 402          {       
 403   1      //2 min open ;8 min close
 404   1      //state_fa: 0->caculate 8 min count;1->caculate 2 min count;2->wait for 8 min then
 405   1      //operate; 3->wait for 2 min then operate
 406   1              if(freshair_aut)
 407   1              {
 408   2                      switch(state_fa)
 409   2                      {
 410   3                              case 0:                 //close fresh-air relay till F8m2m count to 8889
 411   3                                      F8m2m=0;
 412   3                                      cnt_fa=0;
 413   3                                      state_fa=2;
 414   3                                      freshair=0;
 415   3                                      break;
 416   3      
 417   3                              case 1:            //open fresh-air relay till F8m2m count to 2223
 418   3                                      F8m2m=0;
 419   3                                      cnt_fa=0;
 420   3                                      state_fa=3;
 421   3                                      freshair=1;
 422   3                                      break;
 423   3      
 424   3                              case 2:
 425   3                                      if(F8m2m==1)
 426   3                                      {                                                //8min close
 427   4                                              state_fa=1;
C51 COMPILER V8.05a   MAIN                                                                 06/05/2007 06:25:16 PAGE 8   

 428   4                                              F8m2m=0;
 429   4                                      }
 430   3                                      break;
 431   3      
 432   3                              case 3:
 433   3                                      if(F8m2m==1)
 434   3                                      {                                                //8min close
 435   4                                              state_fa=0;
 436   4                                              F8m2m=0;
 437   4                                      }
 438   3                                      break;
 439   3      
 440   3                              default:
 441   3                                      break;
 442   3                      }
 443   2              }
 444   1      }
 445          
 446          //in byte da1:  bit7:chip select;
 447          //                              bit6~5:display mode select :00 ---normal
 448          //                                                                                      01 ---PR alarm
 449          //                                                                                      10 ---SENS alarm
 450          //                              bit4~bit0:display content  :in case of normal  :it points dpl[]
 451          //                                                                                      in case of PR/SENS 1---AH/50
 452          //                                                                                                                         0---AL/0
 453          //in byte da2: bit7~6:page select;bit6~0:display column select
 454          
 455          void disp_Hpr(void)
 456          {
 457   1      //State_Hp :0->caculate 5 min count;1->wait for 5 min then judge if entering the Hp state;
 458   1      //2:caculate 5 min count for exiting state; 3->wait for 5 min then judge if exiting the Hp state
 459   1          unsigned char da=0;
 460   1              switch(state_Hp)
 461   1              {
 462   2                      case 0:
 463   2                              if(alarm_Hpr)
 464   2                              {
 465   3                                      F5sHp=0;
 466   3                                      cnt_Hp=0;
 467   3                                      state_Hp=1;
 468   3                              }
 469   2                              break;
 470   2                      case 1:
 471   2                              if((F5sHp==1)&&(alarm_Hpr==1))
 472   2                              {
 473   3                                      F5sHp=0;
 474   3                                      alarm_Hpr=0;
 475   3                                      pin_hpr=1;
 476   3                                      if(!pin_hpr)//hight press alarm
 477   3                                      {
 478   4                                              alarm|=0x01;
 479   4                                              state_Hp=2;
 480   4                                              state_ref=0xff;
 481   4                                              ref=0;
 482   4                                      }
 483   3                                      else
 484   3                                      {
 485   4                                              EX0=1;
 486   4                                              state_Hp=0;
 487   4                                      }
 488   3                              }       
 489   2                              break;
C51 COMPILER V8.05a   MAIN                                                                 06/05/2007 06:25:16 PAGE 9   

 490   2      
 491   2                      case 2: 
 492   2                              da=alarm&0x01;
 493   2                              if(da)
 494   2                              {
 495   3                                      pin_hpr=1;
 496   3                                      if(pin_hpr)
 497   3                                      {
 498   4                                              F5sHp=0;
 499   4                                              cnt_Hp=0;
 500   4                                              state_Hp=3;
 501   4                                      }
 502   3                               }
 503   2                               break;
 504   2      
 505   2                      case 3: 
 506   2                              da=alarm&0x01;
 507   2                              if((da==1)&&(F5sHp==1))
 508   2                              {
 509   3                                      F5sHp=0;
 510   3                                      pin_hpr=1;
 511   3                                      if(pin_hpr)
 512   3                                      {
 513   4                                              F5sHp=0;
 514   4                                              alarm&=0xfe;
 515   4                                              if(alarm==0)
 516   4                                              {
 517   5                                                      alarm_Resume=1;
 518   5                                              }
 519   4                                              EX0=1;
 520   4                                              state_Hp=0;
 521   4                                      }
 522   3                                      else
 523   3                                      {
 524   4                                              state_Hp=2;
 525   4                                      }
 526   3                              }
 527   2                              break;
 528   2      
 529   2                      default:
 530   2                              break;
 531   2              }
 532   1      }
 533          
 534          
 535          
 536          void disp_Lpr(void)
 537          {
 538   1      //State_Lp :0->caculate 5 min count;1->wait for 5 min then judge if entering the Lp state;
 539   1      //2:caculate 5 min count for exiting state; 3->wait for 5 min then judge if exiting the Lp state
 540   1              unsigned char da=0;
 541   1              switch(state_Lp)
 542   1              {
 543   2                      case 0:
 544   2                              if(alarm_Lpr)
 545   2                              {
 546   3                                      F5sLp=0;
 547   3                                      cnt_Lp=0;
 548   3                                      state_Lp=1;
 549   3                              }
 550   2                              break;
 551   2      
C51 COMPILER V8.05a   MAIN                                                                 06/05/2007 06:25:16 PAGE 10  

 552   2                      case 1:
 553   2                              if((F5sLp==1)&&(alarm_Lpr==1))
 554   2                              {
 555   3                                      F5sLp=0;
 556   3                                      pin_lpr=1;
 557   3                                      if(!pin_lpr)//hight press alarm
 558   3                                      {
 559   4                                              alarm_Lpr=0;
 560   4                                              alarm|=0x02;
 561   4                                              state_Lp=2;
 562   4                                              state_ref=0xff;
 563   4                                              ref=0;
 564   4                                      }
 565   3                                      else
 566   3                                      {
 567   4                                              EX1=1;
 568   4                                              alarm_Lpr=0;
 569   4                                              state_Lp=0;
 570   4                                      }
 571   3                              }       
 572   2                              break;
 573   2      
 574   2                      case 2: 
 575   2                              da=alarm&0x02;
 576   2                              if(da)
 577   2                              {
 578   3                                      pin_lpr=1;
 579   3                                      if(pin_lpr)
 580   3                                      {
 581   4                                              F5sLp=0;
 582   4                                              cnt_Lp=0;
 583   4                                              state_Lp=3;
 584   4                                      }
 585   3                               }

⌨️ 快捷键说明

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