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

📄 turn.lst

📁 蛇形机器人程序
💻 LST
字号:
C51 COMPILER V7.09   TURN                                                                  06/13/2004 23:46:16 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE TURN
OBJECT MODULE PLACED IN Turn.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE Turn.c OMF2 ROM(COMPACT) OPTIMIZE(SIZE) REGFILE(.\FollowLine.ORC) BROWSE DE
                    -BUG

line level    source

   1          /*
   2                  Motor Truning Prgram
   3          */
   4          
   5          #include<REG2051.h>
   6          #include<FollowLine.h>
   7          #include<intrins.h>
   8          //~~~~~~~~~~~~~~~~~~
   9          #define TurnTime 700
  10          //~~~~~~Delay for let the rotate origin is on the line Cross Point~~~~~~
  11          extern unsigned int iStopTime;
  12          extern unsigned int iFollowLineTime;
  13          //~~~~~~~~~~~~~~~~~~
  14          void TrunLeft(char Speed);
  15          void TurnRight(char Speed);
  16          
  17          
  18          
  19          //~~~~~~~~~~~~~~~~~~~~~ Motor Trun Left~~~~~~~~~~~~~~~~~~~~~~~~
  20          
  21          void TurnLeft(char Speed)
  22                  // assume the use TurnLeft after a lineCross
  23          {
  24   1                      Delay(6300);            //delay to on the LineCross      //4500
  25   1                      
  26   1                                      
  27   1                      MotorLeft(9,0);         
  28   1                      _nop_ ();
  29   1                      MotorRight(9,1);        
  30   1                      _nop_ ();
  31   1                      Delay(5000);            //start up
  32   1                                      
  33   1                      MotorLeft(6,0);         //left: speed 4 forward
  34   1                      _nop_ ();
  35   1                      MotorRight(6,1);        //Right: Speed 4 backward
  36   1                      _nop_ ();
  37   1                      Delay(1500);            //about 45 degree
  38   1      
  39   1                      while(HozSensor1 == 1)  // left hoz sensor 
  40   1                                                                      //use driect Hozsensor flag
  41   1                      {
  42   2                              MotorLeft(4,0);         //deccerate                3
  43   2                              _nop_ ();
  44   2                              MotorRight(4,1);        //Right: Speed 3 backward
  45   2                              _nop_ ();
  46   2                      //pressume the distance between sensor and the rotate origin is 30 cm
  47   2                      //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available          
  48   2                              UpdateStatus();                 // prepare for FollowLine
  49   2                      }
  50   1                      while(MidSensor1 == 1)  //use driect sensor flag
  51   1                      {
  52   2                              MotorLeft(3,0);         //left: speed 2 forward
  53   2                              _nop_ ();
  54   2                              MotorRight(3,1);        //Right: Speed 2 backward
C51 COMPILER V7.09   TURN                                                                  06/13/2004 23:46:16 PAGE 2   

  55   2                              _nop_ ();
  56   2                      //pressume the distance between sensor and the rotate origin is 30 cm
  57   2                      //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available          
  58   2                              UpdateStatus();                 //
  59   2                      }
  60   1      
  61   1                      UpdateStatus();
  62   1              while(iFollowLineTime < TurnTime)
  63   1              {
  64   2                      SensorSta();
  65   2                      FollowLine((Speed-2));                  
  66   2                      iFollowLineTime++;                                
  67   2              }
  68   1              iFollowLineTime = 0;
  69   1      
  70   1      
  71   1      }
  72          
  73          
  74          //~~~~~~~~~~~~~~~~~~~~~ Motor Trun Right~~~~~~~~~~~~~~~~~~~~~~~~
  75          void TurnRight(char Speed )
  76          // Trun Right
  77          {
  78   1      //      while((LineSensor1 == 1)||(LineSensor2 == 1)) //locate the rotate orign
  79   1      //      {}
  80   1      //      Stop();
  81   1              Delay(6000);
  82   1                              //rotate right
  83   1              MotorLeft(1,0);         
  84   1              _nop_ ();
  85   1              MotorRight(3,0);        
  86   1              _nop_ ();
  87   1              Delay(5000);            
  88   1      
  89   1              while(HozSensor2 == 1)  // left hoz sensor 
  90   1                                                                      //use driect Hozsensor flag
  91   1              {
  92   2                      MotorLeft(3,1);         //deccerate                3
  93   2                      _nop_ ();
  94   2                      MotorRight(3,0);        //Right: Speed 3 backward
  95   2                      _nop_ ();
  96   2                      //pressume the distance between sensor and the rotate origin is 30 cm
  97   2                      //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available          
  98   2                      UpdateStatus();                 // prepare for FollowLine
  99   2              }
 100   1                      while(MidSensor2 == 1)  //use driect sensor flag
 101   1                      {
 102   2                              MotorLeft(2,1);         //left: speed 2 forward
 103   2                              _nop_ ();
 104   2                              MotorRight(2,0);        //Right: Speed 2 backward
 105   2                              _nop_ ();
 106   2                      //pressume the distance between sensor and the rotate origin is 30 cm
 107   2                      //all 4 sensor have lost the line :CurStaHozSensor1 == 0 Not available          
 108   2                              UpdateStatus();                 //
 109   2                      }
 110   1                      Stop();
 111   1                      Delay(2000);
 112   1      
 113   1                      UpdateStatus();
 114   1      
 115   1      }
*** WARNING C280 IN LINE 75 OF TURN.C: 'Speed': unreferenced local variable
C51 COMPILER V7.09   TURN                                                                  06/13/2004 23:46:16 PAGE 3   

 116          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    225    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       2
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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