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

📄 motor_main.lst

📁 单片机控制的步进电机 不是很完善 但是能实现基本功能
💻 LST
📖 第 1 页 / 共 2 页
字号:
 133   1                      ST_Convert();           //将转速转换为T0常数
 134   1                      TH0=thdata;
 135   1                      TL0=tldata;
 136   1                      TR0=1;  
 137   1                      Show_Null();
 138   1                      Show_Sign();            //显示===========
 139   1                      Show_Ready();           //显示"准备好:" 
 140   1                      Show_Direction(direction);
 141   1                      key=0;
 142   1                      while((key!=START)&&(run==0))
 143   1                                      {       key=0;
 144   2                                              key=GetKey();
 145   2                                      }                                                       
 146   1                      if(stepflag)                            //步进方式
 147   1                              {       stl=step_length*4;                              
 148   2                                      Show_Null();            //清屏
 149   2                                      Show_Sign();            //显示===
 150   2                                      //Show_Step();          //显示"步进"
 151   2                                      Show_Direction(direction);
 152   2                                      Show_Speed(speed);
 153   2                                      Show_StepCnt(stepcnt);//"显示"步进:XXX""步进数
 154   2                                      while(1)
 155   2                                              {                                       
 156   3                                                      if(int_cnt==stl)
 157   3                                                              {       ET0=0;                                                          
 158   4                                                                      int_cnt=0;
 159   4                                                                      step_permit=0;
 160   4                                                              }
 161   3                                                      if(spdset){ST_Convert();Show_Speed(speed);spdset=0;}                                    
 162   3                                                      key=0;
 163   3                                                      key=GetKey();
 164   3                                                      if(key==STEP)
 165   3                                                              {       
 166   4                                                                      step_permit=1;
 167   4                                                                      int_cnt=0;                                                              
 168   4                                                                      ET0=1;                                                          
 169   4                                                                      Show_StepCnt(++stepcnt);//"显示":XXX""步进数
 170   4                                                                                                                                                                                                                                                                                                                                                                                      
 171   4                                                              }
 172   3                                                      else    if((key==DIR)||sisdf)
 173   3                                                              {
 174   4                                                                      direction=(~direction);
 175   4                                                                      Show_Direction(direction);
 176   4                                                                      sisdf=0;
 177   4                                                              }
 178   3                                                      else    if(key==RESET)(*(void(*)())0)();//热启动        
 179   3                                              }
C51 COMPILER V8.02   MOTOR_MAIN                                                            04/10/2007 13:45:24 PAGE 4   

 180   2                              }
 181   1      
 182   1                      else                    //全速运行方式  
 183   1                              {                                                                                                               
 184   2                                      ET0=1;  
 185   2                                      run=0;
 186   2                                      //Show_Null();          //清屏
 187   2                                      //Show_Sign();          //显示===
 188   2                                      //Show_Start();         //显示"启动"                                            
 189   2                                      Show_Null();            //清屏
 190   2                                      Show_Sign();            //显示===
 191   2                                      Show_Running();         //显示"运行中"                          
 192   2                                      Show_Direction(direction);
 193   2                                      Show_Speed(speed);
 194   2                                      while(1)
 195   2                                              {
 196   3                                                      if(spdset)
 197   3                                                              {       
 198   4                                                                      ST_Convert();
 199   4                                                                      Show_Speed(speed);
 200   4                                                                      spdset=0;
 201   4                                                              }       
 202   3                                                      key=0;
 203   3                                                      key=GetKey();
 204   3                                                      if((key==DIR)||sisdf)
 205   3                                                              {
 206   4                                                                      direction=(~direction);
 207   4                                                                      Show_Direction(direction);
 208   4                                                                      sisdf=0;
 209   4                                                              }
 210   3                                                      else    if((key==STOP)||stopflag)
 211   3                                                              {       
 212   4                                                                      ET0=0;
 213   4                                                                      Show_Null();            //清屏
 214   4                                                                      Show_Sign();            //显示===    
 215   4                                                                      Show_Stop();            //显示"停止"
 216   4                                                                      Show_Direction(direction);
 217   4                                                                      stopflag=0;
 218   4                                                              }
 219   3                                                      else    if((key==START)||run)
 220   3                                                              {
 221   4                                                                      ET0=1;
 222   4                                                                      //Show_Null();          //清屏
 223   4                                                                      //Show_Sign();          //显示===
 224   4                                                                      //Show_Start();         //显示"启动"                                            
 225   4                                                                      Show_Null();            //清屏
 226   4                                                                      Show_Sign();            //显示===
 227   4                                                                      Show_Running();         //显示"运行中"
 228   4                                                                      Show_Direction(direction);
 229   4                                                                      Show_Speed(speed);                                                              
 230   4                                                                      run=0;
 231   4                                                              }
 232   3                                                      else    if(key==RESET)(*(void(*)())0)();//热启动                                                                        
 233   3                                              }                                                       
 234   2                              }
 235   1              }
 236          
 237          
 238          /*
 239                  void    Right_Show_Figure       (uchar  x,uchar y,uchar figure_num);
 240                  void    Left_Show_Figure        (uchar  x,uchar y,uchar figure_num);
 241                  void    Lcd_SetZ                        (uchar z);
C51 COMPILER V8.02   MOTOR_MAIN                                                            04/10/2007 13:45:24 PAGE 5   

 242                  void    Lcd_Off                         (void);
 243                  void    Lcd_On                          (void);
 244                  void    IntRst                          (void);
 245                  void    Show_Null                       (void);//清屏
 246                  void    Show_Sign                       (void);//显示===========
 247                  void    Show_Greet                      (void);//显示电机控制系统湖南师范大学XXX制作   
 248                  bit             Show_Operation_Model(void);//显示"请预置工作方式"1全速2步进  
 249                  void    Show_Speed_Set          (void);//显示"请预置转速 "
 250                  void    Show_Step_Length        (void); //显示"请预置步长: "   
 251                  void    Show_Ready                      (void);//显示"准备好:"  
 252                  //void  Show_Start                      (void);//显示"启动" 
 253                  void    Show_Running            (void);//显示"运行中"
 254                  void    Show_Stop                       (void);//显示"停止"     
 255                  void    Show_Direction          (bit    a);//显示"正反向"       
 256                  void    Show_Speed                      (uchar sp);//显示"转速:XX"      
 257                  void    Show_StepCnt            (uchar stp);//"显示"步进:XXX""步进数
 258          */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    732    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      7       4
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      8       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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