|
#include"stdio.h"
#include"math.h"
#include"DSP28_Device.h"
#defineorder 26
#defineN 128
#definepi 3.1415926
floatFIR_LPF[order] ={-1.52864422149721e-05,-0.000133359311426970,-0.000544636220343477,-0.00137835208978255,-0.00218948983490142,-0.00124340086554490,0.00478134865608317,0.0198838342801837,0.0464361812966399,0.0825102845162328,0.120763491355644,0.150360916315540,0.161536936687780,0.150360916315540,0.120763491355644,0.0825102845162328,0.0464361812966399,0.0198838342801837,0.00478134865608317,-0.00124340086554490,-0.00218948983490142,-0.00137835208978255,-0.000544636220343477,-0.000133359311426970,-1.52864422149721e-05};
floats;
inti,n;
floatinput[N],output[N];
intfs=10000;
intf1=600;
intf2=1500;
#definefa 2*pi*f1/fs
#definefb 2*pi*f2/fs
void inputwave()
{
for(n=0;n<N;n++ )
input[n]=sin(fa*n)+sin(fb*n);
}
voidmain()
{ int m=0,n=0;
inputwave();
for(n=0;n<N+order;n++)
{
for(s=0,m=0;(m<order)&&(m<n);m++)
{
s=FIR_LPF[m]*input[n-m]+s;
}
output[n]=s;}
while(1);
|
|