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

📄 pwm_gen.lst

📁 蛇形机器人程序
💻 LST
字号:
C51 COMPILER V7.09   PWM_GEN                                                               06/11/2004 03:11:40 PAGE 1   


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

line level    source

   1          ///////////////////////////////////////////////////
   2          //pwm_gen
   3          ///////////////////////////////////////////////////
   4          #include<FollowLine.h>
   5          #include<intrins.h>
   6          #include<REG2051.h>
   7          
   8          char iLeftCounter = 0;  //Current high level Counter
   9          char iRightCounter = 0;  // the original value from xiao mao is l r 
  10          char RightSpeed=0;              //High level precent of Cycle expected 
  11                                                          //0 - 16 of 16
  12          char LeftSpeed=0;               //the original value XM is LeftCounter
  13          //what is uchar
  14          
  15          // the duration is cycle(10) * (0x100 - 0x58)//(168)
  16          // when LeftCounter/RightCounter of cycle flip
  17          
  18          void PWM() interrupt 1
  19          {
  20   1              TR0=0;          //turn on the counter
  21   1              
  22   1              //~~~~~~Left Motor~~~~~~~~~
  23   1              if(iLeftCounter == LeftSpeed)
  24   1              {
  25   2                      DriveLeftMo1 = 0;       //LeftStop
  26   2                      DriveLeftMo2 = 0;
  27   2              }
  28   1              if(iLeftCounter == Cycle)
  29   1              {
  30   2                      if(DirectionLeft)
  31   2                      {
  32   3                              DriveLeftMo1 = 1;       //LeftRun
  33   3                              DriveLeftMo2 = 0;
  34   3                      }
  35   2                      else
  36   2                      {
  37   3                              DriveLeftMo1 = 0;       //LeftBack
  38   3                              DriveLeftMo2 = 1;
  39   3                      }
  40   2                      iLeftCounter = -1;       
  41   2              } 
  42   1              //~~~~~Right Motor~~~~~~~~
  43   1              if(iRightCounter == RightSpeed)
  44   1              {
  45   2                      DriveRightMo1 = 0;
  46   2                      DriveRightMo2 = 0;       // Stop
  47   2              }
  48   1              if(iRightCounter == Cycle)
  49   1              {
  50   2                      if(DirectionRight)  //driection
  51   2                      {
  52   3                              DriveRightMo1 = 1;
  53   3                              DriveRightMo2 = 0;                                      //RightRun
  54   3                      }
C51 COMPILER V7.09   PWM_GEN                                                               06/11/2004 03:11:40 PAGE 2   

  55   2                      else 
  56   2                      {
  57   3                              DriveRightMo1 = 0;
  58   3                              DriveRightMo2 = 1;                                      //RightBack
  59   3                      }
  60   2                      iRightCounter = -1;                             // 
  61   2              }
  62   1      
  63   1              iLeftCounter++;
  64   1              iRightCounter++;
  65   1      
  66   1              TH0 = TIMER0H;
  67   1              TL0 = TIMER0L;
  68   1              TR0 = 1;
  69   1      }


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


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

⌨️ 快捷键说明

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