LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffered write with NI USB-6211 and DAQmx base

Due to limitations in the NI USB-6211 (ao not retriggerable, only 2 counters, start trigger of a counter can't be InternalOut of the other counter) I have to write a ling waveform to the analog out.

This works quite nice in DAQmx.

DAQmx base works differently. As soon as I want to write more than about 8000 Samples, it complains that the buffer is too small.

Writing smaller amounts works but leads to timeouts because I need to wait for a trigger. Despite the text in the help file that writes something about buffered write and that timeout only applies if the write has to wait (for whatever reason?) it seems, that DAQmx base write is always blocking.

 

1. Is there a way to make the DAQmx base write (Analog Out, NChan, NSamp) non blocking?

2. Is there a way to write more than 8000 Samples?

 

Sure, I could rework my Software to keep the data to write in an array, write small amounts af data with each iteration (and with a small timeout) and use the error messages to decide if I should send the same data again with the next try or if it is time to move to the next block of data... But if there is a better way, I'd prefer it!

 

I'm stuck on DAQmx base because DAQmx is not available for MacOS X...

--
Marco Tedaldi, University of Zurich, CLAD
0 Kudos
Message 1 of 2
(2,641 Views)

It seems, that there is really an (undecumented) limit of 8000 Samples on this hardware NI USB-6211, I don't know about others) and no obvious way to get that information (there is no class for DAQmx base in the property nodes). Also, you can't get information about how many samples there are in the buffer right now.

 

The only way I've found is to use the "DAQmx Base Write.vi" to try to write the data with a short timeout (since my program should still be respnsive) not below 0.8 seconds for 4000Sample chunks (with shorter timeouts, I got corrupted output) and look at the orror code.

So I have my big array (2D dbl even if I only use one channel since DAQmx Base only accepts 2D Arrays) from which I cut a chunk of 4000 Samples. Depending on the error code I take the ouput "bytes written" from the DAQmx base write.vi and add it to my position index value. Next 4000bytes from my array will start from that index... This way, my program cycles continuously until a stop condition occurs.

 

For the sample clock (which is generated by one of the counters) I had to install a wire from PFI4 (the output of the counter) to PFI1 (which I was able to define as the sample clock input) because Internal Routing of this signal does not work with DAQmx Base (It does work with DAQmx).

 

I've created a SubVI which can be used like a Functional Global variable. The data types are tailored especially for my use case but the structure might be useful for someone who faces the same problems I had to overcome. See attached vi (LV2012).

--
Marco Tedaldi, University of Zurich, CLAD
0 Kudos
Message 2 of 2
(2,602 Views)