0% found this document useful (0 votes)
191 views23 pages

1MA170 0e

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. Moreover the use of attributes is shown for the Rohde and Schwarz Spectrum Analyzer (rsspecan) instrument driver.

Uploaded by

nirmalk_87
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views23 pages

1MA170 0e

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. Moreover the use of attributes is shown for the Rohde and Schwarz Spectrum Analyzer (rsspecan) instrument driver.

Uploaded by

nirmalk_87
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Introduction to Attribute Based

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.

Jiri Kominek, Juergen Straub


23 July 2010-1MA170_0e
Introduction to Attribute Based
Instrument Drivers
Table of Contents

Table of Contents
1 VXIplug&play Instrument Drivers ......................................... 3
1.1 Preface...........................................................................................................3
1.2 The Definition of Instrument Drivers ..........................................................4

2 Attribute Based Instrument Drivers...................................... 5


2.1 Attribute Access Functions.........................................................................6
2.2 Attributes and its Data Types......................................................................6
2.2.1 Implementation of Attributes in C...............................................................7
2.2.2 Implementation of Attributes in LabVIEW .................................................8
2.3 Range Table ..................................................................................................8
2.4 Repeated Capabilities ..................................................................................8
2.5 Range Checking ...........................................................................................9
2.6 Instrument Status Checking........................................................................9
2.7 Multithread Safety ........................................................................................9
2.8 Events ............................................................................................................9

3 Use of Rohde & Schwarz Attribute Instrument Drivers .... 10


3.1 How to use attributes in LabVIEW ............................................................10
3.1.1 Repeated capabilities .................................................................................13
3.2 How to use attributes in LabWindows/CVI ..............................................13
3.2.1 Repeated capabilities .................................................................................16
3.3 How to use attributes in Microsoft Visual Studio using C# ...................16
3.3.1 Repeated capabilities .................................................................................19

4 Related Documents.............................................................. 20

5 References............................................................................ 21

6 Ordering Information ........................................................... 22

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 2


VXIplug&play Instrument Drivers

1 VXIplug&play Instrument Drivers

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

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 3


VXIplug&play Instrument Drivers

They needed to decrease the time required to program instruments, facilitating


instrument interchangeability and easing system maintenance. Rather than trying to
solve the problems by standardizing the instruments from all suppliers, both users and
vendors began to take advantage of new computer science technology to address the
issues by making software more modular and flexible.

1.2 The Definition of Instrument Drivers


An instrument driver, in the simplest definition, is a set of software routines that
handles the programmatic details of controlling and communicating with a specific
instrument. The most successful instrument driver concepts have always distributed
instrument drivers in source code and provided end users with access to the same
tools developers use to write drivers. With this philosophy, new instrument drivers were
often easily developed by end users through modifying an existing driver for another
instrument. End users, in general, had come to view the availability of an instrument
driver as an important factor in the choice of a particular instrument. However, users
still had access to standard instrument driver development tools and source codes for
other instruments.
VXIplug&play instrument drivers are defined by VXIplug&play Systems Alliance
[VXIplug&play Systems Alliance], which is part of the IVI (Interchangeable Virtual
Instrument) Foundation [Interchangeable Virtual Instrument Foundation] since 2002.
These drivers offer a simple API (application programming interface) using non
structured data types. This API is defined by a so called “function panel file” which
contains graphical panels. Each of these panels is representing a function's prototype.
Functions are designed to group several instrument's parameters which are logically
tied one to each other. It allows the driver's user to make instrument setup or
measurement in less steps compared to sending SCPI commands using low-level or
VISA functions [Virtual Instrument Software Architecture]. On the other hand, there are
cases where access to specific commands is needed.
Modern instruments capable of measuring, generating and analyzing advanced
signals, such as WiMAX 2 or LTE 3 , are very complex and sometimes it may be
necessary to configure only a single parameter of the instrument, usually because of
speed (either speed of software execution or speed of instrument's internal
reconfiguration and measurement). Formerly this contradiction was solved by sending
SCPI commands directly using either VISA low level functions like the VISA
Read/Write, or utilizing the function of the driver that is configuring this parameter.
However, issues like instrument state synchronization or error checking needs to be
solved by the user. To avoid mixing two different programming techniques new drivers
have been designed with layered API consisting of low level and high level functions.
Low level functions are usually using only one SCPI command. High level functions are
then calling into several low level functions according to its parameters. While this API
structure allows the user to benefit from both having well organized high level functions
and having low level functions, it leads to high number of exported functions (and VIs
4
in case of LabVIEW instrument drivers).
Rohde & Schwarz offers a new approach to balance the instrument driver's API called
Attribute Based Instrument Drivers.

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/

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 4


Attribute Based Instrument Drivers

2 Attribute Based Instrument Drivers


