04-02-2008 03:45 AM
04-02-2008 03:50 AM
Check this
May be its the same thing you want to achieve
http://forums.ni.com/ni/board/message?board.id=170&thread.id=312733
04-02-2008 08:12 AM
04-02-2008 08:16 AM - edited 04-02-2008 08:17 AM
04-02-2008 08:41 AM
Use the example in the posted link, then add another shift register for your sum of all elements. Dont add all the elements every time, add them to a running total when they come in. You will need to evaluate how big this number is going to get, however, and decide if you should use an I64 for your running total of all elements. Even this will overflow eventually.
So your code would look like that posted by GerdW in the above link, then add a shift register with a starting value of 0. Then add your input value to the value comming from this shift register and send the output to the shift register's output terminal. This creates your running total of all values. The code by GerdW provides your "last 18 elements" total in a very efficient manner, just change the 15 to an 18.
I have attached a sample bit of code to make it clear. I saved it in LV 8.0 so more people can open it.
04-02-2008 09:35 AM
It works!![]()
Thanks to all for the informations!
To GerdW. - yes it´s Germany