Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Double-Buffered Analog Output in DAQmx?

I am working on rewriting an analog output Traditional DAQ application to use DAQmx, and I am using a PCI-6711 card.  My question is how to do double-buffered analog output in DAQmx?  In Traditional DAQ you would call WFM_DB_Transfer to send more data to the buffer during generation, which makes it possible to output large arrays full of data.  So far, in DAQmx i have not figured out how to do the same thing.   Could someone help me figure out how to do that? 
 
I thought i posted this once, but i think i might have erased the post.  So, I apologize if this is the second time i posted this question.   
0 Kudos
Message 1 of 6
(4,143 Views)
GVanHorn,

The function you are looking for is "WFM_DB_Transfer," assuming you are coding in C. Please take a look at the attached example. This function is used on line 209. The file should also be installed by default to this location:

C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Ao

Hope this helps,
Ryan V.
National Instruments

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 6
(4,130 Views)
I thought that WFM_DB_TRANSFER was used for Traditional DAQ only.  When I looked in the NI-DAQmx C Reference Help there was no listing of WFM_DB_TRANSFER. 
0 Kudos
Message 3 of 6
(4,120 Views)
GVanHorn,

I apologize for the confusion. I thought I was looking at the DAQmx examples Smiley Happy! You are right - that is a traditional function. I have modified the "Cont Gen Volt Wfm-Int Clk" example to disable automatic on-board sample regeneration and continuously write data while the task is running. Please try the attached code and let me know if you have any questions.

Regards,
Ryan V.
National Instruments
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 4 of 6
(4,110 Views)
Thanks for the example.  It has proved helpful, but i wanted to ask about the "DAQmxGetWriteSpaceAvail(taskhandle, &writeSpaceAvail)" function.  I think that is a crucial  part of the code, but i can't find a reference to it DAQmx C reference.  Is this an older function? 
 
Overall, i think i understand what you were doing in the example, but i guess the part I am fuzzy on is how to know when to write more data to the buffer.  I think the GetWriteSpace available function might be the key to that.   It looks like in the example you gave me that you wait till there are at least 500 samples worth of space open to be written, and then you refill the buffer.  Is that correct? 
 
Thanks again,
Gerry
0 Kudos
Message 5 of 6
(4,091 Views)
Gerry,

You are correct, I am waiting until there are 500 samples available in the buffer. At that point, I write another 500. The "DAQmxGetWriteSpaceAvail" function is not in the index of the C help, but if you do a search for it, there should be a couple of results. Please let me know if you have any more questions about the code.

Ryan V.
National Instruments
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 6 of 6
(4,082 Views)