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

📄 wskz_sht11.lst

📁 温湿度传感器 sht11 仿真程序下载
💻 LST
📖 第 1 页 / 共 2 页
字号:
*** WARNING C206 IN LINE 189 OF WSKZ_SHT11.C: 'key': missing function-prototype
 190   1                  text_a(HUMI_ML);
 191   1       
 192   1            text_jishuan_humi();
*** WARNING C206 IN LINE 192 OF WSKZ_SHT11.C: 'text_jishuan_humi': missing function-prototype
 193   1      
 194   1      
 195   1                }
 196          
 197          /////
 198          
 199           //////////计算温度////
 200           text_jishuan_temp()
 201           {
 202   1          float aa=0,bb=0,temp_zi;
 203   1              int   abcd=0;
 204   1      
 205   1       aa=(float)temp_h*256+(float)temp_LL; 
 206   1       temp_zi=0.01*aa-40;
 207   1      
 208   1      //
 209   1      
 210   1       if  (temp_zi<0)
 211   1          {
 212   2                temp_zi=0;
 213   2          }
 214   1         temp_zi=temp_zi*10;
 215   1         xianzhi_t=(int)temp_zi;//给显示值
 216   1      
 217   1         }
 218            ///////计算湿度//////
 219            text_jishuan_humi()
 220           {
 221   1          float aa=0,bb=0,humi_zi;
 222   1              int   abcd=0;
 223   1      
 224   1       aa=(float)temp_h*256+(float)temp_LL; 
 225   1      
 226   1       bb=aa*aa*2.8/1000000;
 227   1       aa=0.0405*aa;
 228   1       aa=aa-4-bb;
 229   1       humi_zi=aa;
 230   1      
 231   1       //
 232   1          humi_zi=humi_zi*10;
 233   1         xianzhi_h=(int)humi_zi;
 234   1         }
 235          
 236          
C51 COMPILER V8.02   WSKZ_SHT11                                                            04/20/2008 10:38:46 PAGE 5   

 237          
 238          ///////延时///////
 239          delay(int i)
 240          {
 241   1         while(--i);     
 242   1           
 243   1      }     
 244          
 245          ///////显示处理///////
 246          xianshi()
 247          {    
 248   1          int   abcd=0;
 249   1          int i; 
 250   1        for (i=0;i<1;i++)
 251   1      {  
 252   2       abcd=xianzhi_h;
 253   2       gwei=1;
 254   2       swei=1;
 255   2       bwei=1;
 256   2       qwei=1;
 257   2       P1=dispcode[abcd/100];
 258   2        qwei=0;
 259   2       delay(40);
 260   2        qwei=1;
 261   2        abcd=abcd%100   ;
 262   2       P1=dispcode[abcd/10];
 263   2       bwei=0;
 264   2       delay(40);
 265   2       bwei=1;
 266   2      
 267   2       if(setbz_h^setbz_l)
 268   2       {
 269   3          if(setbz_h) abcd=setzhi_h;
 270   3          if(setbz_l) abcd=setzhi_l;
 271   3      
 272   3              P1=dispcode[abcd/10];
 273   3              swei=0;
 274   3              delay(40);
 275   3              swei=1;
 276   3              P1=dispcode[abcd%10];
 277   3              gwei=0;
 278   3              delay(40);
 279   3              gwei=1;  
 280   3      
 281   3        }
 282   2        else
 283   2        {
 284   3              abcd=xianzhi_t;
 285   3              P1=dispcode[abcd/100];
 286   3              swei=0;
 287   3              delay(40);
 288   3              swei=1;
 289   3              abcd=abcd%100   ;
 290   3              P1=dispcode[abcd/10];
 291   3              gwei=0;
 292   3              delay(40);
 293   3              gwei=1;  
 294   3         }
 295   2       }
 296   1      }
 297          
 298            doing()
C51 COMPILER V8.02   WSKZ_SHT11                                                            04/20/2008 10:38:46 PAGE 6   

 299            {
 300   1        char xianzhi_mi;
 301   1         xianzhi_mi=xianzhi_t/10;
 302   1         if((xianzhi_mi<setzhi_h)&(xianzhi_t>setzhi_l)) { motor=0;hot=0;speek=0;}
 303   1         if(xianzhi_mi>setzhi_h)  { motor=1;hot=0;speek=1;}
 304   1         if(xianzhi_mi<setzhi_l)  { motor=0;hot=1;speek=1;}
 305   1        }
 306          
 307          
 308          key()
 309          {
 310   1        if(set&setkey) 
 311   1        {
 312   2           setkey=0;
 313   2           if(setbz_l) {setbz_l=0;setbz_h=0;}
 314   2               else 
 315   2               { if(!setbz_h) setbz_h=1;
 316   3                 else {setbz_h=0;setbz_l=1;}
 317   3                }
 318   2         }
 319   1         if(!set)  setkey=1;
 320   1      
 321   1        if(setup==0)
 322   1        {
 323   2            if(setbz_h==1)
 324   2                     { if (setzhi_h<=99) setzhi_h++;}
 325   2            if(setbz_l==1)
 326   2                     { if ((setzhi_l<setzhi_h)&(setzhi_l<=99)) setzhi_l++;}
 327   2        }               
 328   1      
 329   1       if(setdown==0)
 330   1        {
 331   2            if(setbz_h==1)
 332   2                     { if ((setzhi_h>setzhi_l)&(setzhi_h>=1)) setzhi_h--;}
 333   2            if(setbz_l==1)
 334   2                     { if (setzhi_l>=1) setzhi_l--;}
 335   2        }               
 336   1      
 337   1      
 338   1        
 339   1       }
 340          
 341          //系统初始化///
 342          csh()
 343          {
 344   1         P0=0XFF;
 345   1         P1=1;
 346   1         P2=0;
 347   1         P3=0XFF;
 348   1      }
 349            
 350          
 351          
 352          /////////////////////////////////
 353          ///////////////////////
 354          main()
 355          {
 356   1       
 357   1        setzhi_h=22;//设置高温
 358   1        setzhi_l=20;//设置低温
 359   1      
 360   1         csh();//系统初始化
C51 COMPILER V8.02   WSKZ_SHT11                                                            04/20/2008 10:38:46 PAGE 7   

 361   1          while(1)
 362   1        {
 363   2         text_jishuan_temp11();//测温湿度
 364   2         //xianshi();//显示
 365   2         doing();//处理
 366   2         key();//键处理
 367   2       //  xianshi();//显示    
 368   2         
 369   2           
 370   2        }
 371   1      }
 372          
 373          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1197    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     10      32
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      3    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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