07-24-2015 04:21 PM
Hi,
I am having an issue using DAQmxGetWriteAttribute to get the DAQmx_Write_TotalSampPerChanGenerated attribute. The function works just fine, BUT whenever I open a file in a different part of the program to record data, calling this function closes the file. I can't figure out why this function would do this (they seem to be completely unrelated), or how to fix this. Any ideas?
07-27-2015 12:57 PM
Hi there,
How many time do you call this function in your code?
Could you provide the code or a screenshot to have a better understanding of your issue?
And are you generating a voltage task or current task?
Regards
07-27-2015 06:08 PM
Hi,
I call the function every 2ms, it's part of a loop. But it sets (seemingly random) pointers to NULL the very first time it is called (and any subsequent time after that). I've attached a screenshot. I'm generating both a voltage input and voltage output task. I have a separate, previously defined array called "CurrentBuffer" that turns to NULL as soon as this function is called.
07-27-2015 06:17 PM
Update - it seems to affect pointers which have "Cur" in their names, or something like that (it was affecting "CurrentlyOpenFile" and "CurrentBuffer"). I can avoid the problem by renaming the pointers. But any ideas why that's happening??
07-29-2015 05:19 PM
Hi there,
This is your first time that you use these Attributes and have this behavior? or you had used this specifically attribute before?
And have you tried to do a small simple code that used both function "CurrentlyOpenFile" , "CurrentBuffer" and DAQmx_Write_TotalSampPerChanGenerated?
I would like to know if doing the small example in a new project you have the same behavior as your code
07-30-2015 08:48 AM
Hi, nano8874
Are you saying that if you create a pointer that is completely unrelated to your DAQ task and just happen to use the prefix 'Cur,' when you call this function, that pointer is nullified, or are the 'Cur' pointers used by the DAQ task?
Thanks,
07-30-2015 01:05 PM
Hi Daniel,
It's the first case, and is happening not just with pointers. A previously defined function or variable, which is completely unrelated to the DAQ task, is nullified when I call this function. It is now happening with other variables - it seems that as soon as I fix one issue, by somehow renaming it or copying the value or address to a different variable or pointer, it chooses a different variable to set to null. It seems that I was wrong that this happens only with pointers that start with 'Cur', that must have just been a coincidence. Now it is setting 'DAQBufferSize', an integer, to null.
To fix the problem for now, I have just copied that value to a temporary variable, let the function set the original variable to null, then copy the value from the temp variable back to the original one. Renaming the variable will just make the function choose another seemingly random, unrelated object to set to null.
07-31-2015 10:59 AM
Hi nano8874,
Have you tried to repair your DAQmx driver? or upgrade it to a newer version?
Regards
07-31-2015 04:19 PM