MATLAB Answers

cannot connect to instrument using IVI driver

14 views (last 30 days)
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!
Houssem medini
Houssem medini on 15 Apr 2011
to generate the driver.mdd I used the Matlab Instrument Driver Editor.
Concerning the IVI driver, I have downloaded from agilent web site

Sign in to comment.

Accepted Answer

Ankit Desai
Ankit Desai on 22 Apr 2011
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: ''
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!