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

📄 runled.lst

📁 这是51的C程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.20   RUNLED                                                                10/14/2008 09:15:39 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE RUNLED
OBJECT MODULE PLACED IN runled.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE runled.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //************************************************************/
   2          //************************************************************/
   3          //                      action: 流水灯(模拟汽车防盗器防盗过程)
   4          //                      MCU:    AT89S51
   5          //                      OSC:    6MHZ
   6          //                      TIME:   2008,4,9
   7          //************************************************************/
   8          //************************************************************/
   9          //         preprocess command, compiling the  *.inc file
  10          //************************************************************/
  11          #include        <C:\Keil\C51\INC\Atmel\REGX51.H>
  12          #include        <stdio.h>
  13          #include        <intrins.h>
  14          typedef         unsigned int    UNINT;
  15          typedef         unsigned char   UNCHAR;
  16          typedef         bit                             BOOL;   
  17          
  18          /********* constant     define ************************************/
  19          void    Main_init(void);                                        //initialize all the set and flag and status
  20          void    into_runled(void);
  21          void    out_runled(void);
  22          void    INDLms(UNINT count);
  23          
  24          /********** variable define ***********************************/
  25          UNINT           a,b,c,d;
  26          UNINT           a_temp,b_temp,c_temp,d_temp;
  27          BOOL            flag;                                                   //flag=0, is show no signal and end to run led.
  28          
  29          /********** I/O define ***********************************/
  30          sbit    SING_IN         = P2^7;
  31          sbit    MOTO_OUT        = P2^6;
  32          
  33          /*********** function define***********************************/
  34          void INDLms(UNINT count)
  35          {
  36   1              UNINT k_temp,k,j,i;
  37   1              for(k=0;k<count;k++)
  38   1              {
  39   2                      if(SING_IN==0)                                  //SING_IN=0, out runled and end to run.
  40   2                      {
  41   3                              for(i=0;i<500;i++);
  42   3                              if(SING_IN==0)
  43   3                              {
  44   4                              flag=0;                                         //flag=0, is show no signal and end to run led.
  45   4                              goto  out_INDLms;
  46   4                              }
  47   3                              else
  48   3                              {       k=k_temp;       }
  49   3                      }
  50   2                      else
  51   2                      {       for(j=0;j<120;j++);
  52   3                              k_temp=k;
  53   3                      }
  54   2               }
  55   1              out_INDLms:
C51 COMPILER V7.20   RUNLED                                                                10/14/2008 09:15:39 PAGE 2   

  56   1                      _nop_();
  57   1      }
  58          
  59          //==============================================================
  60          void norDLms(UNINT count)
  61          {
  62   1              UNINT k_temp,k,j,i;
  63   1              for(k=0;k<count;k++)
  64   1              {
  65   2                      if(SING_IN==1)                                  //SING_IN=1, have signal and continue to run.
  66   2                      {
  67   3                              for(i=0;i<500;i++);
  68   3                              if(SING_IN==1)
  69   3                              {
  70   4                              flag=1;                                         //flag=0, is show no signal and end to run led.
  71   4                              goto  out_norDLms;
  72   4                              }
  73   3                              else
  74   3                              {       k=k_temp;       }
  75   3                      }
  76   2                      else
  77   2                              for(j=0;j<120;j++);
  78   2               }
  79   1              out_norDLms:
  80   1                      _nop_();
  81   1      }
  82          
  83          //==============================================================
  84          /*********** function define***********************************/
  85          UNCHAR    designP[18]={0x00,0x00,0x01,0x02,0x04,0x09,0x12,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x2
             -4,0x49};
  86          UNCHAR  keeploopP[18]={0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x92,0x24,0x49,0x9
             -2,0x24};
  87          
  88          //==============================================================
  89          //                               Main loop
  90          //==============================================================
  91          void main(void)
  92          {
  93   1              Main_init();
  94   1              while(1)
  95   1              {
  96   2                      MOTO_OUT=0;
  97   2                      _nop_();
  98   2                      if(SING_IN==0)
  99   2                      {       flag = 0;       }
 100   2                      else
 101   2                      {       into_runled();
 102   3                              out_runled();   
 103   3                      }
 104   2              }
 105   1      }//main
 106          
 107          //==============================================================
 108          //                               Main initialize  Subpro
 109          //==============================================================
 110          void    Main_init(void)
 111          {
 112   1      //      AUXR = 0x08;            //复位引脚仅为输入
 113   1              EA      =       0;                      //关闭所有中断
 114   1              P0 = 0x00;
 115   1              P1 = 0x00;
C51 COMPILER V7.20   RUNLED                                                                10/14/2008 09:15:39 PAGE 3   

 116   1              P2 = 0x00;
 117   1              P3 = 0x00;
 118   1              a_temp=b_temp=c_temp=d_temp=0;
 119   1      }
 120          
 121          //=============================================================//
 122          //                                              Main Program
 123          //                              P1\P0\P3\P2(P2.0~P2.5) is LED output port
 124          //=============================================================//
 125          void into_runled(void)
 126          {
 127   1              flag = 1;
 128   1              if(P0 = 0x00)
*** WARNING C276 IN LINE 128 OF RUNLED.C: constant in condition expression
 129   1              {
 130   2                      for(a=a_temp;a<10;a++)
 131   2                      {       
 132   3                              INDLms(10);
 133   3                              if(flag==0)
 134   3                              {       goto will_out_runled;}
 135   3                              else
 136   3                              {
 137   4                                      P1=designP[a];
 138   4                                      a_temp=a;
 139   4                              }
 140   3                      }
 141   2                      for(a=7,b=2;b<10;a++,b++)
 142   2                      {       
 143   3                              INDLms(10);
 144   3                              if(flag==0)
 145   3                              {       goto will_out_runled;}
 146   3                              else
 147   3                              {
 148   4                                      P1=designP[a];
 149   4                                      P0=designP[b];
 150   4                                      a_temp=a;
 151   4                                      b_temp=b;
 152   4                              }
 153   3                      }
 154   2                      for(a=9,b=7,c=2;c<10;a++,b++,c++)
 155   2                      {       
 156   3                              INDLms(10);
 157   3                              if(flag==0)
 158   3                              {       goto will_out_runled;}
 159   3                              else
 160   3                              {
 161   4                                      P1=designP[a];
 162   4                                      P0=designP[b];
 163   4                                      P3=designP[c];
 164   4                                      a_temp=a;
 165   4                                      b_temp=b;
 166   4                                      c_temp=c;
 167   4                              }
 168   3                      }
 169   2                      for(a=8,b=9,c=7,d=2;d<8;a++,b++,c++,d++)
 170   2                      {       
 171   3                              INDLms(10);
 172   3                              if(flag==0)
 173   3                              {       goto will_out_runled;}
 174   3                              else
 175   3                              {
 176   4                                      P1=designP[a];
C51 COMPILER V7.20   RUNLED                                                                10/14/2008 09:15:39 PAGE 4   

 177   4                                      P0=designP[b];
 178   4                                      P3=designP[c];
 179   4                                      P2=designP[d];
 180   4                                      a_temp=a;
 181   4                                      b_temp=b;
 182   4                                      c_temp=c;
 183   4                                      d_temp=d;
 184   4                              }
 185   3                      }
 186   2              }
 187   1      
 188   1              else if(P3 = 0x00)
*** WARNING C276 IN LINE 188 OF RUNLED.C: constant in condition expression
 189   1              {
 190   2                      for(a=a_temp,b=b_temp;b<10;a++,b++)
 191   2                      {       
 192   3                              INDLms(10);
 193   3                              if(flag==0)
 194   3                              {       goto will_out_runled;}
 195   3                              else
 196   3                              {
 197   4                                      P1=designP[a];
 198   4                                      P0=designP[b];
 199   4                                      a_temp=a;
 200   4                                      b_temp=b;
 201   4                              }
 202   3                      }
 203   2                      for(a=9,b=7,c=2;c<10;a++,b++,c++)
 204   2                      {       
 205   3                              INDLms(10);
 206   3                              if(flag==0)
 207   3                              {       goto will_out_runled;}
 208   3                              else
 209   3                              {
 210   4                                      P1=designP[a];
 211   4                                      P0=designP[b];
 212   4                                      P3=designP[c];
 213   4                                      a_temp=a;
 214   4                                      b_temp=b;
 215   4                                      c_temp=c;
 216   4                              }
 217   3                      }
 218   2                      for(a=8,b=9,c=7,d=2;d<8;a++,b++,c++,d++)
 219   2                      {       
 220   3                              INDLms(10);
 221   3                              if(flag==0)
 222   3                              {       goto will_out_runled;}
 223   3                              else
 224   3                              {
 225   4                                      P1=designP[a];
 226   4                                      P0=designP[b];
 227   4                                      P3=designP[c];
 228   4                                      P2=designP[d];
 229   4                                      a_temp=a;
 230   4                                      b_temp=b;
 231   4                                      c_temp=c;
 232   4                                      d_temp=d;
 233   4                              }
 234   3                      }
 235   2              }
 236   1      
 237   1      //      else if(P2^5==0 || P2^4==0 || P2^3==0 || P2^2==0 || P2^1==0 || P2^0==0)

⌨️ 快捷键说明

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