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

📄 emeter_filters.c

📁 基于MSPF449的三相电压表功率的开发程序
💻 C
字号:
//**************************************************************************
//    The FIR filter is used here for phase lag/lead compensation.
//    The phase lag/lead compensation FIR do not have unity gain factor so an
//    extra gain compensation stage is added.
//    The FIR is implement in fractional binary arithmatic. Sign the gain correction 
//      can be >1. This needs to be taken into account 
//
//    Vincent Chan 
//    Texas Instruments Hong Kong Ltd
//    Date        Comments
//    =====================
//    01/09/19    Code Starts
//    01/10/07    First cut test done
//**************************************************************************
#include "emeter_3phase.h"
//--------------------------------------------------------------------------


//  This routine provides a one TAP FIR which gives a fractional delay. The gain is compensated

int FIR(int int_params[],int input)
{
int i,j;
              //y[n+1]*gain = x[n+1]+beta*x[n+1];
if(int_params[FIR_GAIN]<0)        
  {                             //In this case gain >1
  i=FRACTIONAL_SIGNED_MUL(int_params[FIR_TAP],int_params[FIR_BETA])+input;
  j=int_params[FIR_GAIN]-32768;
  j=FRACTIONAL_SIGNED_MUL(j,i)+i;
  i=j;
  }
else
  {  
  i=FRACTIONAL_SIGNED_MUL(int_params[FIR_TAP],int_params[FIR_BETA])+input;
  i=FRACTIONAL_SIGNED_MUL(int_params[FIR_GAIN],i);
  }

int_params[FIR_TAP]=input;
return(i);
}

⌨️ 快捷键说明

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