astep.lst

来自「3000TB51配套实验例程 1八段数码管显示实验 等」· LST 代码 · 共 127 行

LST
127
字号
C51 COMPILER V7.07   ASTEP                                                                 06/21/2005 17:15:08 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE ASTEP
OBJECT MODULE PLACED IN Astep.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE Astep.c DEBUG OBJECTEXTEND

stmt level    source

   1          /*“验证式”   实验十九??步进电控制机   */
   2          
   3          #include <reg51.h>
   4          #define Astep 0x01
   5          #define Bstep 0x02
   6          #define Cstep 0x04
   7          #define Dstep 0x08
   8          
   9          unsigned char dly_c;
  10          
  11          void delay()
  12          {
  13   1         unsigned char tt,cc;
  14   1      
  15   1         cc = dly_c;
  16   1         tt = 0x0;
  17   1         do{
  18   2           do {
  19   3           }while(--tt);
  20   2         }while(--cc);
  21   1      }
  22          
  23          void main()
  24          {
  25   1         unsigned char state=1,count=0;
  26   1         int n=0;
  27   1      
  28   1      
  29   1      
  30   1         dly_c = 170;
  31   1      
  32   1         /* 单/双八拍工作方式 */
  33   1      
  34   1      
  35   1      
  36   1         /* 双四拍工作方式 */
  37   1         while(n++!=75)
  38   1         {
  39   2            P1 = Astep+Bstep;
  40   2            delay();
  41   2            P1 = Bstep+Cstep;
  42   2            delay();
  43   2            P1 = Cstep+Dstep;
  44   2            delay();
  45   2            P1 = Dstep+Astep;
  46   2            delay();
  47   2            if(dly_c>20&&state==1)
  48   2              dly_c-=6;
  49   2            if(dly_c==20&&count<25)
  50   2               {
  51   3                state=2;
  52   3                count++;
  53   3               }
  54   2            if(state==2&&count==25)
  55   2                {
C51 COMPILER V7.07   ASTEP                                                                 06/21/2005 17:15:08 PAGE 2   

  56   3                 state=3;
  57   3                 count=0;
  58   3                }
  59   2            if(state==3&&dly_c<170)
  60   2                 dly_c+=6;
  61   2            if(state==3&&dly_c==170)
  62   2                state=1;
  63   2      
  64   2         }
  65   1         //for(k=0;k<40;k++)
  66   1       //  delay();
  67   1      /* 单四拍工作方式 */
  68   1         while(n--!=0)
  69   1         {  P1 = Dstep+Astep;
  70   2            P1=P1|0x80;
  71   2            delay();
  72   2            P1 = Cstep+Dstep;
  73   2            P1=P1|0x80;
  74   2            delay();
  75   2            P1 = Bstep+Cstep;
  76   2            P1=P1|0x80;
  77   2            delay();
  78   2            P1 = Astep+Bstep;
  79   2            P1=P1|0x80;
  80   2            delay();
  81   2            if(dly_c>20&&state==1)
  82   2              dly_c-=6;
  83   2            if(dly_c==20&&count<25)
  84   2               {
  85   3                state=2;
  86   3                count++;
  87   3               }
  88   2            if(state==2&&count==25)
  89   2                {
  90   3                 state=3;
  91   3                 count=0;
  92   3                }
  93   2            if(state==3&&dly_c<170)
  94   2                 dly_c+=6;
  95   2            if(state==3&&dly_c==170)
  96   2                state=1;
  97   2         }
  98   1      
  99   1      
 100   1      }
 101          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    241    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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