我要设计一个低通滤波器,由matlab生成的系数已经导到fir.h中,输入300hz和800hz的波,想滤除800hz的波。
以下为fir.c的程序:
#include <math.h>
#include "tms320.h"
#include "dsplib.h"
#include "fir.h"
/*————————————-*/
int ser0inrdcnt,ser0outwrcnt; /*Bsp0 Receive Buffer Read Pointer,Transmit Buffer Writer Pointer */
int ser0inwrcnt,ser0outrdcnt; /*Bsp0 Receive Buffer Writer Pointer,Transmit Buffer Read Pointer */
int ser0inbuf[40],ser0outbuf[40]; /*Bsp0 Receive Buffer And Transmit Buffer */
int ser0flag,int0flag,timeflag,hpirecflag; /*Define Some Global Variable */
extern int ad_samp_freq; /*To Decide The AIC Sample Frequency*/
/*————————————-*/
int firN;
DATA firindata[1];
DATA firoutdata[1];
DATA *dbptr = &firbuf[0]; /*Fir Filter Data Buffer*/
/*————————————-*/
void main()
{
ad_samp_freq = 8000;
c54_init();
ser0inwrcnt = 1 ;
ser0outrdcnt = 5 ;
ser0inrdcnt = 5 ;
ser0outwrcnt = 1;
firN=70;
ser0flag = 0;
for (;;)
{ if (ser0flag >= 1)
{ ser0inrdcnt = (ser0inrdcnt+1)%40;
ser0outwrcnt =(ser0outwrcnt+1)%40;
firindata[0] = ser0inbuf[ser0inrdcnt] ;
fir(firindata, h, firoutdata, &dbptr, firN, 1);
ser0outbuf[ser0outwrcnt] = firoutdata[0] ;
ser0flag = 0; }
}
}
导入数据,分别显示firindata和firoutdata地址的图形,相比较滤波前后的图形,但是没有变化,请问是为什么?
Eason Wang:
move to C5000 forum