fir.c

来自「通过这个程序」· C语言 代码 · 共 17 行

C
17
字号
/*************************************************************************************************
N is the length of the FIR filter (steps+1)  FIR_coefficient[] is the coefficients of this filter,
it's type is int;  unsigned int &FIR_data[] is the before data of this filter,also can change the
data; unsigned int NOW_data is the NOW data for this filter
*************************************************************************************************/
#include<avr/io.h>
long FIR_filter(int FIR_coefficient[],unsigned int *FIR_data,unsigned int NOW_data,int N)
{  long FIR_result=0;
   N=N-1;
   for(;N>0;N--)
     { FIR_result+=FIR_coefficient[N] * *(FIR_data+N);
       *(FIR_data+N)=*(FIR_data+N-1);
	 }
   *FIR_data=NOW_data;
   FIR_result+=*FIR_data*FIR_coefficient[0]; 
   return FIR_result;    
}

⌨️ 快捷键说明

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