=====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==== {{image url="images/WinFilter_fir.png"}} Generierter C-Code: %%(c;;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; n0; n--) { x[n] = x[n-1]; y[n] = y[n-1]; } //Calculate the new output x[0] = NewSample; y[0] = ACoef[0] * x[0]; for(n=1; n<=NCoef; n++) y[0] += ACoef[n] * x[n] - BCoef[n] * y[n]; return y[0]; } %% ---- Siehe auch {{backlinks}}