LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Collect one sample at a time.

This seems like it ought to be incredibly simple, but I am brand new to labview...

 

I am acquiring data at a given rate (between 10 and 100 Hz) for the purpose of the read outs in my vi.

 

What I would like to do is set up the DAQ and the experiement and run it, monitoring at all times my critical variables on gauges, etc.  Then when I have reached the information I need, I would like to click and button and record a single sample.  I would even take just a few samples.

 

The way I have attempted to do this now is to briefly enable a relay between the signal source and the Write to Measurment File vi.   This kind of works, as long as my sampling rate is low.  With high sample rates (1000 Hz) I end up with a few thousand data points, when all I need is one.

 

Thus the question:  How do I take a snapshot of my data?

0 Kudos
Message 1 of 11
(4,098 Views)

Post your VI.  I don't understand what you mean by putting a "relay" between the signal source and a Write to measurement File.  A signal source is physical hardware, a Write to Measurement File is software.  How are you acquiring the data?  Is is coming in has a waveform datatype, an array, or the dreaded blue datatype wire?

 

Let's assume it is an array of multiple data points since you say you are doing 10-100 Hz.  Use index array function to get a single point out of the array.  Feed the value into a case structure that contains the Write File VI's.  The case structure would be controlled by a boolean button set to Latch action.  Now if you hit the button, it will take only a single point out of your array one time to send to Write to the file.

0 Kudos
Message 2 of 11
(4,083 Views)

Ravens Fan:

 

I think what they are referring to is that Express vi called Relay under the Express/Signal Manipulation pallette.

 

Edit: And yes, it comes with that dreaded blue wire type 😞 🙂

 

-AK2DM

Message Edited by AnalogKid2DigitalMan on 08-27-2009 01:33 PM
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 3 of 11
(4,074 Views)

viExample.PNG

 

 Ths was just a small example VI I was using to figure this out, then I was going to implement into a larger vi.  Ultimately the logic should be the same I would think.

 

 The only reason I used the relay was that I was getting the same condition where I had thousands of data points recorded when I used a booleen button on the enable input of the write to file.  I figured I'd try a simple work around.

 

Sounds like if I convert to array, and then feed to case structure, I should be able to accomplish the task at hand.

0 Kudos
Message 4 of 11
(4,073 Views)
I was wrong, no Express Relay in the code. (but there are blue wires)
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 5 of 11
(4,069 Views)

viExample.PNG

 

Actually there was.  Just can't read the damn thing.

0 Kudos
Message 6 of 11
(4,065 Views)

I've seen that Express VI before.  I never use that one because it's useless.  All it is is a fancy wrapper for a very basic True/False Case structure.

 

What is the mechanical action of that button?  By the picture of the icon, I'm going to guess it is its default value of switched.  That should be Latched action.  With Switch action, you have to click it on and click it off.  At a fast rate, the loop may execute several times while it is True.

 

Since we are looking at Express VI's, the Write to File function as an Enable input that you can wire the button into.

 

Message Edited by Ravens Fan on 08-27-2009 05:10 PM
0 Kudos
Message 7 of 11
(4,050 Views)

Maybe it will just have to be good enough, but the button is set to latch when pressed.  I've set to latch when released, and no matter what, when I click the button I get far more than 1 sample.  At 100 Hz it's about 10 samples.

 

Additionally, if I click the button a second time, I invariably get an error.

 

I'm going to try writing to an array this morning, and see if I get better results.

0 Kudos
Message 8 of 11
(4,029 Views)
The array did the trick.  Thanks much.  I have a lot to learn about this program.
0 Kudos
Message 9 of 11
(4,028 Views)

I'm not sure if this is how you ended up getting it to work, but the Convert from Dynamic Data Express VI can be configured to automatically give you only the latest sample.  I have attached a simple piece of code that shows how to do this. 

 

-Christina

 

write_1.JPG

0 Kudos
Message 10 of 11
(4,013 Views)