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

📄 1.lst

📁 基于51单片机的步进电机驱动,有各种转角控制,转向控制等.
💻 LST
字号:
C51 COMPILER V8.05a   1                                                                    08/14/2007 21:12:56 PAGE 1   


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

line level    source

   1          sfr P1= 0x90;
   2          #include"reg52.h"
*** ERROR C231 IN LINE 14 OF C:\KEIL\MCU\C51\INC\REG52.H: 'P1': redefinition
   3          #include"user.h"
   4          #include"math.h"
   5          #define uchar unsigned char
   6          
   7          #define out P1
   8          sbit EN=P3^7;
   9          
  10          void run(int motor_A_counter,int motor_B_counter)
  11          {
  12   1              uchar state_A,state_B,new_state,temp1,temp2;
  13   1              unsigned int temp_A,temp_B;
  14   1      
  15   1              if (motor_A_counter==0)
  16   1              goto B;
  17   1              if (motor_A_counter>0)
  18   1              {
  19   2                      temp_A=abs(motor_A_counter);
  20   2                      while((temp_A--)!=0)
  21   2                      {
  22   3                              temp1=out;
  23   3                              temp1 &=0x0f;
  24   3      
  25   3                              
  26   3                              state_A=out;
  27   3                              state_A &= 0xf0;
  28   3                              state_A>>=4;
  29   3                              
  30   3      
  31   3                              switch (state_A)
  32   3                              {
  33   4                                      case 1:
  34   4                                      new_state=3;
  35   4                                      break;
  36   4      
  37   4                                      case 3:
  38   4                                      new_state=2;
  39   4                                      break;
  40   4      
  41   4                                      case 2:
  42   4                                      new_state=6;
  43   4                                      break;
  44   4      
  45   4                                      case 6:
  46   4                                      new_state=4;
  47   4                                      break;
  48   4      
  49   4                                      case 4:
  50   4                                      new_state=12;
  51   4                                      break;
  52   4      
  53   4                                      case 12:
  54   4                                      new_state=8;
C51 COMPILER V8.05a   1                                                                    08/14/2007 21:12:56 PAGE 2   

  55   4                                      break;
  56   4      
  57   4                                      case 8:
  58   4                                      new_state=9;
  59   4                                      break;
  60   4      
  61   4                                      case 9:
  62   4                                      new_state=1;
  63   4                                      break;
  64   4      
  65   4                              }
  66   3                              new_state<<=4;
  67   3                              out=new_state | temp1;
  68   3                              delay(3);
  69   3                      }
  70   2              }
  71   1              if (motor_A_counter<0)
  72   1              {
  73   2                      temp_A=abs(motor_A_counter);
  74   2                      while((temp_A--)!=0)
  75   2                      {
  76   3                              temp1=out;
  77   3                              temp1 &=0x0f;
  78   3                              state_A=out;
  79   3                              state_A &= 0xf0;
  80   3                              state_A>>=4;
  81   3      
  82   3                              switch (state_A)
  83   3                              {
  84   4                                      case 9:
  85   4                                      new_state=8;
  86   4                                      break;
  87   4      
  88   4                                      case 8:
  89   4                                      new_state=12;
  90   4                                      break;
  91   4      
  92   4                                      case 12:
  93   4                                      new_state=4;
  94   4                                      break;
  95   4      
  96   4                                      case 4:
  97   4                                      new_state=6;
  98   4                                      break;
  99   4      
 100   4                                      case 6:
 101   4                                      new_state=2;
 102   4                                      break;
 103   4      
 104   4                                      case 2:
 105   4                                      new_state=3;
 106   4                                      break;
 107   4      
 108   4                                      case 3:
 109   4                                      new_state=1;
 110   4                                      break;
 111   4      
 112   4                                      case 1:
 113   4                                      new_state=9;
 114   4                                      break;
 115   4      
 116   4                              }
C51 COMPILER V8.05a   1                                                                    08/14/2007 21:12:56 PAGE 3   

 117   3                              new_state<<=4;
 118   3                              out=new_state | temp1;
 119   3                              delay(3);
 120   3                      }
 121   2              }
 122   1      
 123   1      //----------------------------------------------------------------
 124   1      
 125   1      
 126   1      B:      if (motor_B_counter==0)
 127   1              goto exit;
 128   1              if (motor_B_counter>0)
 129   1              {
 130   2                      temp_B=abs(motor_B_counter);
 131   2                      while((temp_B--)!=0)
 132   2                      {
 133   3                              temp2=out;
 134   3                              temp2 &=0xf0;
 135   3                              state_B=out;
 136   3                              state_B &= 0x0f;
 137   3                              
 138   3      
 139   3                              switch (state_B)
 140   3                              {
 141   4                                      case 1:
 142   4                                      new_state=3;
 143   4                                      break;
 144   4      
 145   4                                      case 3:
 146   4                                      new_state=2;
 147   4                                      break;
 148   4      
 149   4                                      case 2:
 150   4                                      new_state=6;
 151   4                                      break;
 152   4      
 153   4                                      case 6:
 154   4                                      new_state=4;
 155   4                                      break;
 156   4      
 157   4                                      case 4:
 158   4                                      new_state=12;
 159   4                                      break;
 160   4      
 161   4                                      case 12:
 162   4                                      new_state=8;
 163   4                                      break;
 164   4      
 165   4                                      case 8:
 166   4                                      new_state=9;
 167   4                                      break;
 168   4      
 169   4                                      case 9:
 170   4                                      new_state=1;
 171   4                                      break;
 172   4      
 173   4                              }
 174   3                              
 175   3                              out=new_state | temp2;
 176   3                              delay(3);
 177   3                      }
 178   2              }
C51 COMPILER V8.05a   1                                                                    08/14/2007 21:12:56 PAGE 4   

 179   1              if (motor_B_counter<0)
 180   1              {
 181   2                      temp_B=abs(motor_B_counter);
 182   2                      while((temp_B--)!=0)
 183   2                      {
 184   3                              temp2=out;
 185   3                              temp2 &=0xf0;
 186   3                              state_B=out;
 187   3                              state_B &= 0x0F;
 188   3                      
 189   3      
 190   3                              switch (state_B)
 191   3                              {
 192   4                                      case 9:
 193   4                                      new_state=8;
 194   4                                      break;
 195   4      
 196   4                                      case 8:
 197   4                                      new_state=12;
 198   4                                      break;
 199   4      
 200   4                                      case 12:
 201   4                                      new_state=4;
 202   4                                      break;
 203   4      
 204   4                                      case 4:
 205   4                                      new_state=6;
 206   4                                      break;
 207   4      
 208   4                                      case 6:
 209   4                                      new_state=2;
 210   4                                      break;
 211   4      
 212   4                                      case 2:
 213   4                                      new_state=3;
 214   4                                      break;
 215   4      
 216   4                                      case 3:
 217   4                                      new_state=1;
 218   4                                      break;
 219   4      
 220   4                                      case 1:
 221   4                                      new_state=9;
 222   4                                      break;
 223   4      
 224   4                              }
 225   3                              
 226   3                              
 227   3                              out=new_state | temp2;
 228   3                              delay(3);
 229   3                      }
 230   2              }
 231   1      
 232   1      exit :   delay(1);
 233   1      
 234   1      }
 235          
 236          
 237          
 238          
 239          
 240                  
C51 COMPILER V8.05a   1                                                                    08/14/2007 21:12:56 PAGE 5   

 241          
 242          
 243          void main(void)
 244          {
 245   1      //      uchar code a[8]={0x11,0x33,0x22,0x66,0x44,0xcc,0x88,0x99};
 246   1      
 247   1              
 248   1              double L1,L2,x,y,H,W;
 249   1      
 250   1              EN=0;
 251   1              out=0x11;
 252   1              H=10000;
 253   1              W=10000;
 254   1              x=1;
 255   1              y=1;
 256   1              
 257   1              L1=sqrt(x*x+(H-y)*(H-y));
 258   1              L2=sqrt((W-x)*(W-x)+(H-y)*(H-y));
 259   1      
 260   1              
 261   1              while(1)
 262   1              {
 263   2                      run(-1,0);
 264   2              
 265   2              
 266   2              }
 267   1      
 268   1              
 269   1      
 270   1      }
 271                  

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

⌨️ 快捷键说明

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