Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Timing VI

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.

 

 

0 Kudos
Message 1 of 10
(4,009 Views)

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.


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
0 Kudos
Message 2 of 10
(3,993 Views)

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

 

 

.

0 Kudos
Message 3 of 10
(3,975 Views)

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.


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 4 of 10
(3,970 Views)

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

 

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 10
(3,966 Views)

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 !

 

.

 

.

0 Kudos
Message 6 of 10
(3,961 Views)

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

 

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 7 of 10
(3,958 Views)

@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 ?

 

 

.

0 Kudos
Message 8 of 10
(3,945 Views)

@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.


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
0 Kudos
Message 9 of 10
(3,937 Views)

@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.

0 Kudos
Message 10 of 10
(3,931 Views)