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

📄 6.lst

📁 刚学时编的小程序
💻 LST
字号:
C51 COMPILER V8.02   6                                                                     04/25/2007 21:12:28 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE 6
OBJECT MODULE PLACED IN 6.OBJ
COMPILER INVOKED BY: d:\Keil 8\C51\BIN\C51.EXE 6.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <AT89X51.H>
   2          
   3          unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,
   4          0x66,0x6d,0x7d,0x07,
   5          0x7f,0x6f,0x77,0x7c,
   6          0x39,0x5e,0x79,0x71,0x40,0x00};
   7          unsigned char dispbitcode[]={0xfe,0xfd,0xfb,0xf7,
   8          0xef,0xdf,0xbf,0x7f};
   9          unsigned char dispbuf[8]={0,0,16,0,0,16,0,0};
  10          unsigned char dispcun[10][8];
  11          
  12          unsigned char dispbitcnt;
  13          unsigned char second;
  14          unsigned char minite;
  15          unsigned char hour;
  16          unsigned int tcnt;
  17          unsigned char mstcnt;
  18          unsigned int key;
  19          unsigned char cun=0,b,f;
  20          char i;
  21          
  22          delay(int t)
  23          {
  24   1              int i,j;
  25   1              for(i=0;i<t;i++)
  26   1                      for(j=0;j<100;j++);
  27   1      }
  28          
  29          char scan_key()
  30          {
  31   1              char i,j,find;
  32   1              int ini,inj;
  33   1              char in;
  34   1              find=0;
  35   1              for(i=0;i<4;i++)
  36   1              {
  37   2                      P0=dispbitcode[i]  ;
  38   2                      delay(30);
  39   2                      in=P0;
  40   2                      in=in>>4;
  41   2                      in=in|0xf0;
  42   2                      for(j=0;j<4;j++)
  43   2                              if(dispbitcode[j]==in)
  44   2                              {
  45   3                                      find=1;
  46   3                                      inj=j,ini=i;
  47   3                              }
  48   2              }
  49   1              if(find==0)  return 0;
  50   1          key=ini*4+inj;
  51   1              return find;
  52   1      }
  53          
  54          void main()
  55          {
C51 COMPILER V8.02   6                                                                     04/25/2007 21:12:28 PAGE 2   

  56   1              char m,n;
  57   1              for(m=0;m<10;m++)
  58   1              {
  59   2                      for(n=0;n<8;n++)
  60   2                      {       
  61   3                              if(n==7)        dispcun[m][n]=0;
  62   3                              else dispcun[m][n]=16;
  63   3                      }
  64   2              }
  65   1              TMOD=0x02;
  66   1              TH0=0x06;
  67   1              TL0=0x06;
  68   1              TR0=1;
  69   1              ET0=1;
  70   1              EA=1;
  71   1              P3_7=0;
  72   1              P2=dispbitcode[dispbitcnt]        ;
  73   1              while(1)
  74   1              {
  75   2                      if(scan_key()==1&key==12)
  76   2                      {       
  77   3                              tiaoshi();
*** WARNING C206 IN LINE 77 OF 6.C: 'tiaoshi': missing function-prototype
  78   3                      }
  79   2                      if(scan_key()==1&key==13)       
  80   2                      {
  81   3                              cunshi();
*** WARNING C206 IN LINE 81 OF 6.C: 'cunshi': missing function-prototype
  82   3                      } 
  83   2                      for(m=0;m<=9;m++)
  84   2                      {
  85   3                              for(n=7;n>2;n--)
  86   3                              {
  87   4                                      if(n==5) continue ;
  88   4                                      if(dispcun[m][n]!=dispbuf[n])  break;
  89   4                              }
  90   3                              if(n==2) dadian();
*** WARNING C206 IN LINE 90 OF 6.C: 'dadian': missing function-prototype
  91   3                      }
  92   2              }
  93   1      }
  94          
  95          get_key()
  96          {
  97   1              while(1)        if(scan_key()!=0)  break;
  98   1      }
  99          
 100          fan_key()
 101          {
 102   1              while(1)        if(scan_key()==0)  break;       
 103   1      }
 104          
 105          void t0(void) interrupt 1 using 0
 106          {
 107   1              mstcnt++;
 108   1              if(mstcnt==8)
 109   1              {
 110   2                      mstcnt=0;
 111   2                      if(cun==0)
 112   2                      {
 113   3                              if(i!=0&i==dispbitcnt)
 114   3                              {
C51 COMPILER V8.02   6                                                                     04/25/2007 21:12:28 PAGE 3   

 115   4                                              f=1;
 116   4                                                              if(tcnt<500)
 117   4                                      {
 118   5                              f=0;
 119   5                                      }
 120   4                                      if(f==0) P1=dispcode[17];
 121   4                                      else P1=dispcode[dispbuf[dispbitcnt]]   ;
 122   4                              
 123   4                              }
 124   3                              else      P1=dispcode[dispbuf[dispbitcnt]]      ;
 125   3                      }
 126   2                      else
 127   2                      {
 128   3                               P1=dispcode[dispcun[b][dispbitcnt]]  ;
 129   3                      }
 130   2                      P2=dispbitcode[dispbitcnt]        ;     
 131   2                      dispbitcnt++;
 132   2                      if(dispbitcnt==8)
 133   2                      {
 134   3                              dispbitcnt=0;
 135   3                      }
 136   2              }
 137   1              tcnt++;
 138   1              if(tcnt==3600)
 139   1              {       
 140   2                      tcnt=0;
 141   2                      second++;
 142   2                      if(second>=60)
 143   2                      {
 144   3                              second=0;
 145   3                              minite++;
 146   3                              if(minite>=60)
 147   3                              {
 148   4                                      minite=0;
 149   4                                      hour++;
 150   4                                      if(hour>=24)
 151   4                                      {
 152   5                                              hour=0;
 153   5                                      }       
 154   4                              }
 155   3                      }
 156   2                      dispbuf[0]=second%10;
 157   2                      dispbuf[1]=second/10;
 158   2                      dispbuf[3]=minite%10;
 159   2                      dispbuf[4]=minite/10;
 160   2                      dispbuf[6]=hour%10;
 161   2                      dispbuf[7]=hour/10;
 162   2              }
 163   1      }       
 164          
 165          tiaoshi()
 166          {
 167   1      //      char i;
 168   1              P3_0=0;
 169   1              fan_key();
 170   1              for(i=7;i>=0;i--)
 171   1              {       
 172   2                      switch(i)
 173   2                      {                                                                                                                
 174   3                              case 7: get_key();      if(key>2)       {key=2;}        hour=key*10; break;
 175   3                              case 6: get_key();      if(key>9)       {key=9;}        hour=hour+key;
 176   3                                                                      if(hour>24)     {hour=23;}      break;
C51 COMPILER V8.02   6                                                                     04/25/2007 21:12:28 PAGE 4   

 177   3                              case 4: get_key();      if(key>5)       {key=5;}        minite=key*10; break;
 178   3                              case 3: get_key();      if(key>9)       {key=9;}        minite=minite+key; break;
 179   3                              case 1: get_key();      if(key>5)       {key=5;}        second=key*10; break;
 180   3                              case 0: get_key();      if(key>9)       {key=9;}        second=second+key; break;
 181   3                      }
 182   2              //      fan_key();
 183   2              }
 184   1              P3_0=1;
 185   1      }
 186          
 187          cunshi()
 188          {
 189   1      //      char i;
 190   1              P3_1=0;
 191   1              fan_key()       ;
 192   1              cun=1;
 193   1              for(b=0;b<10;b++)
 194   1              {
 195   2                      for(i=7;i>0;i--)
 196   2                      {
 197   3                              switch(i)
 198   3                              {
 199   4                                      case 7: get_key();      if(key==15)             {fan_key(); goto loop;}
 200   4                                                                              else /*if(key>2){key=2;}  */    dispcun[b][i]=key; break;
 201   4                                      case 6: get_key();/*    if(key>3&dispcun[b][i+1]>1) dispcun[b][i]=3;// break;
 202   4                                                                              else if(key>9&dispcun[b][i+1]<2) dispcun[b][i]=9;//     break;
 203   4                                                                              else  */ dispcun[b][i]=key; break;
 204   4                                      case 4: get_key();      /*if(key>5){key=5;}     */dispcun[b][i]=key; break;
 205   4                                      case 3: get_key();      /*if(key>9){key=9;}     */dispcun[b][i]=key; break;
 206   4                                      case 1: if(b==9) dispcun[b][i]=1;
 207   4                                                      else dispcun[b][i]=0; break;
 208   4                                      //case 0: if(b==9) dispcun[b][i]=0;
 209   4                                              //      else dispcun[b][i]=b+1; break;
 210   4                              }
 211   3                              fan_key();
 212   3                      }
 213   2                      loop:  1;
*** WARNING C275 IN LINE 213 OF 6.C: expression with possibly no effect
 214   2              }
 215   1              b=9 ;
 216   1              while(1)
 217   1                      if(scan_key()==1&key==14) 
 218   1                      {
 219   2                              cun=0;  P3_1=1;break;
 220   2                      }
 221   1      }
 222          
 223          dadian()
 224          {
 225   1              char a=0;
 226   1               P3_7=1;
 227   1               P3_6=0;
 228   1               delay(8000);
 229   1               P3_7=0;
 230   1               P3_6=1;
 231   1               a++;
 232   1               if(a==40)
 233   1               {
 234   2               char d;
 235   2                      for(d=0;d<300;d++)
 236   2                      {
 237   3                              delay(9000);
C51 COMPILER V8.02   6                                                                     04/25/2007 21:12:28 PAGE 5   

 238   3                      }
 239   2               }
 240   1      }       
 241          
 242          
 243          /*dadian()
 244          {
 245          //      char a;
 246                  P3_7=1;
 247                  P3_6=0;
 248          //      if(tcnt==3500) a++;
 249                  delay(8000);
 250                  P3_7=0;
 251                  P3_6=1;
 252                  if(second>=40) 
 253                  {
 254                          while(second==0) break;
 255                  }
 256          }       
 257                  */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1066    ----
   CONSTANT SIZE    =     18    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =    109       6
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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