LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxGetWriteAttribute Error

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?

0 Kudos
Message 1 of 9
(5,231 Views)

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

0 Kudos
Message 2 of 9
(5,064 Views)

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. 

0 Kudos
Message 3 of 9
(5,047 Views)

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??

0 Kudos
Message 4 of 9
(5,044 Views)

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

0 Kudos
Message 5 of 9
(4,974 Views)

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,

Daniel Dorroh
National Instruments
0 Kudos
Message 6 of 9
(4,951 Views)

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. 

0 Kudos
Message 7 of 9
(4,937 Views)

Hi nano8874,

 

Have you tried to repair your DAQmx driver? or upgrade it to a newer version?

 

Regards

0 Kudos
Message 8 of 9
(4,919 Views)
Hi nano8874,

Can you post some code that reproduces this problem? I would like to look into this further.

Thanks,
Daniel Dorroh
National Instruments
0 Kudos
Message 9 of 9
(4,904 Views)