ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1 Channel DAQ- Basic Doubt

Solved!
Go to solution

The sample rate is 1 per sec. ; I need 5 samples ; I hold the acquiring loop for 5 sec.  Yet I get two sets of data ..  Tried to read Help but could find the reason for this. Even tried to set the loop timing to 1 sec and still I get two set of samples.  Why is this ?

 

1Ch_DAQ.png

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 7
(2,885 Views)

Hi Raghu,

 


@MogaRaghu wrote:

The sample rate is 1 per sec. ; I need 5 samples ; I hold the acquiring loop for 5 sec.  Yet I get two sets of data ..  Tried to read Help but could find the reason for this. Even tried to set the loop timing to 1 sec and still I get two set of samples.  Why is this ?


Because the loop iterates twice…

THINK DATAFLOW: the ElapsedTime gives FALSE in the first iteration, so the loop repeats…

 

Why don't you use "Continuous samples" when you need just 5 samples?

Why do you need ElapsedTime (and the loop) at all: DAQmxRead will wait for 5 samples on its own!

Best regards,
GerdW


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

To learn how DAQmx works, open MAX (the Measurement and Automation Explorer).  Find your Device in the Devices list.  Open a Test Panel.  Find your A/D.  Now play with the settings.  Notice what the difference is between Finite Samples (where, say, "I want to take 5 samples") and Continuous Samples (where, say, "I want to take 5 samples at a time, over and over").  Learn what "Number of Samples" means.

 

If you want to take 5 samples and stop, then why do you need a loop?

 

Understand your Device and understand DAQmx a bit better -- MAX can give you the tools to explore and learn.

 

Bob Schor

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

This looks extremely similar to a CLAD example exam question.  Studying up for a CLAD?



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 4 of 7
(2,834 Views)

A subtler point is that the call to DAQmx Read is probably going to complete in something more like 4 seconds rather than 5.

 

When the task is started, the 1st sample will be taken almost immediately, near t=0.  The 2nd sample will be taken at ~1 second and so on until the 5th sample is taken at ~4 seconds.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 5 of 7
(2,823 Views)

@crossrulz

 

You are spot on.. yes its a lift off from a sample CLAD question bank ! I am not preparing but helping some one else who is. With my age well past 60, even assuming I get the certificate, it will be a personal joy and that's it !!  

 

The sample rate is 1/sec. And the read is set up for 5 samples.  And since the loop will anyway iterate once, for the Elapsed Time less than 5 sec, one would expect only to get one set of samples.  Why does the second iteration happen in that case ? 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 7
(2,755 Views)
Solution
Accepted by MogaRaghu

Just landed on this You tube video which answered my doubt.

 

While Loop iteration.. 

 

Thanks to all those who chipped in !

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 7 of 7
(2,751 Views)