On Tue, May 22, 2012 7:42 am, M.L. wrote: > On Tue, May 22, 2012 at 8:22 AM, Matt Bennett > 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. =A0I'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. 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 <=3D 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. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .