07-23-2018 12:18 PM
Using NI 9263 board.
The previous programmer has wired 2000 to the samples per channel and 100 to rate.
The VI is being used to generate a waveform.
Would someone explain to me why both values are being set?
I am not very knowledgeable about DAQ.
07-23-2018 02:28 PM
The Samples Per Channel is setting the buffer size in samples and the Rate is the sample rate in Samples/second. Not sure what else you are looking for.
07-24-2018 05:17 PM
I still don't understand what that means.
Are you saying that it takes 20 seconds to output the entire waveform?
2000 samples / 100 samples/second = 20 seconds
.
07-25-2018 06:18 AM
Ok, I will assume you understand Rate since that is very basic.
With the DAQmx Timing.vi, you are setting the buffer size. This is how much memory is allocated for the circular buffer that holds the sampled data until you read it with the DAQmx Read.vi.
If you set up your task to be Finite Samples, this is how many samples the task will read before stopping itself. Use DAQmx Read to read all of the data (count = -1).
If your task is set up as Continuous Samples, then you are stating how many samples to hold in the circular buffer. When you do the DAQmx Read, you are getting data from that buffer (and moving the "read pointer"). If you let your buffer fill up (the "write pointer" comes back around and catches the "read pointer"), you will get an error. In your example, if you do not read any of the data in 20 seconds, you will get a buffer overflow error when you try to read the data. Generally, for Continuous Samples you want to just leave the Samples Per Channel unwired.
07-25-2018 08:40 AM
Tiny addendum to a great explanation:
@crossrulz
If your task is set up as Continuous Samples, then you are stating how many samples to hold in the circular buffer...
Generally, for Continuous Samples you want to just leave the Samples Per Channel unwired.
Both comments above are in reference to the # samples input to DAQmx Timing (not DAQmx Read).
Continuous Sampling tasks may actually create a *bigger* buffer than what you specify. See this recent post of mine and follow its links for more detail.
I agree that leaving it unwired is usually fine (but again, only for *Continuous* Sampling tasks).
-Kevin P
07-25-2018 10:14 AM
Thank you both for the excellent explanations.
I will have to dig into the program further but this VI is being used for the NI 9263 cDAQ Analog Output module.
Yet your explanations are about sampling, but unless I am mistaken - which is very possible, the original programmer was using it for waveform output !
.
.
07-25-2018 10:54 AM
Sorry, wasn't familiar with the specific device and skipped over the part where you mentioned it was used for output.
So *NEVERMIND* my previous comment about buffer size. For an output task, crossrulz was exactly right with no addendum. The buffer size is set either by:
- the actual value you wire to the 'samples per channel' input on DAQmx Timing
- or, if you leave it unwired, the buffer size is set by the # samples in your first call to DAQmx Write
-Kevin P
07-25-2018 08:07 PM
@Kevin_Price wrote:
Sorry, wasn't familiar with the specific device and skipped over the part where you mentioned it was used for output.
So *NEVERMIND* my previous comment about buffer size. For an output task, crossrulz was exactly right with no addendum. The buffer size is set either by:
- the actual value you wire to the 'samples per channel' input on DAQmx Timing
- or, if you leave it unwired, the buffer size is set by the # samples in your first call to DAQmx Write
-Kevin P
I am still confused.
crossrulz's post was about a Read.
How does it apply to a Write ?
buffer size = 2000 samples
rate = 100 samples/second
So, it will take 20 seconds to write the entire waveform ?
.
07-26-2018 07:25 AM
@nyc_(is_out_of_here) wrote:
buffer size = 2000 samples
rate = 100 samples/second
So, it will take 20 seconds to write the entire waveform ?
If you wrote a 2000 sample waveform, then it will take 20 seconds for the board to output that signal.
Everything works exactly the same as with a read, except the data is going in the opposite direction (you write to the buffer and the DAQ board will clock out a sample at the rate you gave it until all of the buffer has been outputted). You do not have to write the entire buffer. This is just how many samples are allowed to be in the buffer. Again, you are better off just leaving that unwired.
07-26-2018 10:07 AM
@crossrulz wrote:
@nyc_(is_out_of_here) wrote:
buffer size = 2000 samples
rate = 100 samples/second
So, it will take 20 seconds to write the entire waveform ?
If you wrote a 2000 sample waveform, then it will take 20 seconds for the board to output that signal.
Everything works exactly the same as with a read, except the data is going in the opposite direction (you write to the buffer and the DAQ board will clock out a sample at the rate you gave it until all of the buffer has been outputted). You do not have to write the entire buffer. This is just how many samples are allowed to be in the buffer. Again, you are better off just leaving that unwired.
The light bulb just went on.
Thanks again.