Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with sinc filtering

Status
Not open for further replies.

iggyboy

Member level 2
Member level 2
Joined
Feb 16, 2007
Messages
51
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,734
Helo again. Time for a new whine:

I need help filtering a very noisy signal. See attached file. I read a bit about filters and decided to implement a windowed sinc filter. I chose a 32 point blackmann window:

const unsigned int blackmann[]={
0,
245,
1023,
2448,
4677,
7873,
12151,
17539,
23940,
31119,
38707,
46226,
53142,
58914,
63069,
65251,
65268,
63120,
58993,
53243,
46341,
38827,
31237,
24048,
17632,
12227,
7932,
4720,
2476,
1040,
253,
0
};

which I scaled hoping to get the job done using integers. Here is the algorithm

Code:
unsigned int filter_in[33];
unsigned long filter_out[64];
unsigned char indeks_sinc=0;

unsigned char out_index=0;
unsigned char window_index=0;
unsigned char in_index=0;



			filter_in[indeks_sinc]=ADCBUF4;
			if(indeks_sinc<32) indeks_sinc++;
				else{
					indeks_sinc=0;
					for(out_index=0;out_index<63;out_index++){
						filter_out[out_index]=0;
					}


					asm("nop");
					asm("nop");
					asm("nop");
					asm("nop");
					asm("nop");


					for(window_index=0;window_index<31;window_index++){
						for(in_index=0;in_index<32;in_index++){
							filter_out[in_index+window_index]=filter_out[in_index+window_index]+filter_in[in_index]*blackmann[window_index];
						}
					}
					asm("nop");
					asm("nop");
					asm("nop");
					asm("nop");
					asm("nop");
				}

The above does not work. All I get is a more or less distorted bell, so I guess I am really missing something, right? What is that?


I should point out that the signal which is to be filtered has a strong DC component and many HF components ranging from a 50 Hz to approx. 500kHz plus the noise. I am trying to cut the HF with the sinc filter and then average out the noise with a moving average filter. Is this the right approach?

Any advice/thoughts wellcomed.
 

Hmmm. Surely there must be someone that can tell me what am I doing wrong?
 

Hi!

First you multiply filter input with blackman window. This is not correct. First you should to calculate windowed sinc function. You shuld multiply original sinc function (with infinite length) with your blackman window. You will obtain low-pass FIR. This FIR you have to store in memory and use for filtering.

Second you shuld check your code for convolution of filter input with FIR described above. You already use something like convolution in "moving average" part. But the index of calculation result ("filter_out[in_index+window_index]") looks very strange. Usually the output value's index obtained directly from loop index without any summing of nested loops indexes.
 

    iggyboy

    Points: 2
    Helpful Answer Positive Rating
Thank you for your comment. I think my blackmann function has already been multiplied by sinc(x). But will give it a try.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top