10-02-2007 11:21 AM
This snippet of code might be helpful...
@FrustratedwithDAQmxHelp wrote:
Paul,
I appreciate your reply. I have looked at all of the examples that you refer to. Without those I would certainly have gotten nowhere. However, they are limited. I can honestly tell you with what you have given me on the double buffering, I will not succeed. There are far too many options and subtile nuances involved and resolving each takes far longer than I have time. It would be much better for either better documentation on the each function to be provided or for you to give me more details (like an actual example). In the mean time do you have any idea why my exiting code keeps output the state of the first buffer call.
Thanks Larry
10-18-2007 01:48 PM
10-19-2007 07:30 AM - edited 10-19-2007 07:30 AM
Yes. The first write automatically sets the DAQmx Buffer size and gives DAQmx the first part of the data. The second DAQmx write after starting the DAQmx task gives the remaining data.
@FrustratedwithDAQmxHelp wrote:
Jeff,
Thanks for the reply and example code. This is helpful. I have a couple of questions about your code.
First it appears you only call DAQmxWriteDigitalU16 twice. Once to output amount_written of words from buffer, starting with buffer[0] and the second time to output total_generation - amount_written words from buffer, starting with word buffer[amount_written]. Is that correct?
The DAQmxWriteDigitalU16 is a synchronous call, when the function returns, you can modify the buffer that you passed in. If the hardware is running and it needs to wait for space in its buffer, it will wait for space.
If so, this is not totally anologies to my situation. First you have defined an array for the entire data set in buffer. I do not have enough memory to define an entire array of what I need to output. From what I am understanding, I need to define two buffers considerably smaller than the total data set, load these buffers and then call DAQmxWriteDigitalU16 twice. Then I need monitor the first DAQmxWriteDigitalU16 call to see when it is done using the first buffer, so I can grab it, reload it and then call DAQmxWriteDigitalU16 again. Then I need to wait for the second DAQmxWriteDigitalU16 to finish using the second buffer so I can also grab it, reload it and then call DAQmxWriteDigitalU16 for a fourth time. This process would continue until all the data is generated.
1. Is this understanding correct?
2. Is there some function that I can call that tells me when a given DAQmxWriteDigitalU16 is done using the passed buffer?
3. If I am off base can you correct my understanding?
Thanks for your help, Larry
Message Edited by jcarbonell on 10-19-2007 07:31 AM
10-19-2007 07:46 AM
10-19-2007 03:57 PM
10-19-2007 04:46 PM
10-22-2007 09:07 AM
Hi Larry,
@FrustratedwithDAQmxHelp wrote:Thanks Jeff,Sorry for being so slow on this. I guess I am so use to thinking on a low level, that when you say DAQmxWriteDigitalU16 will handle the additional calls, I find that hard to believe. If I am understanding you correctly, you are saying DAQmxWriteDigitalU16 will queu all of my additonal calls until the buffers become available.How will it avoid lossing data as I am only clocking out so fast and I am sure I will generated it faster than it clock out? There is not enough memory in the machine for everything I am going to stream at it. Is it going to try to write it to disk? Would it not be better for me to wait until some of the buffers free up?Thanks Larry