LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Abnormal DAQmx Disconnect and Recovery

So the user inadvertantly disconnects the USB cable to the DAQmx device (USB6009) while my CVI 8.1 program is running.   My program can detect this incident and post a message.  But I would like the program to additionally do is give the user the opportunity to recover by re-connecting the cable and acknowledging the posted message, and then simply resume operation.  What must be done to reset and re-configure without crashing the system or my program?

Thanks
0 Kudos
Message 1 of 2
(2,840 Views)
Steve,

Something that you could try is to monitor whether the device is plugged into the system or not using DAQ Device property nodes. What you can do is put a large IF statement around all of your code (before starting the task or configuring it), use the DAQ device property node to check if the device is plugged into the system.  For example, I used the serial number to check if the device is plugged into the system and only then execute the entire task (input or output).  Enclose all of this in a larger while loop.

While you are running the task, if you see the particular error that occurs when the device is unplugged, ignore the particular error but break out of your data acquisition/generation loop, thus getting into the larger outer loop.  Now you are again checking to see if the device is plugged into the system or not.  Only when the device is plugged into the system and completely recognized, start the data acquisition/generation loop again.

This is something I am just playing around with and I have to adjust for the time is takes for my device to be recognized every time I plug it into the system.

Hope this helps.

Regards,
Raajit L
National Instruments
0 Kudos
Message 2 of 2
(2,806 Views)