10-03-2005 11:34 AM
Any update on this error, it is still occurring with the latest version of LabWindows RTE (7.1.1) and NI-DAQmx 7.5.
It was mentioned that the problem may be occuring during the destruction of a task. Is that still the case? If so what types of task destruction should I be trying to track down and what type of failure would cause the execution of the program to stop completely?
Ken
10-04-2005 06:37 PM
Hi Ken,
I took a look at your code and the following line really stuck out to me:
while (DAQmxFailed (error = DAQmxTaskControl (taskHandle, DAQmx_Val_Task_Reserve))) {
Sleep (1);
}
It appears that you are sitting in a loop and simply trying
to call a function in the driver. Further in the code you can see that
the code keeps polling the driver until it is. You also said that you are
running this on different systems. What that means is that one system
could be using the driver and in the process or creating or destroying a task
and that another computer is trying to poll the driver to see if it's
available. Evidently there are a few rare instances where the two
processes occur at the same time and then it causes this error that you are
seeing.
I think that the best way you could get around this would be to have some sort
of indicator that the driver is in use. This could be something rather
simple like a semaphore that simply is used so that you can see if the driver
is being used. Once the driver is no longer in use, then your other
application could attempt to create a new task to access the driver.
This would also prove to be beneficial because it would help to free up your
CPU as it would not have to be continuously polling the process.
I think making these changes will help your process become more efficient and
prevent the errors that you are seeing from occurring. Let me know if you
have any more questions and we can see what else we can work on.
Regards,
10-05-2005 08:14 AM
Thanks Otis,
Do I need to create a third application or dll that implements the semaphore so both instances of the program can access it? More importantly, why can't this be implemented directly in the DAQmx driver?
Also, you may have noticed that the main portion of my code where the acquisition occurs does not create or delete the tasks. This is done at the start and end of each cycle which lasts about 6 hours. The program crashes at random times during the cycle.
10-06-2005 05:22 PM
Hi Ken,
I talked with a few people and I think what may be easiest is make some sort of
global variable in your program. Essentially you could have a global (or
some sort of DataSocket value) that is set to True (or 1) when one controller
takes control of the application. Then at the end of the program the
global could be set back to False (or 0). Then in your application, instead
of polling to see if the driver can be accessed simply poll the global
variable. If it's True that the driver is in use, then do not try to
access it. If it is False then you can try to access the driver.
Regards,
10-07-2005 07:55 AM
Hi Otis,
Unfortunately, I can't just not access the driver if its busy. I am running a PI controller that requires feedback from the DAQ card so I need some type of event or trigger to indicate when the driver is available. I tried using the DataSocket for synchronization when I first started developing this application but it never worked--I was only able to transfer data to the DataSocket server. That was back in CVI 5.1 so maybe it will work now.
Ken
10-11-2005 11:44 AM