Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Clock and DAQmx Read

Solved!
Go to solution

Using 9219

 

Previous programmer sets the Sample Clock with the following parameters

Sample Mode = Continuous Samples

Rate = 100

number of samples = 90000

 

He starts the Task.

 

Then in a While loop, he uses DAQmx Read set to the following

number of samples per channel = 100

 

 

Questions

1. Is the 9219 continuously reading, and the DAQmx Read reads each channel 100 times?

2. Is there some reason to set the number of samples to 90000 ?

 

0 Kudos
Message 1 of 6
(4,282 Views)

From the DAQmx Timing, the "number of samples" is setting the buffer size of the task.

 

With the DAQmx Read, the number of samples tells the function how many samples to get from the buffer.  If there are not enough samples, it waits until there is or times out.


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 2 of 6
(4,268 Views)
Solution
Accepted by topic author nyc_(is_out_of_here)

When setting up the sample clock using "DAQmx Timing.vi", the '# samples' input can be used to set the buffer size for the acquisition.  

 

When reading samples in a loop using "DAQmx Read.vi", the '# samples' input specifies how many samples to retrieve from the buffer.  If that # isn't yet available, the read call will wait (up to the timeout limit) for them to arrive.  If more than that # are available, the read call will immediately retrieve the oldest ones in the buffer to help maintain a lossless stream of data.

 

To your specific questions:

1. The 9219 is continuously *sampling* and *buffering*.  This happens via hardware and driver.  "Reading* happens through your application software as described above.

2. The 90000 sample buffer size seems unusually large for a 100 Hz task.  That's 900 seconds a.k.a. 15 minutes.  It's possible there's a good reason for it, but it's much more typical for a buffer size to be closer to single digits of 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 3 of 6
(4,266 Views)

My guess is the 90000 sample buffer size is there so that he never loses any data.

The part in the test program where the reads are occuring is typically 15 minutes in duration.

 

.

0 Kudos
Message 4 of 6
(4,263 Views)

Just a guess, but there's probably some confusion on the part of the original programmer.  It's kinda understandable given the dual purpose of "# samples" terminology.

 

A DAQ task that:

1. starts and then enters a loop

2. iterates that loop while reading 100 samples at a time (1 second worth)

3. has no other time delays

would work just fine with a buffer slightly longer than 1 second.  

 

DAQmx task buffers are circular.  As long as you read enough samples often enough that the driver isn't trying to overwrite data you haven't read yet, you're fine.  Go ahead and try it out -- requesting a 200 sample buffer size should work fine if the other code meets the conditions I described above.   (Note that the auto-sizing I linked before may kick in and give you an actual buffer size of 1000 samples.)

 

 

-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.
0 Kudos
Message 5 of 6
(4,248 Views)

The original programmer is confused all right.

The TDMS file that is generated by his code has 50 readings for each iteration in the loop. These 50 readings are all exactly the same value to 9 decimal points!

I haven't figured out yet why if the code is set up for 100 readings that this would be happening.

I will have to dig further.

 

 

0 Kudos
Message 6 of 6
(4,242 Views)