Revision [11024]
This is an old revision of WinFilter made by ToBo on 2010-07-25 00:05:10.
Filterdesign mit WinFilter
http://www.winfilter.20m.com
This software can design as well IIR filters as FIR filters and can generate the C and VHDL code.
Generierung von VHDL-Code für IIR-Filter nicht implementiert.
Beispiel: FIR-Filter
fir.c
/**************************************************************
WinFilter version 0.8
http://www.winfilter.20m.com
akundert@hotmail.com
Filter type: Low Pass
Filter model: Raised Cosine
Roll Off Factor: 0.500000
Sampling Frequency: 1000 Hz
Cut Frequency: 100.000000 Hz
Coefficents Quantization: 16-bit
***************************************************************/
#define Ntap 31
#define DCgain 131072
__int16 fir(__int16 NewSample) {
__int16 FIRCoef[Ntap] = {
0,
69,
302,
573,
602,
85,
-1068,
-2531,
-3521,
-3019,
-201,
5093,
12099,
19226,
24557,
26533,
24557,
19226,
12099,
5093,
-201,
-3019,
-3521,
-2531,
-1068,
85,
602,
573,
302,
69,
0
};
static __int16 x[Ntap]; //input samples
__int32 y=0; //output sample
int n;
//shift the old samples
for(n=Ntap-1; n>0; n--)
x[n] = x[n-1];
//Calculate the new output
x[0] = NewSample;
for(n=0; n<Ntap; n++)
y += FIRCoef[n] * x[n];
return y / DCgain;
}
WinFilter version 0.8
http://www.winfilter.20m.com
akundert@hotmail.com
Filter type: Low Pass
Filter model: Raised Cosine
Roll Off Factor: 0.500000
Sampling Frequency: 1000 Hz
Cut Frequency: 100.000000 Hz
Coefficents Quantization: 16-bit
***************************************************************/
#define Ntap 31
#define DCgain 131072
__int16 fir(__int16 NewSample) {
__int16 FIRCoef[Ntap] = {
0,
69,
302,
573,
602,
85,
-1068,
-2531,
-3521,
-3019,
-201,
5093,
12099,
19226,
24557,
26533,
24557,
19226,
12099,
5093,
-201,
-3019,
-3521,
-2531,
-1068,
85,
602,
573,
302,
69,
0
};
static __int16 x[Ntap]; //input samples
__int32 y=0; //output sample
int n;
//shift the old samples
for(n=Ntap-1; n>0; n--)
x[n] = x[n-1];
//Calculate the new output
x[0] = NewSample;
for(n=0; n<Ntap; n++)
y += FIRCoef[n] * x[n];
return y / DCgain;
}
Siehe auch •