timleypest
Newbie level 1
Hi All,
This is kind of my first brush with DSP so please bear with me if I have made any mistakes..
So I have an 14bit-ADC converted signal sampled every 1mS. From this signal I want to discard components less than 0.5Hz and more than 2.5Hz, so I designed a 2nd order butterworth BPF with the above cut-off frequencies in matlab. I imported the signal of interest and filtered it, and it looks great. But when I try to port the filter into my PIC32 microcontroller (I use C code), all I get is junk.
To check if my C code was wrong, I created a C# version and tried it on my PC with Visual Studio, this works fine too, BUT only if I use "double" precision. If I use "float", then all I get is junk. What's going on? How do I solve this?
The filter coefficients are below:
double[] B= new double[5] { 4.3122003325465159E-5, 0.0, -8.6244006650930318E-5, 0.0, 4.3122003325465159E-5 };
double[] A= new double[5] { 1.0, -3.9812618362095562, 5.9440373174333914, -3.9442883933007971, 0.98151291362106841 };
Thanks!
Govind
This is kind of my first brush with DSP so please bear with me if I have made any mistakes..
So I have an 14bit-ADC converted signal sampled every 1mS. From this signal I want to discard components less than 0.5Hz and more than 2.5Hz, so I designed a 2nd order butterworth BPF with the above cut-off frequencies in matlab. I imported the signal of interest and filtered it, and it looks great. But when I try to port the filter into my PIC32 microcontroller (I use C code), all I get is junk.
To check if my C code was wrong, I created a C# version and tried it on my PC with Visual Studio, this works fine too, BUT only if I use "double" precision. If I use "float", then all I get is junk. What's going on? How do I solve this?
The filter coefficients are below:
double[] B= new double[5] { 4.3122003325465159E-5, 0.0, -8.6244006650930318E-5, 0.0, 4.3122003325465159E-5 };
double[] A= new double[5] { 1.0, -3.9812618362095562, 5.9440373174333914, -3.9442883933007971, 0.98151291362106841 };
Thanks!
Govind