Hi,
I used this digital filter design tool:
to generate code for a first order Butterworth floating point low pass filter with 250kHz sampling frequency, and a 100kHz corner frequency.
This would require a DSP to run on, since I need 6 of these filters running in parallel, so is there a way to do the same filtering with fixed point code to run on a microcontroller? The input values to the filters are fixed point 16bit ADC values.
Can I convert the floating point code to fixed point?
Here's the floating point code that mkfilter generates:
//filter code #define NZEROS 1 #define NPOLES 1 #define GAIN 1.324919696e+00
static float xv[NZEROS+1], yv[NPOLES+1];
static void filterloop() { for (;;) { xv[0] = xv[1]; xv[1] = next input value / GAIN; yv[0] = yv[1]; yv[1] = (xv[0] + xv[1]) + ( -0.5095254495 * yv[0]); next output value = yv[1]; } } //end of filter code
cheers, Jamie