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

📄 electromotion.lst

📁 步进电机控制主机程序,与步进电机控制副机程序配合使用。
💻 LST
字号:
C51 COMPILER V7.01  ELECTROMOTION                                                          09/19/2005 08:41:27 PAGE 1   


C51 COMPILER V7.01, COMPILATION OF MODULE ELECTROMOTION
OBJECT MODULE PLACED IN electromotion.OBJ
COMPILER INVOKED BY: C:\keil\C51\BIN\C51.EXE electromotion.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #pragma small
   2          #include "reg66x.h"
   3          #include "commun.h"
   4          
   5          
   6          
   7          unsigned char   respiration_ratio[6]= { 1, 2, 3, 4, 5, 6 };             //对应呼吸比1:0.5~1:3
   8          unsigned char   respiration_frequency;                  //呼吸频率
   9          unsigned int    tide;                                                   //潮气量
  10          unsigned char   ratio;                                                  //设定的吸呼比
  11                  
  12          unsigned int    motor_speed,                                    //步进电机速度
  13                                          motor_steps;                                    //步进电机步数
  14          
  15          unsigned char   data_send[8]={0,0,0,0,0,0,0,0};
  16          
  17          
  18          main()
  19          {
  20   1              unsigned int time_inspiration,                          //吸气时间ms
  21   1                                      time_inspiration_fact,                  //实际步进电机吸气时间ms
  22   1                                      time_inspiration_plate,                 //吸气平台时间ms
  23   1                                      time_respiration;                               //一个呼吸周期时间ms
  24   1          unsigned long temp = 0;
  25   1              unsigned char i = 0;
  26   1              
  27   1              motor_speed = 0;
  28   1              motor_steps = 0;
  29   1          time_inspiration = 0;
  30   1          time_inspiration_fact = 0;
  31   1          time_inspiration_plate = 0;
  32   1              byte_responses = 0;
  33   1              ratio = respiration_ratio[3];
  34   1              respiration_frequency = 20;
  35   1              tide = 1200;
  36   1              time_respiration = (60 * 1000)/(unsigned int)respiration_frequency;
  37   1              time_inspiration = time_respiration *2 /(2 + ratio);
  38   1              time_inspiration_fact = time_inspiration * 9/10;
  39   1              time_inspiration_plate = time_inspiration /10;
  40   1              motor_steps = tide * 5 / 2;                                                                     //根据潮气量得到总步数;
  41   1          temp = (unsigned long)time_inspiration_fact * 1000;
  42   1              temp /=(unsigned long)motor_steps;
  43   1              temp -= 66;
  44   1          temp *= 2;
  45   1          motor_speed = (unsigned int)temp;                       //步进电机速度us(1个字=0.5us)
  46   1              data_send[0] = motor_speed / 0x100;
  47   1              data_send[1] = motor_speed % 0x100;
  48   1              data_send[2] = motor_steps / 0x100;
  49   1              data_send[3] = motor_steps % 0x100;
  50   1              data_send[4] = time_inspiration_plate / 0x100;
  51   1              data_send[5] = time_inspiration_plate % 0x100;
  52   1              data_send[6] = time_respiration / 0x100;
  53   1              data_send[7] = time_respiration % 0x100;
  54   1              init_timer();
  55   1              scon_send(0x80);
C51 COMPILER V7.01  ELECTROMOTION                                                          09/19/2005 08:41:27 PAGE 2   

  56   1              while(byte_responses !=0x81);
  57   1              for(i = 0;i < 8; i++)
  58   1              {
  59   2                      scon_send(data_send[i]);
  60   2              }
  61   1              while(1);
  62   1      
  63   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    310    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     22       9
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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