A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

Introduction of C Programming for DSP Applications

There are **17** messages in this thread.

You are currently looking at messages 1 to .

**Is this discussion worth a thumbs up?**

Hi all, I have a set of samples for which I want to apply FIR filtering (assuming that filtering will be good). I know that digital filtering will give near precise filtering but I have little knowledge in FIR/IIR and I do not know where to apply which filter(yes, I googled ) . I need a small code segment that will do FIR filtering for my samples . I am using an 8051 microcontroller . Thanks in advance.

>I need a small code segment that will do FIR filtering for >my samples . I am using an 8051 microcontroller . Hello, the link below is an online filter calculator that produces C code for the designed filter. I doubt that you want to compile it for the 8051, but it produces some working code to start with. Cheers Markus http://www-users.cs.york.ac.uk/~fisher/mkfilter/

```
mnentwig wrote:
>> I need a small code segment that will do FIR filtering for
>> my samples . I am using an 8051 microcontroller .
>
> Hello,
>
> the link below is an online filter calculator that produces C code for the
> designed filter. I doubt that you want to compile it for the 8051, but it
> produces some working code to start with.
>
> Cheers
>
> Markus
>
> http://www-users.cs.york.ac.uk/~fisher/mkfilter/
>
He said he wants an FIR. The only FIRs that page can generate are
Hilbert transforms.
Steve
```

Well, you're right, and raised cosine. There's probably plenty of FIR example code out there anyway. -Markus

r...@gmail.com wrote: > I have a set of samples for which I want to apply FIR > filtering (assuming that filtering will be good). I know that digital > filtering will give near precise filtering but I have little knowledge > in FIR/IIR and I do not know where to apply which filter(yes, I > googled ) . I need a small code segment that will do FIR filtering for > my samples . I am using an 8051 microcontroller . It is hard to imagine more unsuitable architecture for the FIR filter then x51. I doubt if there is any application for which this filter could be useful. Perhaps, you should look at CIC or moving average filters. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

Jerry Avins wrote: > I told him it probably won't fit, either in the time he has (which > wasn't stated) or in the available space. The crippled machine has one > data pointer. There's an increment instruction for it, but not a > decrement. The Harvard architecture makes it difficult to fetch > coefficients from the program ROM, so one way or another coefficients > need to be stored in the RAM segment. Circular buffers can be kludged > up. Oh, come on :) movc A, @A + DPTR mov B, A mov A, @R0 mul AB .... inc DPTR inc R0 mov A, R0 anl A, #buffer mov R0, A .... > I remember building a pair for interrupt-driven serial > communication. (There's a bug in the UART timing, so if 9 bits are > needed, you have to do the timing "by hand". For 8 bits, you tell it > you're sending 9.) > > The only reason to use that machine is price. If you're too cheap to > spring for the difference between it and, say, a 68HC11 or -12, you get > what you deserve. If I needed to do any low-octane DSP, I'd at least use > a 68HC16. Nowadays, there's better. > > Jerry

First, filtering using an embedded 8-bit micro is possible. Ignore people who are talking double precision, etc, etc....they aren't embedded people with experience in this area. I have invented an algorithm that works well on a PIC (8-bit also). I call it the "tri-band filter". I had a situation where I had to generate a measure of the power spectrum in 3 bands in an audio spectrum of a piano (about 4.5KHz). So, I took 32 samples at a time (I was limted by memory) and ran a FIR filter on the data. I basically chose a FIR filter of the form ax0+bx1+cx2 and centered it at the midpoint of my frequency range. My sample rate was twice the highest frequency (by Nyquist). Now, I used some online filter coefficient generator. What I noticed is the LPF coefficients were the same as the HPF coefficients just swapping signs here and there, so as long as I calculated ax0, bx1 and cx2, I could use the same calculations for both filters. The second trick I used was to round any floating point values to the nearest powers of two. For example, one term was 0.3664, and I rounded it to 0.375 (3/8*x), which can be calculated as ((x << 2) + x) >> 3, which involves no multiplies (my PIC didn't have a multiply) and only involves integer calculations. Note that the frequency response of the filter (if you choose your coefficients carefully) was almost identical to the non-altered one and my results were very accurate (much better than my older state variable filter that I used to use). If you combine the touching of coords to be combinations of power of two so you can do your calculations using shifts and adds and reuse coefficients to give you both High and Low pass results simultaneously. The band pass was obtained by subtracting the LPF and HPF values from the original data. You will need to use a 16 bit accumulator (assuming you are using 8-bit sampled data) and remember to shift left and add BEFORE shifting right as you'll get more accurate results that way. This algorithm works very well for 8-bit processors. Enjoy...