09-09-2013 05:50 AM
Hello,
I am designing Moving Average Filter. But I am confused And I need to filter the 4 channel within the FPGA of the cRIO. So please some body help me. Any suggestion are welcome regarding the post. I am using the NI 9220 and I want to filter 4 channel continously inside the FPGA.
Lookng forward for yor reply.
Thanks in advance...
Solved! Go to Solution.
09-09-2013 05:54 AM
Hi sammir,
and what's the problem?
For the simplest approach you need to use an array to store data, then replace one element with new data, sum up the array and divide by the number of elements. Do this 4 times for each channel...
(This might not be the best approach for a FGPA, but it will work...)
09-09-2013 05:59 AM
Hello
Can you attached vi or the picture for the vi so I can try and see is it working for my application or not.
That would be greate help.
09-09-2013 06:27 AM
09-09-2013 07:21 AM - edited 09-09-2013 07:22 AM
I would do something like this. I used an array of size 4, so you need to replace those constants with the array length that you want. Remember an FPGA must have a fixed length array.
09-09-2013 10:09 AM - edited 09-09-2013 10:09 AM
This is what I would do. I am old fashioned and do not like using floating point on an FPGA, way too expensive. This is for integer math; it will also work with fixed point inputs.
Using the 4 sample delay will impart some error on the first 4 mean samples, but will be fine after that. This assumes you don't need the history data as was previously posted.
09-09-2013 10:17 AM
WillD wrote:
Of course. I forgot the feedback node had that delay feature to it. I was trying to come up with something similar with the subtract oldest value and adding new value before dividing, just couldn't quite get there with the shift register holding the array. And by that point I figured I might as well just keep with the simple average.
09-09-2013 10:21 AM
You can get the same effect by click-drag-expanding the shift registers on the left side of a loop:
09-09-2013 12:26 PM
2-cents on data filtering (not the a direct answer the the question at hand):
If possible, an "oversampled" average tends to have much better results (IMO) than a pt-by-pt moving average. pt-by-pt moving averages cause phase-shifts in the data that I don't like. If you need something like that, I recommend a Median filter which is for the most part the same but keeps the charactertistic data points (such as maximums and minimums) from shifting to the right.
09-10-2013 02:35 AM
THanks for all the reply. But this code is working fine in simple Labview but not in Labview FPGA. So please if some one designed the moving avarage filter in labview FPGA so please let me know. Or post the result or answer so that can be useful for otheruser also.