Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with call-backs / event nofication under VB6

I am using the DAQ cAPI with VB6 to program a PCI-MIO device.  I have developed a number of functions that seem to work fine individually (DIO, Analog in, waveform generation, etc).  The latest piece I hade added is continuous analog input with event (N samples acquired) notification using callbacks.  Typically, I will use this piece to acquire a fixed number of buffers, and then stop.  Each buffer gets displayed to the GUI.  I can call this function repeatedly with no problems.  However, if subsequent to calling and terminating this function, I call any of the other functions (even DIO input), subsequent calls to the continous analog in with callback notification fail to execute properly.  No error codes are generated and I have traced the code to make sure that the task is started.  The problem is nothing happens.  If I terminate and re-start the program - goodness is restored.  I have tried adding a button to manually execute the form Load and Unload event code - but this does not work.  Sometimes I can get the problem to clear by unloading and re-loading the form (without terminating the application) but this does not appear to be a reliable solution.
0 Kudos
Message 1 of 3
(2,916 Views)

Hello JasonAtSeagate,

 

Thank you for using NI forums.  I've encountered an issue similar to this before when doing continuous AI with events in VB6. I think the problem stems from trying to dereference the event (or trying to dereference a null pointer) in VB6.  We believe there may be a bug with the DAQmx driver and VB6.  I believe if you were to comment out the code within the callback of the RegisterEventEveryNSamples (not sure if this is the correct function name) function then you will not run into this problem.  This still probably won't allow you to do what you want, but I believe the problem can be narrowed down to that portion of code.  I was actually running into a crash whenever I would stop and then restart the UI, but if I were to completely close the UI and recompile then everything worked fine.  I'm still looking into possible reasons for this, and I'm not certain if you are encountering the same issue, but it does sound rather familiar.  I will try to post an update if any new discoveries are made.

 

Regards,

0 Kudos
Message 2 of 3
(2,904 Views)

Hi Brandon,

 

I solved my problem once I realized that I did not really need to use event notification / callbacks to achieve the desired result - which was to update the UI during a long acquisition.  Since I was not really familiar with DAQmx, I did not realize that I could easily accomplish this with continuous acquisition, which I am now doing.  Once I stumbled on the description of how DAQmx uses circular buffers all became clear. 

 

Sometimes I miss the days when we had printed manuals!

 

Good luck with your problem.

 

Jason. 

0 Kudos
Message 3 of 3
(2,895 Views)