Hi again.
There is "bandpass filter demo" in demonstration programs for 21061
EZ-Kit Lite. It works something like that:
-- cut here --
.
.
.
#define NUM_TAPS 256
// uses fir.h file filled with 256 coefficients
float pm coeffs[NUM_TAPS] =
{
#include "fir.h"
};
float dm state[NUM_TAPS+1];
.
.
.
// and spooky fir() function, from filters.h:
tx_buf[1] = fir( rx_buf[1], &coeffs[0], &state[0], (int)NUM_TAPS );
.
.
.
-- cut here --
full listing of bp.c you can find here:
http://wisnia.server.pl/fir/bp.c
full listing of fir.h (for one filter) is here:
http://wisnia.server.pl/fir/fir.h
and its freqz() plot:
http://wisnia.server.pl/fir/fir.jpg
AND IT WORKS FINE !
Because I didn't found any serious manual for this example neither
filter.h and fir() function, so I tried to generate my own coefficients
file with Matlab using fir1():
-- cut here --
FSover2 = 8000;
Filters = [ 800 ];
TAPS = [ 256 ];
WIDTH = 200;
.
.
b = fir1(TAPS(j),[(Filters(i)/FSover2 - WIDTH/FSover2)
(Filters(i)/FSover2 + WIDTH/FSover2)]);
.
.
.
fprintf(fid,' %6.10f,\n',b(k));
.
.
-- cut here --
...or remez():
-- cut here --
Fs=8000; fp=500; fz=800; TAPS = 256;
[n,fo,mo,w]=remezord( [fp fz], [1 0], [0.01 0.1], Fs );
b = remez(n,fo,mo,w);
.
.
-- cut here --
sample of one my coefficient files:
http://wisnia.server.pl/fir/myfir.h
and its freqz() plot:
http://wisnia.server.pl/fir/myfir.jpg
and nothing :( any of "my" coefficient files won't work ! If I'm using
"my" file fir.h, bandpass program passes whole bandwith :(
I tried various frequencies, sample rates, filter orders...
Why the heck is going on ? What's the difference between original and my
coefficients ?
I really have no idea what to do.
Greetings,
Bergen