10-26-2011 01:50 PM
Hi,
I have an incoming stream of data in the form of RPM's. In the actual experiment I'll be using a DAQ device that'll input pulses, but currently I am using a random number generator plugged into the frequency of a square wave generator.
My VI will obtain the frequency of the pulses (or currently wave) and output an RPM by multiplying the frequency by 60.
I want to output these into a text file with two columns - time and RPM from the time I start the subroutine until the time I stop it. However, since my VI's output is a single number (that refreshes with time), how is this possible?
I'm new at LabVIEW so my description might not be clear enough...
I've tried using a shift register to create an array of RPM's one after another, but it's only created an array with two of the most recent RPM's.
Any help would be appreciated. Thanks!
10-26-2011 01:58 PM
Oh, and another thing I would want to do is for the VI to take the data average of maybe 500 milliseconds, display it, and update every 500 milliseconds.
10-26-2011 03:40 PM
Looks like it just needs a few simple corrections. You have couple of problems: the only thing moving from your loop to your Write to File is an array that only contains your RPM values. If you want to collect Time also, you have to wire time over there.
The problem with your shift register is that you're filling it with the most recent RPM value (just a single value, not a full array.) If you want to collect all your values, you have to fill it with an array of all previous values plus the current one. Each time the loops runs, it will take all previous, add your new one and then save them all.
Can you post your .vi? This will be easy to sort out if we can handle the code.
10-26-2011 03:53 PM
The attached example shows two different ways of collecting data into an array inside a loop.
The top one uses an indexing tunnel to make an array.
The bottom one uses a shift register to add each value to an array. The thing to notice is that the input into the shift register is an array, not just the most recent value.
10-26-2011 04:02 PM
Yeah, I noticed that it was only the most recent value but I didn' tknow how to correct it.
Do you mind converting that into a file viewable for LabVIEW 10.0? Thanks!
10-26-2011 04:20 PM
LabView 10.
10-27-2011 11:26 AM
Hi Vincent121,
It looks like from your most recent example you have figured out how to use shift registers to get your data.
If you’re getting in a waveform from your readings, then you’ll have time already and you can use this example to create a file of your waveform (https://decibel.ni.com/content/docs/DOC-13052).
If you’re trying to edit a particular part of your waveform, you can break out the Y component and multiply from there. This KB should give you a good starting point (http://digital.ni.com/public.nsf/allkb/B965F316364DE17B862572DF00363B10?OpenDocument).
Regards,
Michael M
NI Americas | AE
NI.com/support | 1866-275-6964