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

📄 3.lst

📁 Lap Proteus use simuretion
💻 LST
字号:
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 1   


C51 COMPILER V8.04, COMPILATION OF MODULE 3
OBJECT MODULE PLACED IN 3.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 3.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg51.h>               
   2          sbit c1 = P2^3;           
   3          sbit c2 = P2^2; 
   4          sbit c3 = P2^1;         
   5          sbit r1 = P2^4;         
   6          sbit r2 = P2^5; 
   7          sbit r3 = P2^6;         
   8          sbit r4 = P2^7;
   9          void Enter (void);
  10          void SUM_ (void);
  11          int i,ii,a;
  12          int w,x,y,z,A1,A2,w1,x1,y1,z1;
  13          unsigned int L,L1,L2,L3,L4,L5,L6;
  14          unsigned int Sum,O,V,Q,R,S,T;
  15          void  show( void);
  16          void Shift (void);
  17          unsigned char Patturn [] = {0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xf0};
  18          unsigned char Buffer1[4];
  19          unsigned char Buffer2[4];
  20          unsigned char key;
  21          bit PP,PP1;       
  22          void delay_db(int time)
  23          {
  24   1              do              
  25   1              {
  26   2               time--;                
  27   2              }while(time>0);     
  28   1      }
  29          
  30          unsigned char scankey(void) 
  31          {
  32   1              unsigned char ret = 0xFF;               
  33   1              c1 = 0;                                 
  34   1              if(r1==0)       
  35   1              { 
  36   2                      delay_db(30000);                          
  37   2                      ret = 0x01;             
  38   2              }                    
  39   1              if(r2==0)                       
  40   1              {
  41   2                      delay_db(30000);
  42   2                      ret = 0x04;             
  43   2              }                                       
  44   1              if(r3==0)                       
  45   1              {                                                       
  46   2                      delay_db(30000); 
  47   2                      ret = 0x07;             
  48   2              } 
  49   1              if(r4==0)                       
  50   1              {                                                       
  51   2                      delay_db(30000); 
  52   2                      ret = 0x11;  //*+++++           
  53   2              }       
  54   1              
  55   1               c1 = 1;
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 2   

  56   1      
  57   1       //------------------------------------------------//
  58   1                                  
  59   1              c2 = 0;                         
  60   1              if(r1==0)                       
  61   1              {
  62   2                      delay_db(30000);                                                                
  63   2                      ret = 0x02;             
  64   2              }                                                       
  65   1              if(r2==0)                       
  66   1              {
  67   2                      delay_db(30000);  
  68   2                      ret = 0x05;             
  69   2              }                                                       
  70   1              if(r3==0)                       
  71   1              {
  72   2                      delay_db(30000);        
  73   2                      ret = 0x08;             
  74   2              }                                                       
  75   1              if(r4==0)               
  76   1              {
  77   2                      delay_db(30000);                        
  78   2                      ret = 0x00;     
  79   2              }
  80   1              c2 = 1;
  81   1                              
  82   1      //----------------------------------------//                                            
  83   1              c3 = 0;                         
  84   1              if(r1==0)                       
  85   1              {
  86   2                      delay_db(30000);        
  87   2                      ret = 0x03;                     
  88   2              }                                                       
  89   1              if(r2==0)                       
  90   1              {
  91   2                      delay_db(30000);        
  92   2                      ret = 0x06;     
  93   2              }                                       
  94   1              if(r3==0)                       
  95   1              {
  96   2                      delay_db(30000);        
  97   2                      ret = 0x09;             
  98   2              }
  99   1              if(r4==0)                       
 100   1              {
 101   2                      delay_db(30000);        
 102   2                      ret = 0x12;      //#======      
 103   2              }
 104   1                                                                              
 105   1              c3 = 1;                 
 106   1              return(ret);                    
 107   1      }
 108          
 109          /*************************** Main loop **************************/
 110          
 111          void main(void)     
 112          {       
 113   1              Buffer1[4]=0;
 114   1              Buffer1[3]=0;
 115   1              Buffer1[2]=0;
 116   1              Buffer1[1]=0;
 117   1                      
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 3   

 118   1              while(1) 
 119   1              {
 120   2               
 121   2                              key = scankey();                
 122   2                              if( key != 0xff)
 123   2                      {        
 124   3                              if( key != 0x11&&key!=0x12&&PP==0)
 125   3                         {
 126   4                              i++;
 127   4                          
 128   4                              //if(i<=4)
 129   4                              //Buffer1[i]=key;
 130   4      
 131   4                              if (i>=1) 
 132   4                              {       
 133   5                              //i=4;
 134   5                              Shift ();        
 135   5                              Buffer1[1]=key;         
 136   5                              }
 137   4                         }
 138   3                              if( key == 0x11)        //*+
 139   3                              {
 140   4                                SUM_();
 141   4                                PP=1;
 142   4                                
 143   4                              } 
 144   3                              
 145   3                       
 146   3                          if( key == 0x12)    //#==
 147   3                              {
 148   4                              Enter();
 149   4                              }       
 150   3      //------------------------------------          
 151   3                              if( key != 0x11&&key!=0x12&&PP==1)  //Prees again       No * ,NO #
 152   3                              {       
 153   4                                       if(PP1==1)
 154   4                                       {
 155   5                                              Buffer1[4]=0;
 156   5                                              Buffer1[3]=0;
 157   5                                              Buffer1[2]=0;
 158   5                                              Buffer1[1]=0;
 159   5                                              
 160   5                                       }
 161   4                                       
 162   4                                       
 163   4                                 {
 164   5                                       
 165   5                                      PP1=0;
 166   5                                      ii++;
 167   5                          
 168   5                              //if(ii<=4)
 169   5                              
 170   5                              //Buffer1[ii]=key;
 171   5                               
 172   5                              if (ii>=1) 
 173   5                              {       
 174   6                              //ii=4;
 175   6                              Shift ();        
 176   6                              Buffer1[1]=key;         
 177   6                              }
 178   5                      
 179   5                                 }
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 4   

 180   4                         }
 181   3                      }  
 182   2                                 
 183   2                       show ();
 184   2                }
 185   1                        
 186   1              }
 187           
 188          
 189           
 190          /*********************************************************************************************************
             -**************/
 191          void Enter (void)       //#==
 192           {
 193   1                              
 194   1                      
 195   1                              w1 = Buffer1[4];
 196   1                              x1 = Buffer1[3];
 197   1                              y1 = Buffer1[2];
 198   1                              z1 = Buffer1[1];
 199   1                      
 200   1                              w1=w1*1000;
 201   1                              x1=x1*100;
 202   1                              y1=y1*10;
 203   1                              z1=z1*1;
 204   1                      
 205   1                              A2=(w1+x1+y1+z1);
 206   1      
 207   1                              Sum=(A1*A2);
 208   1                              if (Sum >= 10000)
 209   1                                {
 210   2                                
 211   2                                      L=Sum/1000;     // 21.338       
 212   2                                      L1=L%10;                //2.1
 213   2                                      L2=Sum%1000;    //338
 214   2                                      L3=L2/100;               //3.38
 215   2                                      L4=L2%100;               //38
 216   2                                      L5=L4/10;                //3.8
 217   2                                      L6=L4%10;            //8
 218   2                                      
 219   2                      
 220   2                                      Buffer1[4]=L1;
 221   2                                      Buffer1[3]=L3;
 222   2                                      Buffer1[2]=L5;
 223   2                                      Buffer1[1]=L6;
 224   2      
 225   2      
 226   2                                }
 227   1                              if (Sum <= 9999)
 228   1                              {
 229   2                              O=Sum/1000;        //1234/1000=1                         0
 230   2                              V=Sum%1000;        //1234/1000=234                        018
 231   2                              Q=V/100;           //234/100=2                            0
 232   2                              R=V%100;           //234/100=34                            18
 233   2                              S=R/10;            //34/10=3                               1
 234   2                              T=R%10;                 //34/10=4                                       8
 235   2                              
 236   2      
 237   2      
 238   2      
 239   2      
 240   2                              Buffer1[4]=O;
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 5   

 241   2                              Buffer1[3]=Q;
 242   2                              Buffer1[2]=S;
 243   2                              Buffer1[1]=T;
 244   2                              
 245   2                              }
 246   1              }  
 247          void SUM_ (void)          //*++
 248          {               
 249   1                      
 250   1                      w = Buffer1[4];
 251   1                      x = Buffer1[3];
 252   1                      y = Buffer1[2];
 253   1                      z = Buffer1[1];
 254   1                      w=w*1000;
 255   1                      x=x*100;
 256   1                      y=y*10;
 257   1                      z=z*1;
 258   1                      A1=(w+x+y+z);
 259   1                      PP1=1;
 260   1                                              
 261   1      }
 262          void Shift (void)
 263          {
 264   1              
 265   1      
 266   1                       Buffer2[1]= Buffer1[1];
 267   1                       Buffer2[2]= Buffer1[2];
 268   1                       Buffer2[3]= Buffer1[3];
 269   1                       Buffer2[4]= Buffer1[4];
 270   1                 //--------------------
 271   1      
 272   1                       Buffer1[2]= Buffer2[1];
 273   1                       Buffer1[3]= Buffer2[2];
 274   1                       Buffer1[4]= Buffer2[3];
 275   1      
 276   1      }  
 277          
 278          void  show( void)
 279          {               
 280   1                       
 281   1                      
 282   1                      P0 = Patturn[Buffer1 [1]]|0x0E;
 283   1                      delay_db(25);           
 284   1                      P0 = Patturn[Buffer1 [2]]|0x0d;
 285   1                      delay_db(25);   
 286   1                      P0 = Patturn[Buffer1 [3]]|0x0b;
 287   1                      delay_db(25);           
 288   1                      P0 = Patturn[Buffer1 [4]]|0x07;
 289   1                      delay_db(25);
 290   1                      
 291   1      
 292   1      }
 293          
 294          
 295          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    805    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
C51 COMPILER V8.04   3                                                                     02/12/2009 01:26:24 PAGE 6   

   DATA SIZE        =     74    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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