09-15-2011 06:11 PM
Hello,
I'm using Matlab and the nicaiu.dll to make calls to the NI-PCI6534. I'm just a novice with using this DLL and I'm confused by how to use the DAQmxGet/Set/ResetBufOutputBufSize command.
In the chm file, this is all I get on how to use the command:
int32 __CFUNC DAQmxGetBufOutputBufSize(TaskHandle taskHandle, uInt32 *data);
int32 __CFUNC DAQmxSetBufOutputBufSize(TaskHandle taskHandle, uInt32 data);
int32 __CFUNC DAQmxResetBufOutputBufSize(TaskHandle taskHandle);
I'm not a programmer by training and am a bit confused about pointers in general. If I want to set the buffer size to 128 and then retrieve the buffer size, I would think I would send the following calls:
calllib(Lib,'DAQmxSetBufOutputBufSize',hTask,uint32(128))
To retrieve the command, I'm confused on what I put for the uInt32 *data
calllib(Lib,'DAQmxGetBufOutputBufSize',hTask,???)
Any help is grateful,
Jason
09-16-2011 10:59 AM
Jason, you would want to reference the uint32 by pointer call (which is what the * before the data is for). Your code would look something like this:
uint32 bufSize = uint32(128);
DAQmxSetBufOutputBufSize(TaskHandle taskHandle, bufSize);
DAQmxGetBufOutputBufSize(TaskHandle taskHandle, *bufSize);
Hope this helps, good luck with your programming!
09-16-2011 11:25 AM
Hi Ben,
Thank you for your reply.
Let's see if I understand your answer...I should do the following:
Buffer = uint32(128);
pBuffer = libpointer('uint32Ptr',Buffer);
Err = calllib(Lib,'DAQmxSetBufOutputBufSize',hTask,Buffer); % Set the buffer size
[Err, Y] = calllib(Lib,'DAQmxGetBufOutputBufSize',hTask,pBuffer); % Retrive the buffer size
When I run the 'DAQmxGetBufOutputBufSize', Err = 0 and I would expect Y to give me a value of 128 but I receive a pointer of type uint32Ptr with an empty value.
What am I missing?
Thanks,
Jason