Azzera filtri
Azzera filtri

Why does fclose() / instrreset cause MATLAB to hang when closing a VISA-USB object?

39 visualizzazioni (ultimi 30 giorni)
I am controlling both a Thorlabs optic power meter over visa-usb and a Newport motor controller over serial.
USB:
pmAddress = 'USB0::0x1313::0x8078::P0008339::INSTR';
pm100d = visa('ni',pmAddress);
fopen(pm100d);
... communicate with instrument ...
fclose(pm100d);
delete(pm100d);
clear pm100d;
instrreset;
SERIAL:
gSmc = serial('com3','BaudRate',9600,'DataBits',8,'Parity','None','Terminator','LF');
fopen(gSmc);
... send commands ...
fclose(gSmc);
delete(gSmc);
clear gSmc;
instrreset;
In the serial case, everything works as intended. In the USB case, fclose() causes MATLAB to hang. I can't ctrl-c the process, and I can't do anything to resolve the problem except forcing MATLAB to quit.
I tried using instrreset instead and the same problem happens for the VISA-USB object.
What could be causing this?
Thanks for your help.

Risposte (1)

Walter Roberson
Walter Roberson il 21 Nov 2016

Categorie

Scopri di più su Instrument Control Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by