Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

error 200986 unregister event

I have registered the event:
 
 
DAQmxErrChk DAQmxRegisterEveryNSamplesEvent(taskHandle, DAQmx_Val_Acquired_Into_Buffer, CLng(frmSetMachine.txtSamplesPerChannel.Text), 0, EveryNSamplesCallback, Null)
DAQmxErrChk DAQmxStartTask(taskHandle)
 
 
and my callback looks like
 
Public Function EveryNSamplesCallback()
.....................
 
Exit Function
 
 
This event does fire, it steps through all the lines of code including the readAnalog call, but at the exit function of this callback function I get
 
error 200986 DaqMx software event cannot be unregistered because task is running. Unregister all your software events prior to starting the task.
 
But as you can see I startt the task AFTER I register and no place am I explicitly unregistering anything.
 
 
How do I fix this?
thanks,
sb
 
 
 
0 Kudos
Message 1 of 5
(7,588 Views)

Hello bonosA,

Is this the same problem you were experiencing in this dicussion forum?

If so does the code that cborn posted help you out?  If not let us know and we can look further into this.


Regards,

Jesse O.
Applications Engineering
National Instruments

Jesse O. | National Instruments R&D
0 Kudos
Message 2 of 5
(7,562 Views)
Hi bonosA,
 
were you able to resolve your problem? I am experiencing exactly the same error -20089 in the AI task.
I am wondering if this has anything to do with calling EveryNSamplesEventHandler function directly from DAQmxRegisterEveryNSamplesEvent. Did you try calling it by AddressOf EveryNSamplesEventHandler instead?
Also, did you have a chance to try David cborn's ActiveX solution (CBMXInput.ocx)? I am willing to try it but I cannot understand what is the purpose of his Sub Invoke(pCaller As Object)?
 
Victor
0 Kudos
Message 3 of 5
(7,305 Views)

Hi Victor,

 I cant recall what I did to resolve it. What I did find out is that the EveryNSamples function (in Visual Basic) has  to be in a bas module. Once I relocated the function there, things worked, but I cant recall if that was specifically what took care of this 200986 problem. Sorry I'm not much help.

Saroj

0 Kudos
Message 4 of 5
(7,300 Views)
Victor,

I do not completely understand where your problem is occurring.  Perhaps an example program would help you out.  There is a VB6 DAQmx events example here.  If this does not help you out, can you please provide me with a little more information on the problem you are having.  Perhaps posting a small piece of code that reproduces your error.

Regards,

Jesse O.
Applications Engineering
National Instruments
Jesse O. | National Instruments R&D
0 Kudos
Message 5 of 5
(7,289 Views)