1MA170 0e
1MA170 0e
Instrument Drivers
White Paper
Products:
| R&S®FSH4/8 | R&S®FSUP
| R&S®FSC | R&S®ESL
| R&S®FSP | R&S®ZVL
| R&S®FSQ | R&S®ETL
| R&S®FSU | R&S®SFE
| R&S®FSMR | R&S®SFU
| R&S®FSQ | R&S®CMW
| R&S®FSL
This white paper introduces a novel
attribute based architecture for
VXIplug&play instrument drivers. The
presented architecture uses the attribute
based concept of IVI-C instrument drivers
to introduce a two-layer design for
VXIplug&play instrument drivers.
Moreover the use of attributes is shown for
the Rohde & Schwarz Spectrum Analyzer
(rsspecan) instrument driver.
Table of Contents
1 VXIplug&play Instrument Drivers ......................................... 3
1.1 Preface...........................................................................................................3
1.2 The Definition of Instrument Drivers ..........................................................4
4 Related Documents.............................................................. 20
5 References............................................................................ 21
1.1 Preface
The task of programming instruments in a test system has always been a concern for
end users and a major cost for the overall system development. Many users know that
programming can often be the most time-consuming part of developing a system. The
developer spends much valuable time learning the specific programming requirements
of each instrument in the system. Almost all instruments are designed for interactive
use through a physical front panel and also offer remote control capability via a
communication port on the back of the instrument. The details for how to program the
instrument remotely are usually documented in the instrument manual in the form of
ASCII command sets that cause the instrument to perform the desired operation.
Documenting an instrument command set in the user manual, along with some
example program listings, has traditionally been the standard method for an instrument
vendor to assist the end user in programming the instrument. These documentation
methods have served the industry well for many years, but this approach still places
the responsibility for writing the program code on the user, many of whom may end up
writing very similar application programs.
If the same command works for multiple instruments, regardless of the manufacturer,
users can interchange or upgrade instruments and reduce the amount of changes to
their application programs. In particular, many of the installed base of users who had
substantial investments in their software environments, that did not easily lend
themselves to software modularity, lobbied for this approach. Through the mid to late
1980s, many standard organizations, including the IEEE, worked on this objective with
little progress. The IEEE 488.2 specification [ANSI/IEEE Std 488.1-1987], completed in
1987, more carefully defined the operation of instruments like the program message
exchange protocol, but did not address the issue of standard command sets.
In 1990, the SCPI 1 Consortium [The SCPI Consortium] was formed, which became
part of IVI Foundation in 2002. This organization approved a specification for
standardized commands for message-based programmable instruments. The SCPI
Consortium is not active anymore and the last updated document was published in
1999 [The SCPI Standard]. While more and more companies continue to endorse the
SCPI standard and use it in their new instrument designs, still many instruments
available today do not use this standard command set. In addition, while many users of
SCPI instruments appreciated the progress and have experienced improvement in
productivity once they learn the standard command set, instrument interchangeability
is still not a reality because most instruments have different, often unique functionality
and therefore a command set different to the SCPI standard command set. Moreover
syntactically equal SCPI commands are a necessary, but not a sufficient condition for
instrument interchangeability.
While the SCPI standard is certainly recognized by the entire industry as a step
forward, the lack of progress on this issue encouraged both users and vendors to
explore other approaches before SCPI was completed.
1
Standard Commands for Programmable Instruments
2
For details on WiMAX please visit http://www.rohde-
schwarz.com/appnote/1MA96.html
3
For details on LTE please visit http://www.rohde-schwarz.com/appnote/1MA111.html
4
For details on National Instrument LabVIEW please visit http://www.ni.com/labview/
5
The rsspecan instrument driver is available the Rohde & Schwarz driver download
area.
®
Figure 2: LabVIEW example for attributes for a SCPI command used in the R&S Spectrum
Analyzer Instrument Driver (rsspecan)
For instance a SCPI command with more than one argument can’t be implemented as
attributes, but instead are implemented as high level functions. The same is also true
for SCPI commands which are dealing with data sets. In the R&S®Spectrum Analyzer
Instrument Driver for example, the function for reading a Y-trace of a spectrum
analyzer is implemented in that way.
6
For details on National Instrument LabWindows/CVI please visit
http://www.ni.com/lwcvi/
2.8 Events
Events are basically attributes with no data. This is different to IVI driver specification
which does not allow implementation of events via attribute engine. Events in Rohde &
Schwarz drivers are realized using prefix_SetAttributeViString with VI_NULL or an
empty string in place of the string argument.
Please also use the Driver Attribute Help chm file. This help file is accessible via the
Instruments Driver Help (e.g. rsspecan.chm).
To select an attribute use the provided Express VI, included in the instrument driver
package. This instrument driver Express VI can be found in:
User Libraries => Express User Libraries => rsspecan
Drag and drop the rsspecan Core Attribute Express Source.vi in your block diagram.
After placing the express VI the front panel of the Express VI will be opened (see figure
below).
Now select the desired attribute from the tree structured list. Each attribute has a
different access type (read only, write only or read/write). Proper read/write operation
can be selected by Attribute Operation in the bottom left corner.
Repeated capabilities are set by using a string control at the bottom of the panel called
Repeated Capabilities (e.g. TR1 referring to trace 1). The attribute value is entered
using standard LabVIEW controls for each data type (numeric, boolean, string or ring).
1. Select the desired attribute. To find the designated attribute easily the
rsspecan.chm help file can be used to look for it. Be aware of the fact that the tree
structures in the help file and the Express VI are the same.
2. Leave the Repeated Capabilities box empty.
3. Type the desired frequency value in the text box Value.
4. After clicking the OK button, a new instance of an attributed based VI is generated.
The name of the VI and its predefined values and also the help will be adapted.
Repeated capability instances are specified by a string parameter for each property.
Also it can be specified by a function which selects the active instance.
To define the usage of particular capability fill the text box Repeated Capability in the
front panel of the Express VI with the proper value. To use more than one repeated
capability in one attribute separate them with a comma.
See a marker example using repeated capabilities pictured in the following figure:
The attribute and its features can be changed any time later by double clicking the VI,
which recalls the shown Express VIs front panel.
Please use the Driver Attribute Help chm file. This help file is accessible via the
Instruments Driver Help (e.g. rsspecan_vxi.chm).
The file rsspecan.sub has to be added to the project. This file mandatory for browsing
attributes.
To select an attribute use the provided function panels, included in the instrument
driver package. This instrument driver function panels can be found in:
Instruments=>R&S SpecAn=>Configuration=>Set/Get/Check Attribute/Repeated
Capabilities
To open the function panel double click on the desired function. In the figure below the
function panel of "rsspecan_SetAttributeViReal64" is pictured. By clicking on the text
box "Attribute ID" the "Select Attribute Constant" window will be opened.
Now you can select the desired attribute from the tree structured list. Each attribute
can have a different access type (read only, write only or read/write). Proper read/write
operation can be selected by the proper function panel, either Set Attribute, Get
Attribute, or Check Attribute.
Repeated capabilities are set by using identifier or identifier names within the function
panel called rsspecan_GetAttributeRepeatedCapabilityId[s|Names].
1. Please select the desired attribute. To find the designated attribute easily the
rsspecan.chm help file can be used to look for it. Be aware of the fact that the tree
structures in the help file and the Express VI are the same
2. Leave the Repeated Capabilities text box empty
3. Type the desired frequency value in the text box Attribute Value, e.g. "1e+9"
4. Enter a valid instrument handle in the text box Instrument Handle
5. It is strongly recommended to evaluate the return value of your function, if you type
the name of a declared integer variable in the text box Status
6. To include the function into your source code, you can copy the created function
string out of the window on the button of the function panel and insert it into the
source code.
Figure 10: Build a function string on the button of the "rsspecan_SetAttributeViReal64" function
panel
The attribute and its features can be changed at any time later by right clicking the
function and recalling the function panel. See picture below:
Repeated capability instances are specified by a string parameter for each property. It
also can be specified by a function which selects the active instance.
To define the usage of particular capability fill the text box Repeated Capability in the
front panel of the Express VI with the proper value. To use more than one repeated
capability in one attribute separate them with a comma.
See a marker example using repeated capabilities pictured in the following figure:
The attribute and its features can be changed any time later by recalling the function
panel, which recalls the shown panel.
The file rsspecan.cs has to be added to the project. This file comes together with the
VXIplug&play driver and is a prerequisite for using the driver in C#.
To control an instrument via an attribute use one of the provided get and set-functions
of the C# wrapper. The available functions can be found in following list:
● SetInt32 (rsspecan_SetAttributeViInt32)
● GetInt32 (rsspecan_GetAttributeViInt32)
● SetDouble (rsspecan_SetAttributeViReal64)
● GetDouble (rsspecan_GetAttributeViReal64)
● SetBoolean (rsspecan_SetAttributeViBoolean)
● GetBoolean (rsspecan_GetAttributeViBoolean)
● SetString (rsspecan_SetAttributeViString)
● GetString (rsspecan_SetAttributeViString)
● SetSession (rsspecan_SetAttributeViSession)
● GetSession (rsspecan_GetAttributeViSession)
The respective functions and their documentation can be found in the Instruments
Driver Help in Instrument Driver Tree Structure=>Configuration=>Set/Get/Check
Attribute/Repeated Capabilities referring to listed function names in the brackets
above.
This example shows how to use attributes without repeated capabilities. The use of
repeated capabilities is described in chapter 3.3.1.
To find proper attributes for specific configurations the rsspecan_vxi.chm help file can
be used. All available attributes are listed in the chapter Instruments Driver Help in
Driver Attribute Help chapter, see figure below.
using InstrumentDrivers;
namespace rsspecan_Application_Example
{
class Program
{
static void Main(string[] args)
{
string resourceName = "TCPIP::FSP7-100894::INSTR";
bool idQuery = true;
bool resetDevice = true;
Repeated capability instances are specified by a string parameter for each property. It
can also be specified by a function which selects the active instance.
● SetInt32 (rsspecan_SetAttributeViInt32)
● GetInt32 (rsspecan_GetAttributeViInt32)
● SetDouble (rsspecan_SetAttributeViReal64)
● GetDouble (rsspecan_GetAttributeViReal64)
● SetBoolean (rsspecan_SetAttributeViBoolean)
● GetBoolean (rsspecan_GetAttributeViBoolean)
● SetString (rsspecan_SetAttributeViString)
● GetString (rsspecan_SetAttributeViString)
See a marker example using repeated capabilities pictured in the following example:
The figure below outlines the “Supported Repeated Capabilities” of the attribute
rsspecanProperties.MarkerPosition (called RSSPECAN_ATTR_MARKER_POSITION
in the rsspecan.chm help file).
4 Related Documents
• Application Note 1MA153: Development Hints and Best Practices for Using
Instrument Drivershttp://www.rohde-schwarz.com/appnote/1MA153.html
• IEEE Std 488.2-1992 IEEE Standard Codes, Formats, Protocols, and Common
Commands for Use With IEEE Std 488.1-1987, IEEE Standard Digital Interface for
Programmable Instrumentation
http://standards.ieee.org/reading/ieee/std_public/description/im/488.2-
1992_desc.html
5 References
(1) ANSI/IEEE Std 488.1-1987 IEEE Standard Digital Interface for Programmable
Instrumentation
http://standards.ieee.org/reading/ieee/std_public/description/im/488.1-
1987_desc.html
6 Ordering Information
Ordering Information
National Instruments VISA Library
NI VISA I/O Library Version 4.6.2 1310.0054.02
Please contact your local Rohde & Schwarz sales office for further assistance.
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 137 74
[email protected]
www.rohde-schwarz.com