02-18-2011 10:06 AM
zhoulmnk-
What happens if you change your value of AOBufferSpaceAvail=uint32(0); to AOBufferSpaceAvail=uint32(1);? Does your buffer size available change to 1? I wonder if the pointer is not functioning correctly lower in your code.
Also, it doesn't look like you are doing any error handling. What is the output of the callib line where you call the DAQmxGetWriteSpaceAvail property? Do you get any associated error codes?
02-18-2011 10:29 AM
Hi Gary,
I changed AOBufferSpaceAvail=uint32(0); to AOBufferSpaceAvail=uint32(1);.Then the AOBufferSpaceAvail changed to 1. You are right, the pointer didn't work right. But I still don't understand what's wrong with my code. When I use the DAQmxGetWriteSpaceAvail, there is no any error code. The output is 0.
Thank you!
liming
02-21-2011 01:38 PM
Hi liming-
I am unsure how you would use this pointer in MATLAB; this may be an issue with the syntax. You are passing all the correct parameters to the function. I would double check that your syntax is correct; this may be a question for MATLAB at this point. We have verified that your function returns the value as set by the property earlier in the program: DAQmxGetWriteSpaceAvail pulls a value as set by AOBufferSpaceAvail. I am unsure how the pointer should be setup.
02-21-2011 03:36 PM
Hi Gary,
Thank you!
Let me know if you find any solution to help me out or if you need more information. By the way, do you know some other way to use the buffer to load the big file?
liming
02-22-2011 02:23 PM - edited 02-22-2011 02:23 PM
Hi liming-
You might take a look at this example to see how they implement an analog output buffer. When you download it, you get a C Source file. This may help you craft your MATLAB code.
01-16-2023 07:50 AM
Old post, but I'm still answering because I ended up in this thread. It maybe helps others.
I also got 0 for DAQmxGetWriteSpaceAvail calls, and no error codes. It turned out that there was an error under the hood, but DAQmxGetWriteSpaceAvail did not show it! I called DAQmxIsTaskDone, which returned the error code, correctly (Onboard buffer underflow error, in my case).
So I assume what happened in my case is that all samples were written from the buffer, but the task halted and threw an error. It seems a halted/stopped task shows "0" for DAQmxGetWriteSpaceAvail.
I also had DAQmx_Val_HaltOutputAndError configured for DAQmxSetSampClkUnderflowBehavior.
Check for errors!