Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting data from callbacks in visual basic

Hi,
 
I have an application that acquires an analog signal asynchronously and uses a callback to process the data when the read finishes.  The reason I am doing this is asynchronously is so that I can use the parallel port data output as an external clock source for the DAQPad-6016 used to acquire the data (for a number of reasons).  If I press a button on the GUI whose code calls a routine to perform the read and then use a subroutine called from within the callback to display the data, all is fine.  However, if instead I try to access the data array from outside the callback (i.e. from the sub that calls the acquisition sub) I get a "System.NullReferenceException" error, perhaps because the callback has not returned the data array yet (although this does not appear to be time dependent).  I would like to be able to loop through and acquire data several times before displaying or further processing the data.  This would mean getting the data array from the callback, transferring it to another array and then running the acquisition routine again.  However, I cannot find a way of doing this, yet it seems like it should be a common need.  If anybody has any ideas how to do this I would be grateful.
 
Thanks,
 
Nathan
0 Kudos
Message 1 of 2
(2,725 Views)

Check out this thread:

http://forums.ni.com/ni/board/message?board.id=232&message.id=2553&view=by_date_ascending&page=1

In particular, I posted an example project on 12/12/2005 that I think will do what you are asking.

0 Kudos
Message 2 of 2
(2,714 Views)