Searching \ for '[PIC] PIC24 Filtering code (FIR)?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.org/techref/microchip/math/filter.htm?key=filter
Search entire site for: 'PIC24 Filtering code (FIR)?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PIC24 Filtering code (FIR)?'
2012\05\22@082211 by Matt Bennett

flavicon
face
If you've ever tried to do DSP type functions on a PIC24, you'll find that
the standard libraries don't include any sort of filtering functions-
there are filtering functions for the dsPICs, but those functions are
using the DSP type features of that family- the code doesn't port.

I understand it isn't optimal, but has anyone found decent fixed-point FIR
(finite impulse response) code for the PIC24? I can generate the FIR
coeffecients.  I've done a moving average filter [rectangular impulse
response], because it is very easy- but I'm just not happy with the
results. I could dive into 'Numerical Recipes in C,' but I'm hoping that
someone has done/found some slightly more optimized code (for example,
using the __builtin_xxx() type functions available in C30/XC16).

Regards,

Matt

Matt Bennett
Just outside of Austin, TX
30.51,-97.91

The views I express are my own, not that of my employer, a large
multinational corporation that you are familiar with

2012\05\22@084317 by M.L.

flavicon
face

On Tue, May 22, 2012 at 8:22 AM, Matt Bennett <spam_OUTmattpiclistTakeThisOuTspamhazmat.com> wrote:
> If you've ever tried to do DSP type functions on a PIC24, you'll find that
> the standard libraries don't include any sort of filtering functions-
> there are filtering functions for the dsPICs, but those functions are
> using the DSP type features of that family- the code doesn't port.
>
> I understand it isn't optimal, but has anyone found decent fixed-point FIR
> (finite impulse response) code for the PIC24? I can generate the FIR
> coeffecients.  I've done a moving average filter [rectangular impulse
> response], because it is very easy- but I'm just not happy with the
> results. I could dive into 'Numerical Recipes in C,' but I'm hoping that
> someone has done/found some slightly more optimized code (for example,
> using the __builtin_xxx() type functions available in C30/XC16).
>
> Regards,
>
> Matt

Matt,
C30 produces pretty good assembly code. A simple FIR filter shouldn't
have to be more complicated than rolling the x history and doing the
MAC operations in standard C statements. If you need intense
optimization to get it done efficiently then I would have to argue
that you really need the dsPIC. The PIC24 running full speed should be
able to do a LOT of FIR MACs per second, all without any special DSP
instructions.

I have derived and written FIR and IIR code if you need professional
level help.
--
Martin K.

2012\05\22@084607 by Isaac Marino Bavaresco

flavicon
face
The __builtin_xxx() functions are just C shortcuts for the processor's
instructions. The builtins that map to DSP instructions won't work in
PIC24 devices.


Isaac


Em 22/5/2012 09:22, Matt Bennett escreveu:
{Quote hidden}

> multinational corporation that you are familiar with.

2012\05\22@092335 by Matt Bennett

flavicon
face
On Tue, May 22, 2012 7:42 am, M.L. wrote:
{Quote hidden}

I know I *can* do it- I was just hoping someone had already done it,
tested it, and shared the code. A dsPIC is definitely a better choice, but
sometimes you just have to play the cards you're dealt... the data I want
to filter is pretty slow- only coming in at about 8Hz, and I think I'll
put the corner of the low-pass <= 1Hz.  Eventually, it will need to be
optimized for low power (low cycle count), but I'm really trying to do a
proof of concept now. This PIC24 is doing plenty of other stuff, I'm
trying to wedge some additional functionality in there.

Matt

Matt Bennett
Just outside of Austin, TX
30.51,-97.91

The views I express are my own, not that of my employer, a large
multinational corporation that you are familiar with

2012\05\22@094202 by alan.b.pearce

face picon face
> > C30 produces pretty good assembly code. A simple FIR filter shouldn't
> > have to be more complicated than rolling the x history and doing the
> > MAC operations in standard C statements. If you need intense
> > optimization to get it done efficiently then I would have to argue
> > that you really need the dsPIC. The PIC24 running full speed should be
> > able to do a LOT of FIR MACs per second, all without any special DSP
> > instructions.
> >
> > I have derived and written FIR and IIR code if you need professional
> > level help.
>
> I know I *can* do it- I was just hoping someone had already done it, tested it, and
> shared the code. A dsPIC is definitely a better choice, but sometimes you just have
> to play the cards you're dealt... the data I want to filter is pretty slow- only
> coming in at about 8Hz, and I think I'll put the corner of the low-pass <= 1Hz.
> Eventually, it will need to be optimized for low power (low cycle count), but I'm
> really trying to do a proof of concept now. This PIC24 is doing plenty of other
> stuff, I'm trying to wedge some additional functionality in there.

Look in the libraries available for the PIC32, IIRC there are IIR and FIR filters there, and should have source code.
-- Scanned by iCritical.

2012\05\22@095632 by Matt Bennett

flavicon
face
On Tue, May 22, 2012 8:41 am, alan.b.pearcespamKILLspamstfc.ac.uk wrote:
> Look in the libraries available for the PIC32, IIRC there are IIR and FIR
> filters there, and should have source code.

Yes, there are FIR functions for the PIC32 in C32- but they are really
just wrappers around mips_fir16() and mips_fir16_setup(), which are only
in libdsp.a- not source.  I suspect that the source code is actually MIPS
assembly. No joy there.

Matt

Matt Bennett
Just outside of Austin, TX
30.51,-97.91

The views I express are my own, not that of my employer, a large
multinational corporation that you are familiar with

2012\05\22@104302 by alan.b.pearce

face picon face
> > Look in the libraries available for the PIC32, IIRC there are IIR and
> > FIR filters there, and should have source code.
>
> Yes, there are FIR functions for the PIC32 in C32- but they are really just wrappers
> around mips_fir16() and mips_fir16_setup(), which are only in libdsp.a- not source.
> I suspect that the source code is actually MIPS assembly. No joy there.

Ah, OK, hadn't looked at them.

-- Scanned by iCritical.

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...