MATLAB Answers

0

cannot connect to instrument using IVI driver

I am using IVI driver to connect to an Agilent Power meter N1911A. I have the IVI Shared components installed. the ivi driver installed, too. I have generated the 'driver.mdd' and I can create an object. But I cannot connect to it. The error I get is: *Error using ==> icdevice.connect at 117 The VXIplug&play driver could not connect to the instrument using the specified resource. If this error is not an instrument error, use MIDEDIT to inspect the driver.*
Can some one help ? thanks!

  2 Comments

Can you show the code you used to generate the "driver.mdd" file?
Also can you provide a link to the driver you installed on your computer for the Agilent Power Meter N1911A?
to generate the driver.mdd I used the Matlab Instrument Driver Editor.
Concerning the IVI driver, I have downloaded from agilent web site http://www.home.agilent.com/agilent/editorial.jspx?cc=CA&lc=eng&ckey=1627801&nid=-536902903.536894474&id=1627801

Sign in to comment.

1 Answer

Answer by Ankit Desai on 22 Apr 2011
 Accepted Answer

Since I do not have the actual instrument, I was not able to try it out with one - but I was able to successfully connect using simulation mode of the IVI driver. I used R2010b for the following:
>> iviInfo = instrhwinfo('ivi')
iviInfo =
LogicalNames: {}
ProgramIDs: {'AgilentRFPowerMeter.AgRFPM'}
Modules: {'AgRFPowerMeter'}
ConfigurationServerVersion: '1.7.0.12115'
MasterConfigurationStore: [1x59 char]
IVIRootPath: [1x36 char]
The command listed above will result in a structure where ProgramIDs field will list all the installed IVI-COM driver while the Modules field will list all the IVI-C driver installed on your computer.
As it is seen from the output, I had only installed one driver from the link posted and that driver installs both an IVI-C as well as an IVI-COM driver for the Agilent Power Meter.
To use these installed IVI-C and IVI-COM drivers in MATLAB, you will need to have/create a MATLAB Instrument Driver (which is a layer around those drivers). Depending on which driver (IVI-C or IVI-COM) you plan to use, you would call the makemid command (makemid = Make MATLAB Instrument Driver).
>> makemid('AgRFPowerMeter','MATLAB_IVI_C_Driver.mdd');
The command above creates an MATLAB Instrument Driver for the IVI-C driver - AgRFPowerMeter (listed in the Modules field). The second argument is the name for the created MATLAB Instrument Driver.
Similarly if you plan to use the IVI-COM driver to communicate with your instrument you would create the MATLAB Instrument Driver using the ProgramID of the IVI-COM driver:
>> makemid('AgilentRFPowerMeter.AgRFPM','MATLAB_IVI_COM_Driver.mdd');
Once you have the *.mdd file, you can create a device object using the syntax:
>> deviceobj = icdevice(<name_of_my_mdd_file>,<instrument_visa_address>);
So, if you plan to use the IVI-C driver (note that if you are not using simulation mode, you can avoid the 'optionstring' and 'simulate=true' arguments):
>> ivicobj = icdevice('MATLAB_IVI_C_Driver','GPIB0::5::INSTR','optionstring','simulate=true');
>> connect(ivicobj);
While if you plan to use the IVI-COM driver:
>> ivicomobj = icdevice('MATLAB_IVI_COM_Driver','TCPIP0::my-instrument-hostname::INSTR','optionstring','simulate=true');
>> connect(ivicomobj);
Remember, if is important to get the instrument's VISA address correct for connect to pass in non-simulation mode. You can get the instrument's VISA address from the VISA Vendor's utility - for example NI's Measurement and Automation Explorer and/or Agilent's Connection Expert.
Hope this helps.
-Ankit

  0 Comments

Sign in to comment.