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

📄 pwm_gen.lst

📁 蛇形机器人程序
💻 LST
字号:
C51 COMPILER V7.09   PWM_GEN                                                               07/01/2004 21:24:07 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<reg52.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          unsigned char time=0;
  14          //what is uchar
  15          
  16          // the duration is cycle(10) * (0x100 - 0x58)//(168)
  17          // when LeftCounter/RightCounter of cycle flip
  18          
  19          void PWM() interrupt 1
  20          {
  21   1              TR0=0;          //turn on the counter
  22   1              
  23   1              //~~~~~~Left Motor~~~~~~~~~
  24   1              if(iLeftCounter == LeftSpeed)
  25   1              {
  26   2                      DriveLeftMo1 = 0;       //LeftStop
  27   2                      DriveLeftMo2 = 0;
  28   2              }
  29   1              if(iLeftCounter == Cycle)
  30   1              {
  31   2                      if(DirectionLeft)
  32   2                      {
  33   3                              DriveLeftMo1 = 1;       //LeftRun
  34   3                              DriveLeftMo2 = 0;
  35   3                      }
  36   2                      else
  37   2                      {
  38   3                              DriveLeftMo1 = 0;       //LeftBack
  39   3                              DriveLeftMo2 = 1;
  40   3                      }
  41   2                      iLeftCounter = -1;       
  42   2              } 
  43   1              //~~~~~Right Motor~~~~~~~~
  44   1              if(iRightCounter == RightSpeed)
  45   1              {
  46   2                      DriveRightMo1 = 0;
  47   2                      DriveRightMo2 = 0;       // Stop
  48   2              }
  49   1              if(iRightCounter == Cycle)
  50   1              {
  51   2                      if(DirectionRight)  //driection
  52   2                      {
  53   3                              DriveRightMo1 = 1;
  54   3                              DriveRightMo2 = 0;                                      //RightRun
C51 COMPILER V7.09   PWM_GEN                                                               07/01/2004 21:24:07 PAGE 2   

  55   3                      }
  56   2                      else 
  57   2                      {
  58   3                              DriveRightMo1 = 0;
  59   3                              DriveRightMo2 = 1;                                      //RightBack
  60   3                      }
  61   2                      iRightCounter = -1;                             // 
  62   2              }
  63   1      
  64   1              iLeftCounter++;
  65   1              iRightCounter++;
  66   1      
  67   1              TH0 = TIMER0H;
  68   1              TL0 = TIMER0L;
  69   1              TR0 = 1;
  70   1      }
  71          
  72          
  73          void timer() interrupt 3
  74          {
  75   1         TR1=0;
  76   1         if(time==130)
  77   1         {
  78   2              Stop();
  79   2              ReleaseMotor = 0;               //release the blocker?
  80   2      
  81   2              Delay(10000);
  82   2              ReleaseMotor = 1;
  83   2      
  84   2              Stop();
  85   2              TouchSensor1=0;
  86   2              TouchSensor2=0;
  87   2              }
  88   1              else
  89   1              {
  90   2              time++;
  91   2              TH1=TIMER1H;
  92   2              TL1=TIMER1L;
  93   2              }
  94   1              TR1=1;
  95   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    161    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      5    ----
   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 + -