I am using MATLAB 2015a and Instrument Control APP. I am trying to create a MDD file for my Rigol DS 4000 series scope. I have downloaded IVI and VISA drivers. But no success. I am particularly troubled that I can not run the simple MATLAB example makemid('hp34401'); without getting the error "The specified driver could not be loaded." What am I missing?
MATLAB: Create MDD file for Rigol DS 4000 series scope
Instrument Control ToolboxMATLABmddrigol
Related Solutions
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
I understand that you are trying to create a MATLAB Instrument Driver for the NHR 4600 device using the 'makemid' command and receiving the
Since IVI-COM is only supported with 32-bit versions of MATLAB, I am assuming that you are using a 32-bit installation of MATLAB R2015b or earlier. All documentation links in this answer refer to MATLAB R2015a, but you can refer to the appropriate page for the MATLAB release that you are working with.
Try the following troubleshooting steps for this issue:
Basic Troubleshooting
- Are you able to view the device information using the command "instrhwinfo('ivi')"? If not, follow the directions listed on this documentation page: Getting Started with IVI Drivers
- Make sure that 'NHRACLoad' is exactly same as either the driver name or the device's logical name as it appears in the output of "instrhwinfo('ivi')".
Failure to Locate Driver File
In certain MATLAB versions, his error can occur if the IVI-C driver is installed into a folder name that does not match the driver prefix specified in the IVI Configuration Store.
To work around this issue you can change the folder name in which the driver FP-file is present to match the prefix for the driver. The following steps use Agilent 34980A as an example, but you can follow similar steps for your device as well.
- Determine the location of the IVI root directory. This can be done by examining the IVIRootPath filed returned by the command
>> iviinfo = instrhwinfo('ivi');>> iviinfo.IVIRootPathans =D:\Applications\IVI\
- Go to the IVI root directory and then into the "Drivers" sub folder.
>> cd(iviinfo.IVIRootPath)>> cd Drivers\
- Look for your drivers directory in this folder. For example the "AqD1" driver is located in a folder called "IviAqD1"
>> dir . AgSAn AgilentInfiniium ividcpwr ivirfsiggen.. Agilent34401 AgilentSa ividmm iviscopeAGN6030A Agilent34980A IviAqD1 ivifgen ivispecanAgRFPowerMeter Agilent546XX TekScope ivipwrmeter iviswtch
- Look in the directory for you driver and see the name of the FP and SUB files.
>> cd Agilent34980A >> dir *.fpag34980a.fp
- The name of the directory should match the name of the FP file. In this case, the directory name should be changed to ag34980a.fp. This also must be the name of the DLL-file in the "bin" folder of the IVI root directory. The DLL-file may have an optional "_32" appended to the end of the file.
>> cd ..>> movefile Agilent34980A ag34980a
- You can now create the MDD-file with the MAKEMID command and use it with ICDEVICE
>> makemid('ag34980a','ag34980a.mdd')>> instr = icdevice('ag34980a.mdd','GPIB0::1::INSTR');
- Other applications may expect the old directory name. Once the MDD-file has been generated, you can quit MATLAB and rename the directory back to its original name.
Additional Resources
Best Answer