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

📄 text1.lst

📁 用51单片机实现一个简单计算器的功能
💻 LST
📖 第 1 页 / 共 2 页
字号:
 251   1              d=bb%10000/1000;
 252   1              c=bb%10000%1000/100;
 253   1              b=bb%10000%1000%100/10;
 254   1              a=bb%10000%1000%100%10;
 255   1              dispbufbb[8]=i;
 256   1              dispbufbb[7]=h;
 257   1              dispbufbb[6]=g;
 258   1              dispbufbb[5]=f;
 259   1              dispbufbb[4]=e;
 260   1              dispbufbb[3]=d;
 261   1              dispbufbb[2]=c;
 262   1              dispbufbb[1]=b;
 263   1              dispbufbb[0]=a;
 264   1      }
 265          
 266          
 267          void fengccc()
 268          {
 269   1              uchar a,b,c,d,e,f,g,h,i;
 270   1          if(fuhao==1)ccc=aa+bb;
 271   1              if(fuhao==2)ccc=aa-bb;
 272   1              if(fuhao==3)ccc=aa*bb;
 273   1              if(fuhao==4)ccc=aa/bb;
 274   1          T=1;
 275   1              i=16;
 276   1              h=16;
 277   1              g=16;
 278   1              f=16;
 279   1              e=ccc/10000;
 280   1              d=ccc%10000/1000;
 281   1              c=ccc%10000%1000/100;
 282   1              b=ccc%10000%1000%100/10;
 283   1              a=ccc%10000%1000%100%10;
 284   1              dispbufccc[8]=i;
 285   1              dispbufccc[7]=h;
 286   1              dispbufccc[6]=g;
 287   1              dispbufccc[5]=f;
 288   1              dispbufccc[4]=e;
 289   1              dispbufccc[3]=d;
 290   1              dispbufccc[2]=c;
 291   1              dispbufccc[1]=b;
 292   1              dispbufccc[0]=a;
 293   1      }
 294          
 295          
 296          
 297          void displayccc()          //结果输出
 298          {         
 299   1            uchar     m=19,i,key,j;
 300   1      
 301   1                            if(dispbufccc[4]==0)
C51 COMPILER V8.02   TEXT1                                                                 11/21/2008 20:45:17 PAGE 6   

 302   1                              if(dispbufccc[3]==0)
 303   1                                if(dispbufccc[2]==0)
 304   1                                          if(dispbufccc[1]==0)
 305   1                                                 if(dispbufccc[0]==0)
 306   1                                                 {
 307   2                                                              dispbufccc[4]=16;
 308   2                                                              dispbufccc[3]=16;
 309   2                                                              dispbufccc[2]=16;
 310   2                                                              dispbufccc[1]=16;
 311   2                                                              dispbufccc[0]=16;
 312   2                                                 }
 313   1                            if(dispbufccc[4]==0)
 314   1                              if(dispbufccc[3]==0)
 315   1                                if(dispbufccc[2]==0)
 316   1                                          if(dispbufccc[1]==0)
 317   1                                                 if(dispbufccc[0]!=0)
 318   1                                                 {
 319   2                                                              dispbufccc[4]=16;
 320   2                                                              dispbufccc[3]=16;
 321   2                                                              dispbufccc[2]=16;
 322   2                                                              dispbufccc[1]=16;
 323   2                                                 }
 324   1                            if(dispbufccc[4]==0)
 325   1                              if(dispbufccc[3]==0)
 326   1                                if(dispbufccc[2]==0)
 327   1                                          if(dispbufccc[1]!=0)
 328   1                                                 {
 329   2                                                              dispbufccc[4]=16;
 330   2                                                              dispbufccc[3]=16;
 331   2                                                              dispbufccc[2]=16;
 332   2                                                 }
 333   1                            if(dispbufccc[4]==0)
 334   1                              if(dispbufccc[3]==0)
 335   1                                if(dispbufccc[2]!=0)
 336   1                                                 {
 337   2                                                              dispbufccc[4]=16;
 338   2                                                              dispbufccc[3]=16;
 339   2                                                 }
 340   1                            if(dispbufccc[4]==0)
 341   1                              if(dispbufccc[3]!=0)
 342   1                                                 {
 343   2                                                              dispbufccc[4]=16;
 344   2                                                 }
 345   1                      
 346   1            while(1)
 347   1                {
 348   2            TR1=0;
 349   2            
 350   2                for(i=0;i<8;i++)
 351   2                {
 352   3                      P0=dispcode[dispbufccc[i]];
 353   3                  P2=dispbitcode[i];
 354   3                  delay02ss(m);
 355   3                }
 356   2                key=keyscan1();
 357   2                if(key==15)return;
 358   2                }
 359   1      
 360   1      }
