LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NChan NSamp number of samples

Hey guys.

 

I am currently using DAQmx Digital 1D Wfm NChan NSamp to collect data from a velocity gate. Right now it runs for a certain number of samples (basically time based on sample rate), but I want to see if I can give the user an option to end the data aquisition early, as if to say they got the data they needed and didn't want to wait any longer.

 

Is there any way to do it by changing the input to the number of samples terminal with some sort of boolean stop?

 

Thanks. 

0 Kudos
Message 1 of 8
(3,349 Views)

If you setup your task to be Continuous Samples, then you can tell the DAQmx Read to read fewer samples.  Put that in a FOR loop so that you will have a maximum number of samples that you will take and use the conditional terminal to stop your loop early.  You will just need to do some combining of your waveforms.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(3,345 Views)

So within the for loop, I put a boolean control?

 

I'm sorry I'm having a little trouble following, because it seems to me that DAQmx will have to wait for the number of sample terminal before it starts collecting data. Could you include a snippet to clarify?

0 Kudos
Message 3 of 8
(3,329 Views)

Something like this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(3,300 Views)

Very nice. The only problem I'm running into now is that it looks like it gets rid of the previous data every iteration. When I change the output of the loop to indexing it changes the data type from a 1D array of digital waveform to a 2D array of digital waveform and the rest of my code is based on that 1D array.

0 Kudos
Message 5 of 8
(3,260 Views)

@Neil_Helsel wrote:

Very nice. The only problem I'm running into now is that it looks like it gets rid of the previous data every iteration. When I change the output of the loop to indexing it changes the data type from a 1D array of digital waveform to a 2D array of digital waveform and the rest of my code is based on that 1D array.


This is the combining waveform part that crossrulz mentioned earlier.

0 Kudos
Message 6 of 8
(3,257 Views)

Here, I added the appending of the waveforms.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 8
(3,252 Views)

Just keep in mind this data will grow and grow and grow.  crossrulz put in a stop after 100 interations, but if this number is too big, or you use a while loop data will continue to grow, and eventually Windows will run out of memory, and LabVIEW will throw an error.

 

A lot of times I will either log to disk, or if the array gets too big, use array subset (or the waveform function that does the same thing) to ensure it doesn't grow beyond some large upper limit.

0 Kudos
Message 8 of 8
(3,206 Views)