LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to acquire data for different time lengths

Solved!
Go to solution

Hi,

 

I'm relatively new to Labview and trying to build a vi for acquiring data from 3 transducers for a lab application. I am using a NI-DAQ- USB 6212 BNC for acquistion. After a lot of trial and errors and reading up different examples from the forums. I successfully managed to acquire data using 'for loop structure' for approx 10 seconds. However, I would like to have an option of acquiring data for 3 minutes as well (switch between both modes). I looked into creating case structures, but would like to avoid having 2 separate waveform graphs. Any advice and help would be appreciated.

 

Thanks

 

P.S. below are the images of my vi.

0 Kudos
Message 1 of 9
(2,789 Views)

Hi ndaphtary,

 


@ndaphtary wrote:

I successfully managed to acquire data using 'for loop structure' for approx 10 seconds. However, I would like to have an option of acquiring data for 3 minutes as well (switch between both modes). I looked into creating case structures, but would like to avoid having 2 separate waveform graphs. Any advice and help would be appreciated.

P.S. below are the images of my vi.


What is the problem with your existing VI?

Are there any errors?

Why can't you read data for 3mins? (Simple math: it would take about 920 iterations to read 46080 samples at 256S/s and 50 samples per read.)

 

On your images:

You will get the advice to attach VIs instead of images of VIs: we cannot debug images with LabVIEW!

When you still want to upload just images: inline them in the message instead of attaching them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(2,768 Views)

Hi GerdW,

 

The problem is not the length of acquisition. Rather what can i do to have an option to switch between collecting data for 10 seconds or 3 min and store it all in the same .tdms file. I have tried to implement case structures but I can't seem to do it all on the same waveform display. Please find the vi attached. Again thanks for your help.

 

0 Kudos
Message 3 of 9
(2,756 Views)

Apart from Gerds comment that you only need to calculate the amount of loops of the For loop i'd like to add that it's recommended to set the Buffer size of the Continous acquisition to 2x one capture size, so simply add a 2x Sample size as the buffer size.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 9
(2,749 Views)

Hi,

 

unless there are very important reasons you don't need to set the buffer size (for "continuous samples" mode) at all! (Read the LabVIEW help for DAQmxTiming…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(2,746 Views)
Solution
Accepted by ndaphtary

Hi ndaphtary,

 


@ndaphtary wrote:

Rather what can i do to have an option to switch between collecting data for 10 seconds or 3 min and store it all in the same .tdms file. I have tried to implement case structures but I can't seem to do it all on the same waveform display


All you need is to select between two different constants for the loop iteration count: you need a button and a Select function! No need to put 2 FOR loops with 2 charts into cases of a case structure…

(Thanks for attaching the VI, but I'm stuck at LV2017 right now.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(2,742 Views)

@Yamaeda wrote:

Apart from Gerds comment that you only need to calculate the amount of loops of the For loop i'd like to add that it's recommended to set the Buffer size of the Continous acquisition to 2x one capture size, so simply add a 2x Sample size as the buffer size.

/Y


Generally, just leave it unwired when in Continuous Mode: How Is Buffer Size Determined?


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 9
(2,722 Views)

Thanks again GerdW,

That's what I needed. Put in a selector switch and everything works like a charm. Really appreciate all your help!

Regards,

ndaphtary

0 Kudos
Message 8 of 9
(2,684 Views)

@crossrulz wrote:

Generally, just leave it unwired when in Continuous Mode: How Is Buffer Size Determined?

Nice to see that they've updated that help page to cover both nits I used to pick!  (It didn't used to let you know it would honor a request for a larger buffer than the automatic size, and it used to list 100 S/sec and 10000 S/sec as both the end of one range and the beginning of the next, making the behavior for those specific values ambiguous.)

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 9 of 9
(2,671 Views)