LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incoming Stream of Data Into Text File

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!

0 Kudos
Message 1 of 7
(2,265 Views)

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.

0 Kudos
Message 2 of 7
(2,259 Views)

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.

 

 

0 Kudos
Message 3 of 7
(2,238 Views)

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.

0 Kudos
Message 4 of 7
(2,232 Views)

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!

0 Kudos
Message 5 of 7
(2,230 Views)

LabView 10.

0 Kudos
Message 6 of 7
(2,224 Views)

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

0 Kudos
Message 7 of 7
(2,198 Views)