rmp_cntl.c

来自「在ccs编程环境下」· C语言 代码 · 共 35 行

C
35
字号

#include "IQmathLib.h"         /* Include header for IQmath library */
/* Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file */
#include "rmp_cntl.h"

void rmp_cntl_calc(RMPCNTL *v)
{	

	
      if (((v->target_value - v->setpt_value)>_IQ(0.0005))||((v->target_value - v->setpt_value)<-_IQ(0.0001)))
      {
         v->rmp_delay_cntl += 1;
         if (v->rmp_delay_cntl >= v->rmp_dly_max)
         {
           if (v->target_value > v->setpt_value)
           {
            v->setpt_value += _IQ(0.0005);  /* 0.0000305 is resolution of Q15 */
            if (v->setpt_value > v->rmp_hi_limit)
              v->setpt_value = v->rmp_hi_limit;           
            v->rmp_delay_cntl = 0;
           }
           else
           {
            v->setpt_value -= _IQ(0.0005);  /* 0.0000305 is resolution of Q15 */
            if (v->setpt_value < v->rmp_lo_limit)
              v->setpt_value = v->rmp_lo_limit;           
            v->rmp_delay_cntl = 0;
           }
         }        
      }
      else  v->s_eq_t_flg = 0x7FFFFFFF; 
}


⌨️ 快捷键说明

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