An attribute can be defined as an element of a hardware configuration of an instrument
or a software configuration of an instrument driver. Thus each instrument setting is
associated with a hardware configuration attribute.
In general an attribute based driver is a standard VXIplug&play instrument driver. It can
be used as a traditional single layer instrument driver. However, if the user needs to
configure or measure a single parameter which is part of complex high level function,
he does not have to directly use a SCPI command, but can use the appropriate
attribute access function. For instance the high level function of the R&S®Spectrum
Analyzer Instrument Driver (rsspecan 5 ) for configuring the sweep coupling sets three
parameters: the resolution- and the video bandwidth, as well as the sweep time. So for
example to configure only the resolution bandwidth the corresponding attribute can be
used (illustrated in the figure below step a) and step aa)).
Attribute based drivers are leveraging the best from both VXIplug&play instrument
drivers and IVI-C instrument drivers. Low level functionality is implemented in the same
way as in IVI-C drivers via attributes. The high level driver functions are similar to the
IVI standard, but not limited to the restrictions of the IVI class definition, like strict
definition of function names, number of arguments and its names of functions which
are following the IVI class specification.
Most high level functions are implemented using attributes as well. In this case also the
shown steps a) and aa) are executed when calling one of theses high level functions.
However, not all instrument commands can be implemented as attributes, thus some
functions are not using attributes, but are implemented in the traditional way, as
already mentioned above. In that case the shown step b) is executed. For instance all
functions, which have arrays as part of their API, fall into this category, for example a
recorded trace of a spectrum.

Figure 1: Architecture of R&S attribute based instrument drivers

5
The rsspecan instrument driver is available the Rohde & Schwarz driver download
area.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 5


Attribute Based Instrument Drivers

2.1 Attribute Access Functions


When a high level function in an instrument driver queries or modifies the current
setting of an attribute, it does so by calling one of the Rs_GetAttribute or
Rs_SetAttribute functions. Each driver contains five prefix_GetAttribute functions and
five prefix_SetAttribute functions, one for each possible attribute data type. These are
called typesafe functions.
Each driver also exports five typesafe prefix_CheckAttribute functions. Instrument
drivers can call these functions to verify that a particular value is valid for an attribute.
This allows users to bypass the high-level functions in instrument drivers and directly
query and modify the values of instrument attributes. The prefix_GetAttribute,
prefix_SetAttribute, and prefix_CheckAttribute functions are merely wrappers around
calls to the Rs_GetAttribute, Rs_SetAttribute, and Rs_CheckAttribute functions.

2.2 Attributes and its Data Types


Attributes can be grouped into two categories – hardware configuration attributes and
software control attributes. Generally, each instrument setting is associated with a
hardware configuration attribute. Hardware configuration attributes allow the user to set
and query values of the associated instrument settings. Software control attributes
control how the instrument driver works rather than representing particular instrument
settings. That allow users to enable and disable features such as range checking and
instrument status checking. Attributes are used in conjunction with the most used data
types:
• ViBoolean
• ViInt32
• ViReal64
• ViString
• ViSession

SCPI command with enumerated string argument (e.g.


[SENSe<1|2>:]AVERage:TYPE VIDeo | LINear | POWer) are realized by an
attribute of data type ViInt32 and proper range table (see image below).

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 6


Attribute Based Instrument Drivers

®
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.

2.2.1 Implementation of Attributes in C

Attributes are implemented as global data structures defined in file 'prefix_attributes.c'.


Because all drivers are distributed in source code, users can freely modify, remove or
add any attribute, range table and repeated capabilities. Data structures are interpreted
by the core, which is implemented in files ‘rsidr_core.c’ and ‘rsidr_core.h’. These two
files are always the same for all Rohde & Schwarz attribute drivers, thus when
combining source codes of two different drivers these two files need to be added to the
project once. Using attributes in the C-based LabWindows/CVI 6 environment is
described in chapter 3.2.

6
For details on National Instrument LabWindows/CVI please visit
http://www.ni.com/lwcvi/

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 7


Attribute Based Instrument Drivers

2.2.2 Implementation of Attributes in LabVIEW

Similarly to C implementation, attributes and range tables in LabVIEW are


implemented as a global array of clusters, each representing either attribute or class
(indicated by boolean indicator 'Class only'). To speed up the search of attributes and
range tables the driver uses predefined sorted hash tables. Global data is used by a
core, which is unique for each instrument (to avoid using references it was decided to
link global data with the instrument driver). Using attributes in LabVIEW is described in
chapter 3.1.

2.3 Range Table


