1MA153 15e Hints Using Instrument Drivers
1MA153 15e Hints Using Instrument Drivers
1MA153 15e Hints Using Instrument Drivers
15-Feb-16-1MA153_15e
Application Note
Miloslav Macko
Table of Contents
Table of Contents
1 Preface .................................................................................... 3
6 Related Document................................................................ 21
7 Resources ............................................................................. 22
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 2
Preface
1 Preface
The aim of this application note is to provide information regarding Rohde & Schwarz
instrument drivers. This paper shall help application engineers and software
developers to easily get an understanding of advanced techniques to develop test and
measurement (T&M) applications by utilizing ROHDE & SCHWARZ instrument drivers.
Furthermore the nomenclature used for ROHDE & SCHWARZ instrument drivers will
be explained.
It does not describe any programming languages or how to develop software in any
programming language.
® ®
Microsoft and Windows are U.S. registered trademarks of Microsoft Corporation.
® ® ®
NI , LabVIEW , LabWindows/CVI are U.S. registered trademarks of National
Instruments.
®
R&S is a registered trademark of ROHDE & SCHWARZ GmbH & Co. KG.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 3
Frequently Asked Questions (FAQ)
ROHDE & SCHWARZ instrument drivers are based on Virtual Instrument Software
2
Architecture (VISA ), which enables a physically independent connection between the
host PC and the instrument.
1
Standard Commands for Programmable Instruments (SCPI) is a command set for
remote-controlling T&M instruments. Further information is available on
http://www.scpiconsortium.org/.
2
Virtual Instrument Software Architecture (VISA) as host PC software is a well-defined
hardware abstraction layer and I/O programming interface for various interfaces, e.g.
General Purpose Interface Bus (GPIB, IEEE 488.2) or Ethernet (VXI-11).
3
"Command completion" of current integrated development environments offers the
possibility to save time and avoid typing errors during programming (e.g. in C++ or C#).
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 4
Frequently Asked Questions (FAQ)
As one can imagine, for more complex T&M applications – such as generating or
measuring a mobile standard signal, e.g. for Wideband Code Division Multiple Access
(WCDMA) – using SCPI commands is quite time-consuming. Therefore, using
instrument drivers to set up your instrumentation avoids a lot of string formatting and
other data parsing. Moreover, the local grouping of functions within the provided
compressed HTML help file (chm file) offers you all configuration possibilities at a
glance.
Requirements can change during the lifetime of T&M applications. This is another
reason why instrument drivers can help you to modify an application. The logical
grouping of your instrument’s functionality makes it easy to extend or modify your
application on an abstract and logical level.
The described arguments in favor of simplifying your T&M task are a further reason for
reusing already written software. Due to the concept of instrument family drivers,
software written for research and development reasons on a high-end instrument such
®
as the R&S SMW or SMU200A vector signal generator can easily be reused for
®
production lines equipped with e.g. the mid-range R&S SMBV100A vector signal
generator. The instrument driver abstracts the instrument, so this software can often be
reused without any changes. Of course, the functionality needs to be supported on
both instruments.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 5
Frequently Asked Questions (FAQ)
All ROHDE & SCHWARZ instrument drivers require at least National Instruments
4
VISA (NI-VISA) revision 4.0 or later. For Linux it is strongly recommended to use the
5
latest version of NI-VISA. It is also possible to use the Agilent I/O Library Suite .
For Windows-based operating systems, this variable can be easily read out via
Windows command prompt using the command "set".
4
For further information please visit http://www.ni.com/visa.
5
For further information please visit http://www.agilent.com.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 6
Frequently Asked Questions (FAQ)
Note: With NI-VISA Version 4.2, the default installation path changed from C:\VXIPNP
to C:\Program Files\IVI Foundation\VISA, respectively C:\Program Files (x86)\IVI
6
Foundation\VISA for WoW64 .
http://www.rohde-schwarz.com/drivers.
Further specific steps and instructions for installing instrument drivers are available on
the driver download site available at the product Internet site.
6
Windows 32-bit On Windows 64-bit; A subsystem of the Windows operating system
to execute 32-bit applications on 64-bit Windows operating systems.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 7
Frequently Asked Questions (FAQ)
7
This feature requires support by the VISA library as well as support of the instrument
firmware. Please consult the operation manual to get further information on the HiSLIP
support of your ROHDE & SCHWARZ instrument.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 8
Best Practices for Software Development
Getting Started
http://www.rohde-schwarz.com/drivers
It is recommended to use the provided instrument driver compressed HTML help files
(chm files) for getting started.
A good approach is to use the provided application examples as a skeleton for new
applications.
The easiest way to find the proper driver function call is to find the SCPI command (in
the long version) in the instrument operating manual and to look for the command in
the Instrument Driver Help file using the index or search functionality.
For developing more complex applications, it is helpful to identify the manual operation
steps and utilize the "Instrument Driver Tree Structure" to find your driver function calls
for the manual configuration steps in this logical structure.
Information contained in the Instrument Driver Help file, also Driver Attribute Help
(rsXYZ[_vxi].chm)):
● Mapping of SCPI command and driver calls (and vice versa) via the search and
index functionality
● Grouped driver functions to easily identify all functions for a specific 3GPP
standard (Instrument Driver Tree Structure)
● For attribute-based drivers (with rsXYZ_attr.chm): mapping of attributes and driver
calls (see Fig. 1)
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 9
Best Practices for Software Development
Figure 1: Mapping of attributes and driver calls within the Driver Attribute Help section.
This feature is not available in all ROHDE & SCHWARZ instrument drivers.
A wrapper is necessary to enable a direct access to the driver dynamic linked library
(dll). This wrapper is automatically installed in the ~VXIplug&play\WinNT\include (or
~VXIplug&play64\Win64\include) directory, where VXIPNPPATH (or VXIPNPPATH64)
is the VXIplug&play environment variable pointing to your VXIplug&play installation
directory. Please note, that for the instruments that in the meantime have a IVI.NET – a
native .NET instrument driver available, the *.cs C# wrapper file is no more available in
the VXIplug&play driver installation. We encourage the user to switch to the native
.NET instrument driver.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 10
Best Practices for Software Development
Select your programming language and the template type, e.g. Visual C# Windows
Application or Console Application.
To access the instrument driver, you have to include the provided VXIplug&play
wrapper for C#, e.g. Project->Add Existing Item…
~VXIplug&play\WinNT\include\rsspecan.cs or
~VXIplug&play64\Win64\include\rsspecan64.cs for 64-bit applications.
Note: It is very important to explicitly specify the target platform for the solution using
the Configuration Manager. Either x86 for 32-bit application or x64 for 64-bit
applications.
Also the driver’s namespace has to be added to the current source code file, for
example via the directive "using InstrumentDrivers". The result is shown in Fig. 4:
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 11
Best Practices for Software Development
Now the development environment is configured in a proper way. For getting your
application development started, please refer to the examples provided on your
instrument's driver download site:
http://www.rohde-schwarz.com/drivers.
A wrapper is necessary to enable a direct access to the driver’s dynamic linked library
(dll). This wrapper is automatically installed in the ~VXIplug&play\WinNT\include (or
~VXIplug&play64\Win64\include\) directory, where VXIPNPPATH (or VXIPNPPATH64)
is the VXIplug&play environment variable pointing to your VXIplug&play installation
directory. Please note, that for the instruments that in the meantime have a IVI.NET – a
native .NET instrument driver available, the *.vb Visual Basic.NET wrapper file is no
more available in the VXIplug&play driver installation. We encourage the user to switch
to the native .NET instrument driver.
Select your programming language and your template type, e.g. Visual Basic Windows
Application or Console Application.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 12
Best Practices for Software Development
To access the instrument driver, you have to include the provided VXIplug&play
wrapper for VB.NET, e.g. Project->Add Existing Item…
~VXIplug&play\WinNT\include\rsspecan.vb or
(~VXIplug&play64\Win64\include\rsspecan64.vb)
Note: It is very important to explicitly specify the target platform for the solution using
the Configuration Manager. Either x86 for 32-bit application or x64 for 64-bit
applications.
Also the driver’s namespace has to be added to the current source code file via the
directive "Imports WindowsApplication1.rsspecan" (where rsspecan can be seen as an
example driver). The result is shown in Fig. 7:
Now the development environment is configured in a proper way. For getting your
application development started, please refer to the examples provided on your
instrument's driver download site:
http://www.rohde-schwarz.com/drivers.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 13
Best Practices for Software Development
Problem: The header file rsXYZ.h was not found while compiling
Solution: Set your VXIplug&play include directory in your Visual Studio Project
properties (see Fig. 8). The include directory is the ~VXIplug&play\WinNT\include (or
~VXIplug&play64\Win64\include\), where VXIPNPPATH (or VXIPNPPATH64) is your
VXIplug&play environment variable pointing to your VXIplug&play installation directory.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 14
Best Practices for Software Development
Problem: The library rsXYZ.lib was not found while building your software
project.
Solution: Set your VXIplug&play library path in your Visual Studio Project properties
(see Fig. 10). Your library directory is the ~VXIplug&play\WinNT\library\msc, where
VXIPNPPATH is your VXIplug&play environment variable pointing to your
VXIplug&play installation directory.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 15
Best Practices for Software Development
Problem: The instrument was not found and VISA resource string in NI-Spy has
only the size of one character
Solution: Correct your character settings in your Visual Studio Project properties (see
Fig. 11).
This section will help developers set up their development environment for easily
getting started without using instrument drivers.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 16
Best Practices for Software Development
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 17
General Programming Hints
where XYZ is instrument driver-specific. Please note that this function is not available
in all instrument drivers.
Note: In the Instrument Driver Tree Structure->Utilities folder of the instrument driver's
chm help file, you can check whether the command is available.
where XYZ is instrument driver-specific. Please note that this function is not available
in all instrument drivers.
Note: In the Instrument Driver Tree Structure->Utilities folder of the instrument driver's
chm help file, you can check whether the command is available.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 18
General Programming Hints
Instead of using the rsXYZ_Init (…) function to initialize a driver session, a second
function is available. In the LabWindows/CVI instrument driver the function is called:
Note: In the Instrument Driver Tree Structure->Utilities folder of the instrument driver's
chm help file, you can check whether the command is available. This function is not
available in all instrument drivers.
To improve execution time in many drivers, error status checking can be disabled. To
do so, disable error/status checking; see section 4.2 for details.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 19
Hints on How to Get Started with Attribute-Based Instrument Drivers
It is important to realize that not every ROHDE & SCHWARZ instrument driver is an
attribute-based driver.
5.1.1 How to Run a Scan Measurement with the R&S®ESL EMI Test
Receiver and the rsspecan Instrument Driver
Find the necessary commands in the rsspecan_vxi.chm help file. Crucial for a
continuous reading of the scan trace is the following function:
rsspecan_ConfigureReceiverTraceFeedControl
(instrSession, RSSPECAN_VAL_TRAC_FEED_ALWAYS);
For further information, please refer to the scan measurement example application on
the instrument's driver download site.
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 20
Related Document
6 Related Document
Application Note 1MA170: Introduction to Attribute Based Instrument Drivers
http://www.rohde-schwarz.com/appnote/1MA170.html
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 21
Resources
7 Resources
● ROHDE & SCHWARZ Instrument Driver Download Site: http://www.rohde-
schwarz.com/drivers
● ROHDE & SCHWARZ Remote Control Knowledge Base: http://www.rohde-
schwarz.com/rckb
● National Instruments VISA: http://www.ni.com/visa/
● National Instruments LabVIEW: http://www.ni.com/labview/
● National Instruments LabWindows/CVI: http://www.ni.com/lwcvi/
● IVI Foundation: http://www.ivifoundation.org/
1MA153_11e Rohde & Schwarz Development Hints and Best Practices for Using Instrument Drivers 22
About Rohde & Schwarz
Rohde & Schwarz is an independent
group of companies specializing in
electronics. It is a leading supplier of
solutions in the fields of test and
measurement, broadcasting,
radiomonitoring and radiolocation, as well
as secure communications. Established
more than 75 years ago, Rohde &
Schwarz has a global presence and a
dedicated service network in over 70
countries. Company headquarters are in
Munich, Germany.
Environmental commitment
● Energy-efficient products
● Continuous improvement in
environmental sustainability
● ISO 14001-certified environmental
management system
Regional contact
USA & Canada
USA: 1-888-TEST-RSA (1-888-837-8772)
from outside USA: +1 410 910 7800
[email protected]
East Asia
+65 65 13 04 88
[email protected]
Rest of the World
+49 89 4129 123 45
[email protected]
www.rohde-schwarz.com