suddenly invalid RSRCNAME specified visa accessing usb port

9 次查看(过去 30 天)
For some reason, suddenly a function I've been using a long time no longer is working on a particular PC. It was 2 PCs, but some how, I was able to fix them both, now one of them is acting up again. I use ni-VISA to access a temperature logger on a USB port, I get back an empty answer. It would normally provide a list of the ports attributes and work correctly. The code is working fine on other machines. I've tried different hardware for the logger, which has not made any difference. I tried this logger hardware on other machines and it didn't fix it. THis is the error message:
"Invalid RSRCNAME specified. Type 'instrhelp visa' for more information" Not sure why it would give that message.
for countPort = 1:10;
port = ['COM', num2str(countPort)];
try
% OPSens = serial(port);
OPSens = visa('ni',port);
get(OPSens);
set(OPSens,'timeout',5);
%OPSens.terminator = 10;%linefeed (LF) character (ASCII hexadecimal <0x0A>)
fopen(OPSens);
serialUnitID = query(OPSens, 'SYST:IDN?');
  2 个评论
Mike
Mike 2013-4-1
编辑:Mike 2013-4-2
This is a new load of 2013a, a new update of NI products as well. NI products do not have any problem finding the temperature logger and getting information from it. It seems like it is some link between Matlab and VISA which is broken.
Digging down further I find that it has to do with the JAVA method, getAliasInfo line 346 in visa.m (this is a matlab classdef, I've changed nothing) info = getAliasInfo(tempobj, name);
comes back without the alias
If I spoof the system and change the alias for the working COM port to COM1, then the system works. More of the file code
% Determine the resource name from the specified resource name. This will % allow users to use an alias for their resource name. try tempobj = com.mathworks.toolbox.instrument.SerialVisa(pathToDll,vendor,'ASRL1::INSTR',''); info = getAliasInfo(tempobj, name); if ~isempty(info) info = cell(info); end tempobj.dispose; catch errflag = true; errType = 1; return; end
% If there is no information returned, then it is an invalid resource % name/alias. If the first element is not an INSTR, error. if isempty(info) errflag = true; return; end
% Otherwise the alias/resource name was mapped to a resource name. rsrcName = info{2}; alias = info{3};
Andrew Fowler
Andrew Fowler 2013-7-2
Did you manage to get this problem solved? I'm having a similar issue with a GPIB-USB-HS adapter from national instruments.

请先登录,再进行评论。

回答(1 个)

Vinod
Vinod 2013-4-24
I'd recommend contacting technical support.

类别

Help CenterFile Exchange 中查找有关 Instrument Control Toolbox Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by