An Attribute can have its range table which defines the attribute's valid values. There
are three types of range tables:
● Ranged - valid values are defined as a closed interval of integer or floating point
values (according to the range table's data type). The number of marker available
on a spectrum analyzer can be named as example.
● Coerced - valid values are defined as a discrete set of numbers. If this range table
is associated with an attribute, then the attribute values are coerced to the nearest
value listed in the coerced range table. For example the number of sweep points of
a spectrum can be limited to an increment of 100 for number of points equal or
greater than 201.
● Discrete - valid values are defined as a discrete set of numbers. No coercion
applies. This range table is also used for mapping of integer constant values to
enumerated string command arguments. For instance the string ‘VIDeo’, which
needs to be sent to the instrument can be mapped to the symbolic constant
PREFIX_VAL_AVERAGE_TYPE_VIDEO with integer value (0 for instance).

2.4 Repeated Capabilities


Many instruments contain multiple instances of the same type of functionality. For
example, many instruments have multiple channels, windows or traces with
independent settings. The general term for functionality that is duplicated in an
instrument is repeated capability. Repeated capabilities can be complex. An instrument
may have multiple sets of repeated capabilities, such as windows and traces, or
markers. Also, repeated capabilities may be nested within other repeated capabilities,
for example traces within displays.
Repeated capability instances are specified by a string parameter to each function that
accesses the repeated capability or by a function that selects the active instance.
Attribute access functions are provided with a string parameter which selects the
capability to be used by function. To define the usage of a particular capability fill the
string with a proper value. To use more than one repeated capability in one attribute,
separate them with comma.
The attribute access functions include a repeated capability selector parameter for use
with channel-based attributes or attributes of repeated capabilities. When using
attribute access functions on attributes (see chapter 2.1) that do not apply to repeated
capabilities, application programs pass VI_NULL or an empty string for the parameter.
An example is given in chapter 3.1 and chapter 3.2.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 8


Attribute Based Instrument Drivers

2.5 Range Checking


If range checking is enabled, the driver checks that input parameters are within the
valid range for the instrument. Range checking is most useful during debugging. After
users have validated their programs, they can disable range checking to maximize
performance.

2.6 Instrument Status Checking


If instrument status checking is enabled, the driver automatically checks the status of
the instrument after most operations. If the instrument indicates an error condition, the
driver returns a special error code. The user then calls the error query function to
retrieve the instrument specific error code from the instrument.
Instrument status checking is most useful during debugging. Once application
development is complete, this feature can be disabled to maximize performance.

2.7 Multithread Safety


Rohde & Schwarz attribute drivers are multithread safe. Multithread safety means that
multiple threads in the same process can use the same driver session and that
different sessions of the same IVI driver can run simultaneously on different threads.
To access a driver session from multiple threads, the application initializes the driver in
one thread and then shares the session handle or object with other threads. If an
application wants to treat several calls to a driver as a single operation that other
threads must not interfere with, the application must block other threads during the
sequence of calls. The application can do this by using synchronization functions
provided by the operating system or programming environment. Locking inside of a
driver has not yet been implemented.
Multithread safety does not provide any mechanism to allow multiple processes to
share the same session. It also does not provide any mechanism to synchronize
between multiple threads or processes that open multiple sessions on the same
physical instrument. To synchronize access to the same physical instrument from
multiple processes, applications must use its own resource locking.

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.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 9


Use of Rohde & Schwarz Attribute Instrument Drivers

3 Use of Rohde & Schwarz Attribute


Instrument Drivers
The following example is referring to the rsspecan instrument driver. The described
procedures are all adaptable to other attribute based R&S instrument drivers, only the
naming of the files can be different. The naming convention is rsXXX, where XXX is
the abbreviation of the instrument's (-family) driver.

3.1 How to use attributes in LabVIEW


This chapter explains how to use attributes in the rsspecan instrument driver. This is
necessary for instance if the driver is not supporting the functionality via high level API.

Please also use the Driver Attribute Help chm file. This help file is accessible via the
Instruments Driver Help (e.g. rsspecan.chm).

Example: How to set the Frequency Start value by attributes

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

Figure 3: Palette Menu of Rsspecan driver

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).

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 10


Use of Rohde & Schwarz Attribute Instrument Drivers

Figure 4: Front panel of rsspecan_core_attribute_express Source.vi

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).

For example use in Basic Operation "Set Frequency Start" value:

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 11


Use of Rohde & Schwarz Attribute Instrument Drivers

Figure 5: Configure "Set Frequency Start" example

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.

The result of the procedure is shown in following figure:

Figure 6: Instanced attribute based VI "Set Frequency Start"

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 12


Use of Rohde & Schwarz Attribute Instrument Drivers

3.1.1 Repeated capabilities

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:

Figure 7: Example for "Repeated Capabilities"

The attribute and its features can be changed any time later by double clicking the VI,
which recalls the shown Express VIs front panel.

3.2 How to use attributes in LabWindows/CVI


This chapter explains how to use attributes in the rsspecan instrument driver. This is
necessary for instance if the driver is not supporting the functionality via high level API.

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.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 13


