Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

usb communication break problem

Hello,

 

I use CNT-90 timer/counter/analyzer. I communicite with usb port with NationalInsturements.VisaNS dll.You can see following c# code for usb communication.

 

string resourceName = "";

privateboolOpen_Device()

{

string[] resources = ResourceManager.GetLocalManager().FindResources("?*");

 

foreach (string s inresources)

{

if (s.IndexOf("USB") != -1)

{

resourceName = s;

break;

}

}

try

{

mbSession = (

MessageBasedSession)ResourceManager.GetLocalManager().Open(resourceName);

 

string query = "*IDN?";

 

stringresponseString = mbSession.Query(query);

 

if (string.IsNullOrEmpty(responseString))

 

returnfalse;

}

catch (InvalidCastException)

{

returnfalse;

 

//MessageBox.Show("Resource selected must be a message-based session");

}

catch (Exceptionexp)

{

returnfalse;

 

//MessageBox.Show(exp.Message);

}

returntrue;

}

 

publicbool Measure_Frequency_MessageBasedSession()

{

string measureKomut = ":MEASure:FREQuency?";

 

string buffer = mbSession.Query(measureKomut);

 

//other process...........

 

return true;

 

}

 

When I call my Measure_Frequency_MessageBasedSession function repeatedly (for example more than 100 times) usb communication breaks with the device.Windows usb 2.0 warnin ballon shows on task bar(Warning message="This USB device can run faster than a high-speed USB 2.0 port is connected to") and usb communication breaks.I can access the device when I unplug and plug usb cable with above my code.

Why after a while usb communication break? and Why I have to unplug and plug cable? What can I do for this error?

Thanks in advance.

 

Note(I use VISA 5.1.2. I reinstall driver but did not work.)

0 Kudos
Message 1 of 1
(5,641 Views)