*** WARNING C280 IN LINE 299 OF TEXT1.C: 'j': unreferenced local variable
 361          
 362          void displayaa()           //aa结果输出
C51 COMPILER V8.02   TEXT1                                                                 11/21/2008 20:45:17 PAGE 7   

 363          {         
 364   1            uchar     m=19,i,keya;
 365   1            while(1)
 366   1                {
 367   2            TR1=0;
 368   2            
 369   2                for(i=0;i<8;i++)
 370   2                {
 371   3                      P0=dispcode[dispbufaa[i]];
 372   3                  P2=dispbitcode[i];
 373   3                  delay02ss(m);
 374   3                }
 375   2                keya=keyscan1();
 376   2                if(keya==15)return;
 377   2                }
 378   1      
 379   1      }
 380          
 381          void displaybb()           //bb结果输出
 382          {         
 383   1            uchar     m=19,i,keyb;
 384   1            while(1)
 385   1                {
 386   2            TR1=0;
 387   2            
 388   2                for(i=0;i<8;i++)
 389   2                {
 390   3                      P0=dispcode[dispbufbb[i]];
 391   3                  P2=dispbitcode[i];
 392   3                  delay02ss(m);
 393   3                }
 394   2                keyb=keyscan1();
 395   2                if(keyb==15)return;
 396   2                }
 397   1      
 398   1      }
 399          
 400          void moni()
 401          {
 402   1        char key1=16;
 403   1        TMOD=0x10; 
 404   1        TH1=(65536-4000) / 256; 
 405   1        TL1=(65536-4000) % 256; 
 406   1        TR1=1; 
 407   1        ET1=1; 
 408   1        EA=1; 
 409   1        while(1) 
 410   1          { 
 411   2                 
 412   2                      key1=keyscan2();
 413   2                                if((key1>=0) && (key1<10)) 
 414   2                    { 
 415   3                                  cc=1;
 416   3                      keypos++; 
 417   3                      if(keypos<9) 
 418   3                        { 
 419   4                                          change(dispbuf,keypos); 
 420   4                          dispbuf[0]=key1; 
 421   4                                              key1=16;
 422   4                        } 
 423   3                        else 
 424   3                          { 
C51 COMPILER V8.02   TEXT1                                                                 11/21/2008 20:45:17 PAGE 8   

 425   4                            keypos=9; 
 426   4                          } 
 427   3                    }  
 428   2                                if(key1==10)
 429   2                                {
 430   3                                      delete();
 431   3                                      key1=16;
 432   3                                } 
 433   2                                if(key1==11)
 434   2                                {
 435   3                                      clear();
 436   3                                      key1=16;
 437   3                                }     
 438   2                                if(11<key1 && key1<16 && T==1)
 439   2                                {
 440   3                                   T=2;
 441   3                                       if(key1==12)fuhao=1;
 442   3                                       if(key1==13)fuhao=2;
 443   3                                       if(key1==14)fuhao=3;
 444   3                                       if(key1==15)fuhao=4;
 445   3                                       P0=0;
 446   3                                       valueaa();
 447   3                                       return;
 448   3                                } 
 449   2                                if(key1==15 && T==2)
 450   2                                {
 451   3                                   T=3;
 452   3                       valuebb();
 453   3                                       P0=0;
 454   3                                       return;
 455   3                                }      
 456   2            } 
 457   1      }
 458          
 459          
 460           //*****************************************************
 461          void main(void)
 462          {
 463   1          //uchar key=16;
 464   1         while(1)
 465   1              {
 466   2                                      key=keyscan1();
 467   2                                      if(T==1||T==2) 
 468   2                                              {
 469   3                                                      clear();
 470   3                                                      moni();
 471   3                                                      key=16;
 472   3                                              }
 473   2                                      if(T==3)
 474   2                                                      {
 475   3                                                              fengccc();
 476   3                                                              displayccc();
 477   3                                                              key=16;
 478   3                                                      }
 479   2                      
 480   2              }
 481   1      
 482   1      }
 483           //***********************************
 484          void t0(void) interrupt 3 using 0 
 485          { 
 486   1        TH1=(65536-4000) / 256; 
C51 COMPILER V8.02   TEXT1                                                                 11/21/2008 20:45:17 PAGE 9   

 487   1        TL1=(65536-4000) % 256; 
 488   1        P0=dispcode[dispbuf[dispbitcount]]; 
 489   1        P2=dispbitcode[dispbitcount]; 
 490   1        dispbitcount++; 
 491   1        if (dispbitcount==9) 
 492   1          { 
 493   2            dispbitcount=0; 
 494   2          } 
 495   1      } 


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2086    ----
   CONSTANT SIZE    =     35    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     48      65
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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