📄 exp5c.c
字号:
/*
exp5c.c - Dual-MAC block FIR filter function experiment
using input data file
*/
#define M 128 /* Input sample size */
#define L 48 /* Number of FIR filter coefficients */
#define SN L+1 /* Signal buffer size */
extern unsigned int fir2macs(int *, unsigned int, int *, unsigned int, int *, int *, unsigned int);
/* Define DSP system memory map */
#pragma DATA_SECTION(LP_h, "fir_coef");
#pragma DATA_SECTION(x, "fir_data");
#pragma DATA_SECTION(index, "fir_data");
#pragma DATA_SECTION(out, "output");
#pragma DATA_SECTION(in, "input");
#pragma DATA_SECTION(input, "input");
#pragma CODE_SECTION(main, "fir_code");
/* Input data */
#include "input5.dat"
/* Low-pass FIR filter coefficients */
static int LP_h[L]={
-6,28,46,27,-35,-100,-93,26,191,240,52,-291,-497,-278,
337,888,773,-210,-1486,-1895,-442,2870,6793,9445,
9445,6793,2870,-442,-1895,-1486,-210,773,888,337,
-278,-497,-291,52,240,191,26,-93,-100,-35,27,46,28,-6};
int x[SN]; /* Signal buffer */
unsigned int index; /* Signal buffer index */
int out[M]; /* Output buffer */
int in[M]; /* Input buffer */
void main(void)
{
unsigned int i,j;
/* Initialize filter signal buffer */
for (i=0; i<SN;i++)
x[i]=0;
index=0;
/* Processing samples using dual_MAC block FIR filter */
j=0;
for (;;)
{
for (i=0; i<M; i++)
{
in[i]=input[j++]; /* Get a buffer of samples */
if (j == 160)
j=0;
}
index=fir2macs(in,M,LP_h,L,out,x,index); /* FIR filter */
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -