Test and Measurement Forum

ADC 24 Close Unit after losing connection

Post your VB and VBA discussions here

ADC 24 Close Unit after losing connection

Postby RelChron » Fri Oct 10, 2014 10:02 pm

In VB6, how do I recreate the same functionality as the Pico Recorder where if the ADC24 is accidentally disconnected WHILE streaming, it has the ability to realise that the connection has dropped out and it will resume when the device is plugged back in?
If I have opened the unit and started streaming in VB6, if the connection is then momentarily lost and regained, this hangs the program.
I have error trapped the Streaming function and was going to use this to allow the user to reconnect, but the problem is I cant use HRDLOpenUnit, it returns a 0 as it sees an open connection already. If I try HRDLClose before hand I don't know the new handle of the new connection that has been established, so I cant send the HRDLclose handle parameter.

I noticed that in the PicoRecorder - when its streaming you can pull the USB cable and a error message windows appears asking to reconnect the device. if you reconnect you get a progress indicator and it starts streaming again.

However your VB6 sample code does something very similar to my project, ie if you are streaming data and you pull the USB, it hangs the program - you cant close the Unit or stop, or even shut the program down to restart it - you have to use task manager to shut it down and reopen it.

So, how did you do it in the PicoRecorder? :)
regards
RelChron
Newbie
 
Posts: 0
Joined: Mon Jan 14, 2013 11:50 pm

Re: ADC 24 Close Unit after losing connection

Postby Martyn » Tue Oct 21, 2014 8:41 am

If you use HRDLClose with the original handle, wait a short period, and then use HRDLOpenUnit it should give you the same handle back.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2280
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests