07-16-2010 08:44 AM
Greetings,
Let me explain what I would like to do. I an taking a fixed number of samples during a trigger pulse. After I take the samples I do some data analysis and generate a number based on the data. I would like to take this number now and add it to the previous scan cycle and give me a total number. This should be repeated over and over until the user stops the program.
I think I can use an array so I will investigate further how to do it.
Thanks
Edward
07-16-2010 09:14 AM
I guess what you need is simply a Shift Register. Right-click on the loop and select Create Shift Register.
Behaviour should be discussed in the help of the while loop.
Felix
07-19-2010 11:42 AM
Hi Edward,
Based on what you said a shift register sound like the best solution.
Here is a link to some training for shift registers, just in case
http://zone.ni.com/devzone/cda/tut/p/id/7466 (and select Module 4 - Timing and Storing Data)
Please let us know how this works out
07-20-2010 03:18 PM
I would like to sample, process the data and generate a RMS value for each trigger. For Example, my trigger pulse comes in every 4 sec and i take n samples during that time. I then take the derivative and to plot a graph. From this data i find KWH for the duration of my trigger ( 4sec). I then take another 4 sec set of data and do the same calculations, and like before i generate KWH. I would then want to take the previous KWH and add it to my New KWH. I have placed my entire pregram in a while loop so i dont thik a shift register would work.
Thanks
Edward
07-20-2010 03:54 PM
If you want someone to look at your code, do not post a bmp file. Changing the extension to get around the ban on bmp's is frowned upon.
07-21-2010 08:08 AM
Sorry about that,I did not know that it was frown upon, but now I know. I hope this one is much better. I would like the output RMS to be accumulated everytime I get a 4 sec trigger.
Thanks
Edward
07-21-2010 01:56 PM
Hi Edward,
After looking at your code shift register sound like the best solution.
Here is a link to some training for shift registers, just in case
http://zone.ni.com/devzone/cda/tut/p/id/7466 (and select Module 4 - Timing and Storing Data)
07-21-2010 02:08 PM - edited 07-21-2010 02:09 PM
Here is an example of how to use a shift register to accumulate data. It keeps a running total, which is what you are wanting to do. Shift Registers DO work with While Loops. In fact you need a loop to have a shift register.