Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

DAQmx Multi-WaveForm call back error upon calling EndReadWaveForm

Sorry I cannot remember the error code it was something like -50503 or - 55053 I will update tomorrow with the actual error.


Here is what is going on I have a 6289 that I have an AI channel reading in data.  The Task associated with it is created new and has the AI channel added to it when passed into a function which sets up the task and verifies it. 


I am using the same AI channel for to obtain data for several different samples.  After obtaining a sample an event is fired on a seperate parameterized thread with the data from that reading beinged passed to it.  That being said I have not had issues in the past reading data in like I am.  The only difference that I have this time is that I am using two different callbacks in the main code, but that should not be an issue for the firing event and is not where the error is raised.  This one AI channel, task, and callback work fine for multiple samplings/readings in the same callback.  At the end of the sampling if I start the other version with the same AI channel and a different callback upon the callback.  The error is not occuring in the callback but upon the EndReadWaveForm(AsyncResult) call with in the event fired from the daq.  It says something along the lines of the device is busy with a previous call but if ignored everything seems to work fine on the second firing of the event fromt he daq. Now I can run them in the oposite order and did not see this happen and I can run either one multiple times and this does not happen.


The task and everything associated with it except the AIChannel are created new everytime I set it up and the AIChannel is passed into a function to be added to the AIChannelCollection of the task as a setup feature before the Task is used.  I have verified this and am left with the impression that either the AIChannel is persisting something that associates it with the previous Task or the DAQ is retaining some info.


I am sorry for being a little vague but I just stumbled upon this as I have not ran items in the opposite order at the end of 12 hours and it is bothering me that I have not seen this before and cannot figure out how a previous task is still running or associated with the DAQ and why the error occurs on the EndreadWaveForm only and that it runs fine if I just igonre the error which I really do not like as it is just bad programming.


The error I am pretty sure I am getting is;


Error code: - 50103
The specified resource is reserved. The operation was completed by ignoring or overriding the specified resource.
Possible cause:  There are several cases where this error can occur.  A common case is when the device is in use by another program/VI, or a previous DAQ task did not release the device resources.
Solutions:  Make sure you have freed the device for use by another program or task instance. For example, you might not have wired a stop condition to a DAQ Assistant Express VI configured for single point acquisition.


 After some reading I will try to make sure that all resources are released, even thought I know I am creating the task from scratch I am reusing the DAQ and the AIChannel so someting may have been left there.



I will post more in the morning when i get back infront of the errant program.



0 Kudos
Message 1 of 2

Yes the error provided was the error I was getting.


Even though I was unhooking the event handler and killing the task, I put a try-finally block around the area calling and made sure they were called and it seems to have solved the issue or atleast I have not seen it today.


So I guess this is resolved for now.

0 Kudos
Message 2 of 2