LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fpga moving averaging

 I would like to do some moving averaging on my FPGA based on building the sum of the values to around 200 data points and then removing the oldest value and adding the newest value and averaging them all that way I'm only needing to acquiring one new point once the data point have reached the 200 limit but I have 16 channels and FPGA does not support 2-D arrays and I can do it with 16 1-d arrays but I don't think there will be enough resources on the FPGA. Any one have any ideas how i can do this. I guess the main challenge is having a way to coninuously store the last 200 or N points so that I can subtract the oldest value other than a two d array or multiple 1-d arrays. I am trying to do it this way as well so that I don't need to wait each time and acquire 200 or N samples and then avaerge them each time for a new averaged value.

 

I've already done this on the real time side but it seems to use quite a few resources and slow down my code. Maybe there is a better way to do it on real tiem if it can't be done on the FPGA?

0 Kudos
Message 1 of 3
(1,985 Views)

you'll want to use block-ram based fifo to do this. you can use a collection of 16 fifos or, in newer versions of labview, you can use a typedef'd array of 16 elements in one fifo. you can then stuff the points in along side the running average until you hit 200 and then start subtracting the end points off the average.

0 Kudos
Message 2 of 3
(1,981 Views)

also, since the block memory is in fixed sized chunks in the fpga, you might be able to get a larger/smoother average for free by selecting a size (e.g. 256) for fifo depths and it will essentially be for free.

0 Kudos
Message 3 of 3
(1,980 Views)