Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

samples per channel and number of samples per channel

Solved!
Go to solution

in my finite samples mode DAQ program, there are two vis:  DAQmx timing and DAQmx read.vi.

 

I have to set the parameter of "samples per channel" on DAQmx timing.vi and "number of samples per channel" on DAQmx read.vi.... Is there any relationship between these two?

 

My laser is running at 1K Hz. I want to go to the wavelength, wait for a number of laser shots, read the data and move on to the next wavelength....

 

 

Thanks,

 

Lei

0 Kudos
Message 1 of 7
(5,485 Views)

Hi,

 

In a finite acquisition you tell the daq-card with "number of samples" how many samples you want to measure.

In combination with the sample-rate you can determin the measurement time.

 

The "number of samples to read" tells LabVIEW how many samples from the before acquired samples you want to read for use in LabVIEW.

Usually in a finite acquisition both values are the same.

 

Using different values is from interest for continous acquisitions, because the "number of samples" at the DAQmx Timing.vi just determins a buffer size. And then you need to tell the DAQmx Read.vi how many samples you want to read from this buffer with ever call.

 

 

Hope this helps,

Christian

0 Kudos
Message 2 of 7
(5,469 Views)

Thanks for the response.

 

But in my case, these two are not equal. the program can still run. I am not sure how many samples it acquires....

 

 

Lei

0 Kudos
Message 3 of 7
(5,456 Views)
Solution
Accepted by topic author shenl024

In your case, the VI will acquire the lesser of either:

 

The "Samples per Channel" that you defined on the DAQmx timing VI

- OR -

The number of iterations of your For Loop (N) times the "Number of Samples per Channel" that you defined on the DAQmx read VI

 

 

The "Samples per Channel" on the DAQmx Timing VI for a finite acquisition dictates how many samples the DAQ devices should acquire into it's onboard buffer before indicating that the acquisition is complete.  The "Number of Samples per Channel" on the DAQmx read VI dictates how many samples the DAQmx driver should return from the device's onboard buffer to your application.

 

Lets say the "Samples per Channel" on the DAQmx timing VI is set to 50.  As a result, the card will acquire 50 samples and place them in the on board buffer, then stop.  Let's say we have the "Number of Samples per Channel" on the DAQmx Read VI set to 3, and we call the VI in a For Loop that runs 10 times.  As a result, every time the DAQmx read VI is called, it will wait until there are at least 3 samples in the buffer, then return those three.  We call the VI a total of 10 times, so we will get 30 total samples back.  Thus, the last 20 samples the card acquired are left in the buffer and are destroyed when the task is cleared.

 

Now lets say that we increase the "Number of Samples Per Channel" on our DAQmx Read VI to 10.  The Read VI will wait until 10 or more samples are in the buffer, then return those 10. Thus, we will have returned all 50 samples the card acquired by the 5th iteration of the For Loop.  The 6th time we call the DAQmx Read VI, it will time out, because there will never be another 10 samples in the buffer, and the VI will return a warning.

 

Does this clarify things?

 

The purpose of this behavior is to allow you to both define the total number of samples that the DAQ device will acquire and also control how many of those samples are returned each time you call the DAQmx Read VI.

 

Regards,

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Message 4 of 7
(5,453 Views)

Why don't you make them equal then?

 

For me it makes no sense to tell the card it should acquire 1000 samples and then I only read 500...hm?

 

Again, at the DAQmxTiming.vi you determin how many samples will be acquired.

With the DAQmxRead.vi you can specify how many samples of the acquired ones, you want to read then.

 

Btw, is this causing problems in your application?

 

Christian

0 Kudos
Message 5 of 7
(5,452 Views)
Thanks guys!
0 Kudos
Message 6 of 7
(5,439 Views)

Hi Seth B,

 

First of all, your examples are really helpful. But I still have some questions to ask.

 



As a result, every time the DAQmx read VI is called, it will wait until there are at least 3 samples in the buffer, then return those three.  We call the VI a total of 10 times, so we will get 30 total samples back.   

Does the DAQmx Read consecutively return each 3 samples? In other words, the 30 total samples read is exactly the copy of the first 30 samples of the 50 samples acquired into the onboard buffer?

 

Also, if the Samples per Channel is set to be much larger than the onboard buffer, will the DAQmx Timing stop once the buffer is full? If yes, then how can we get the required amount of samples?

 

Best,

 

Wesley

0 Kudos
Message 7 of 7
(3,861 Views)