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

📄 dataprocess.lst

📁 aduc7026裸机程序
💻 LST
📖 第 1 页 / 共 4 页
字号:
ARM COMPILER V2.42,  DataProcess                                                           17/01/09  22:24:15  PAGE 1   


ARM COMPILER V2.42, COMPILATION OF MODULE DataProcess
OBJECT MODULE PLACED IN DataProcess.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe DataProcess.c THUMB BROWSE DEBUG TABS(4) 

stmt  level    source

    1          #include "main.h"
    2          
    3          int p   = 0;              //优化变量
    4          int t   = 198;
    5          int s   = 1;
    6          int v   = 0;
    7          int w   = 1; 
    8          int etc = 0;
    9          int ratioint;
   10          
   11          unsigned int countadjust=3000;   //计数用的变量
   12          
   13              
   14          unsigned char ratiointendh  = 0;     //eto co2中间转换值
   15          unsigned char ratiointendl  = 0;
   16          unsigned char rr1           = 0;            //呼吸率转换值
   17          unsigned char rr2           = 0;
   18          unsigned char factor;     
   19          unsigned char a2;                //rationint changing number时时的co2值
   20          unsigned char a1;
   21          
   22          
   23          unsigned char flagadjust    = 1;
   24          unsigned char text          = 0;
   25          unsigned char ttflag;
   26          
   27          int   utem;                 //采用得到温度值
   28          int   uco2tem;              //temp variable
   29          int   ureftem;
   30          
   31          void DataProc()  //数据采集数据处理
   32          {   
   33   1          float baseline  = 950;      //基线值
   34   1          float baseline2 = 0;            //基线参考值
   35   1          float tempslop  = 0.5;         //co2浓度计算用的温度补偿系数(可改动系数*****************************)
   36   1          float uco2;                 //CO2光路输出值
   37   1          float uref;                 //参考光路的输出值
   38   1          float ratio;                    //采用比值
   39   1          int   count     = 1000;     //评价计算用的平均次数
   40   1          int   lapcount  = 1;            //time int
   41   1          int   rr        = 16;       ////呼吸率
   42   1          int   basetemp  = 3100;      //预设基准温度
   43   1      
   44   1      //bit to unsigned char
   45   1          unsigned char   rrflag      = 0;            //呼吸率计算用的标志位
   46   1          unsigned char   rrflag2         = 0;
   47   1          unsigned char   lapflag     = 0;              //出现呼吸间隔的标志位
   48   1      //  bit   flagstop      = 0;                 //程序起止标志位
   49   1          unsigned char   flagtemp    = 1;
   50   1      
   51   1          uco2=uco2*3/4+((float)uco2tem)/4;                         //对uco2,uref进行平均预处理
   52   1          uref=uref*3/4+((float)ureftem)/4;   
   53   1          ratio=(uco2/uref)*1000-(utem*0.8-basetemp)*tempslop;      //CO2浓度的基本计算式     
   54   1                                                                        //ratio=(uco2/uref)*1000-3.4*exp((utem-2450)*
             -0.01);
   55   1      
   56   1          if(countadjust != 0){
   57   2              if(countadjust > 1000){
   58   3                  ;                                       //系统工作的头30秒进行取样平均,
ARM COMPILER V2.42,  DataProcess                                                           17/01/09  22:24:15  PAGE 2   

   59   3              }else{                                      //欲对baseline进行绝对校准。20秒空操作后
   60   3                  baseline2 = baseline2 + ratio/count;    //10秒进行平均处理,得到新基准baseline2 
   61   3              }
   62   2              countadjust--;
   63   2              if(countadjust==1001&&flagtemp==1){
   64   3                   utem=ADCChannel(3);              //在20秒末取温度值,作为basetemp
   65   3                   basetemp=utem;
   66   3                   flagtemp=0;
   67   3              }
   68   2              if(flagadjust==0&&(abs(ratio-baseline)>55)){
   69   3                  rrflag=1;
   70   3                  lapflag=1;                                //
   71   3                  lapcount++;
   72   3                  s=1;
   73   3              }else if(abs(ratio-baseline)<35){                                     //计算得到呼吸率 在呼吸的过程中适时地调整基线值                       
             -    
   74   3                  lapcount++;
   75   3                  if((lapflag=1)&&(ratio>baseline)){
   76   4                      baseline=ratio;
   77   4                  }
   78   3                  if((lapflag=1)&&(baseline>ratio+20)){
   79   4                      if(s>0){
   80   5                          baseline=baseline-10;
   81   5                          s--;
   82   5                          if(baseline>ratio){
   83   6                              baseline=baseline-5;
   84   6                          }
   85   5                      }
   86   4                  }
   87   3                  rrflag=0;
   88   3                  rrflag2=1;
   89   3              }
   90   2              if(rrflag==1&&rrflag2==1){ 
   91   3                  rr=rr/2+5600/lapcount/2;                                   //滚动计算
   92   3      //          rr=5400/lapcount;
   93   3                  if(rr<100){                   
   94   4                      rr1=(rr/128);
   95   4                      rr2=(rr%128);
   96   4                  }else{
   97   4                      rr1=0;
   98   4                      rr2=20;
   99   4                  }
  100   3                  lapcount=1;
  101   3                  rrflag2=0;
  102   3                  rrflag=0;
  103   3                  lapflag=0;
  104   3              }    
  105   2          }else{  
  106   2              if(flagadjust!=0){            //系统首次运行,进行绝对校准,以后则不在运行
  107   3                  flagadjust=0;
  108   3                  baseline=baseline2;
  109   3                  baseline2=0;
  110   3                  count=150;
  111   3                  countadjust=count;
  112   3              }else{
  113   3                  if(abs(baseline2-baseline)<30){
  114   4                      if(baseline2>baseline){
  115   5                          baseline=baseline+2;
  116   5                      }else{ 
  117   5                          baseline=baseline-2;
  118   5                      }   
  119   4                  }
  120   3                  baseline2=0;
  121   3                  count=300;
  122   3                  countadjust=count;
  123   3              }
ARM COMPILER V2.42,  DataProcess                                                           17/01/09  22:24:15  PAGE 3   

  124   2          }
  125   1          ratioint=(int)(((baseline-ratio)*(float)factor/10)+880);   //波形的计算公式
  126   1          a1=((ratioint/256)<<1)+(((ratioint%256)&0x80)/128);                                                     
             -      //取值转换
  127   1          a2=(ratioint%256)&0x7f;
  128   1          if(ratioint>1150){ 
  129   2             v++;
  130   2             etc=etc+ratioint;
  131   2             p=0;
  132   2             if(v>6){
  133   3                  etc=etc/210;
  134   3                  ratiointendh=((etc/256)<<1)+(((etc%256)&0x80)/128);
  135   3                  ratiointendl=(etc%256)&0x7f;
  136   3                  etc=0;
  137   3                  v=0;
  138   3              }
  139   2          }
  140   1          if(ratioint<1005){
  141   2              p++;
  142   2              if(p>1000){
  143   3                  ratiointendh=0;
  144   3                  ratiointendl=0;
  145   3              }
  146   2          }   
  147   1          if(ttflag==0&&flagadjust!=0){
  148   2              SendHex(0x80);
  149   2              SendHex(0x04);
  150   2              SendHex(0x05);
  151   2              SendHex(0x07);
  152   2              SendHex(0x68);
  153   2          }else if(ttflag==0){     //波形输出
  154   2              SendHex(0x80);
  155   2              SendHex(0x04);
  156   2              SendHex(0x05);
  157   2              SendHex(a1);
  158   2              SendHex(a2);        
  159   2          }
  160   1      } 