Use of Rohde & Schwarz Attribute Instrument Drivers

Example: How to set the Frequency Start value by 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

Figure 8: Function panel for Rsspecan driver attributes

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].

For example use in Basic Operation "Set Frequency Start" value:

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 14


Use of Rohde & Schwarz Attribute Instrument Drivers

Figure 9: How to select an attribute in the "SetAttributeViReal64" function panel

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.

The result of this procedure is shown in following figure.

Figure 10: Build a function string on the button of the "rsspecan_SetAttributeViReal64" function
panel

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 15


Use of Rohde & Schwarz Attribute Instrument Drivers

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:

Figure 11: Recalling the function panel to modify the attributes

3.2.1 Repeated capabilities

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:

Figure 12: Example for "Repeated Capabilities" in LabWindows/CV

The attribute and its features can be changed any time later by recalling the function
panel, which recalls the shown panel.

3.3 How to use attributes in Microsoft Visual Studio


using C#
This chapter explains how to use attributes in the rsspecan instrument driver in
Microsoft Visual Studio 2008. This is necessary for instance if the driver is not
supporting the functionality via high level API.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 16


Use of Rohde & Schwarz Attribute Instrument Drivers

In the following examples the programming language C# is used.

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.

Example: How to set the Center Frequency value by attributes

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.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 17


Use of Rohde & Schwarz Attribute Instrument Drivers

Figure 13: Documentation of available attributes in the rsspecan instrument driver.

C# attributes are accessible through the enum rsspecanProperties which is


defined in the namespace InstrumentDrivers of the wrapper file rsspecan.cs.

For example use in Basic Operation the "Center Frequency" attribute


rsspecanProperties.FrequencyCenter (called
RSSPECAN_ATTR_FREQUENCY_CENTER in the VXIplug&play chm help file) for
configuring the center frequency as shown in the listing 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;

//Open driver session


rsspecan m_specAn = new rsspecan(resourceName, idQuery,
resetDevice);

//center frequency 1GHz


double centerFrequency = 1e9;
m_specAn.SetDouble(rsspecanProperties.FrequencyCenter,
centerFrequency);

//...insert more configuration and measurements here


//Close driver session
m_specAn.Dispose();
m_specAn = null;
}
}
}

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 18


Use of Rohde & Schwarz Attribute Instrument Drivers

3.3.1 Repeated capabilities

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.

To define the usage of particular capability, following overloaded functions are


provided by the C# wrapper file rsspecan.cs:

● 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:

//repeated capabilty example


//set a marker to a specfic frequency
double freqPosition = 1.5e9;
m_specAn.SetDouble(rsspecanProperties.MarkerPosition, "Win0,M1", freqPosition);

The figure below outlines the “Supported Repeated Capabilities” of the attribute
rsspecanProperties.MarkerPosition (called RSSPECAN_ATTR_MARKER_POSITION
in the rsspecan.chm help file).

Figure 14: Marker example to explain repeated capabilities

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 19


Related Documents

4 Related Documents
• Application Note 1MA153: Development Hints and Best Practices for Using
Instrument Drivershttp://www.rohde-schwarz.com/appnote/1MA153.html

• Automatic Measurement Control, A tutorial on SCPI and IEEE 488.2; John M.


Pieper; Rohde&Schwarz GmbH & Co. KG

• 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

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 20


References

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

(2) The SCPI Consortium


http://www.ivifoundation.org/scpi/default.aspx
Note: Became part of the IVI Foundation in 2002

(3) The SCPI Standard


http://www.ivifoundation.org/docs/SCPI-99.pdf

(4) VXIplug&play Systems Alliance


http://www.ivifoundation.org/VXIPlug_Play/default.aspx
Note: Became part of the IVI Foundation in 2002

(5) Interchangeable Virtual Instrument Foundation (IVI Foundation)


http://www.ivifoundation.org/

(6) Virtual Instrument Software Architecture (VISA)


http://www.ivifoundation.org/specifications/default.aspx

(7) IVI Driver Architecture Specification


http://www.ivifoundation.org/specifications/default.aspx

1MA170_0e Rohde & Schwarz Introduction to Attribute Based Instrument Drivers 21


Ordering Information

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.

1MA170_0e Rohde & Schwarz Introduction to Attribute Based 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
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 137 74
[email protected]

This white paper and the supplied


programs may only be used subject to the
conditions of use set forth in the download
area of the Rohde & Schwarz website.

R&S® is a registered trademark of Rohde &


Schwarz GmbH & Co. KG. Trade names are
trademarks of the owners.

Rohde & Schwarz GmbH & Co. KG


Mühldorfstraße 15 | D - 81671 München
Phone + 49 89 4129 - 0 | Fax + 49 89 4129 – 13777

www.rohde-schwarz.com

You might also like