ARM COMPILER V2.42,  DataProcess                                                           17/01/09  22:24:15  PAGE 4   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN CODE16 (abs?T)
 EXTERN CODE16 (SendHex?T)
 EXTERN CODE16 (ADCChannel?T)
 EXTERN CODE16 (?C?FPMUL?T)
 EXTERN CODE16 (?C?FPDIV?T)
 EXTERN CODE16 (?C?FCAST?T)
 EXTERN CODE16 (?C?FPADD?T)
 EXTERN CODE16 (?C?FPSUB?T)
 EXTERN CODE16 (?C?CASTF?T)
 EXTERN CODE16 (?C?FPCMP?T)
 EXTERN CODE16 (?C?SDIV?T)
 EXTERN CODE16 (?C?FCASTU?T)



*** PUBLICS:
 PUBLIC         DataProc?T
 PUBLIC         p
 PUBLIC         t
 PUBLIC         s
 PUBLIC         v
 PUBLIC         w
 PUBLIC         etc
 PUBLIC         ratioint
 PUBLIC         countadjust
 PUBLIC         ratiointendh
 PUBLIC         ratiointendl
 PUBLIC         rr1
 PUBLIC         rr2
 PUBLIC         factor
 PUBLIC         a2
 PUBLIC         a1
 PUBLIC         flagadjust
 PUBLIC         text
 PUBLIC         ttflag
 PUBLIC         utem
 PUBLIC         uco2tem
 PUBLIC         ureftem



*** DATA SEGMENT '?DT0?DataProcess':
 00000000          p:
 00000000           BEGIN_INIT
 00000000  00000000  DD          0x0
 00000004           END_INIT
 00000004          t:
 00000004           BEGIN_INIT
 00000004  000000C6  DD          0xC6
 00000008           END_INIT
 00000008          s:
 00000008           BEGIN_INIT
 00000008  00000001  DD          0x1
 0000000C           END_INIT
 0000000C          v:
 0000000C           BEGIN_INIT
 0000000C  00000000  DD          0x0
 00000010           END_INIT
 00000010          w:
 00000010           BEGIN_INIT
 00000010  00000001  DD          0x1
 00000014           END_INIT
 00000014          etc:
 00000014           BEGIN_INIT
 00000014  00000000  DD          0x0

⌨️ 快捷键说明

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