LabVIEW Programming
Interfacing with your Zurich Instruments device via National Instruments' LabVIEW® is an efficient choice in terms of development time and run-time performance. LabVIEW is a graphical programming language designed to interface with laboratory equipment via so-called VIs ("virtual instruments"), whose key strength is the ease of displaying dynamic signals obtained from your instrument.
This chapter aims to help you get started using the Zurich Instruments LabOne LabVIEW API to control your instrument.
This section and the provided examples are not intended to be a general LabVIEW tutorial. See, for example, the National Instruments website for help to get started programming with LabVIEW. |
Installing the LabOne LabVIEW API
Requirements
One of the following platforms and LabVIEW versions is required to use the LabOne LabVIEW API:
-
Windows with 32- or 64-bit LabVIEW 2009 or newer.
-
Linux with 64-bit LabVIEW 2010 or newer.
-
macOS with LabVIEW 2010 or newer.
The LabOne LabVIEW API is included in a standard LabOne installation and is also available as a separate package (see below, Separate LabVIEW Package). In order to make the LabOne LabVIEW API available for use within LabVIEW, a directory needs to be copied to a specific directory of your LabVIEW installation. Both the main LabOne installer and the separate LabOne LabVIEW API package are available from Zurich Instruments' download page.
Separate LabVIEW Package
The separate LabVIEW API package should be used if you would like to either:
|
Windows Installation
-
Locate the
instr.lib
directory in your LabVIEW installation and delete any previous Zurich Instruments API directories. Theinstr.lib
directory is typically located at:C:\Program Files\National Instruments\LabVIEW 201x\instr.lib\
Previous Zurich Instruments installations will be directories located in the
instr.lib
directory that are named either:-
Zurich Instruments HF2
, or -
Zurich Instruments LabOne
These folders may simply be deleted (administrator rights required).
-
-
On Windows, either navigate to the
API\LabVIEW
subdirectory of your LabOne installation or, in the case of the separate installer (see Separate LabVIEW Package), the directory of the unzipped LabOne LabVIEW package, and copy the subdirectoryZurich Instruments LabOne
to the
instr.lib
directory in your LabVIEW installation as located in Step 1. Note, you will need administrator rights to copy to this directory.In the case of copying from a LabOne installation, this folder is typically located at:
C:\Program Files\Zurich Instruments\LabOne\API\LabVIEW\
-
Restart LabVIEW and verify your installation as described in Verifying your Installation.
Linux and Mac Installation
-
Locate the
instr.lib
directory in your LabVIEW installation and remove any previous Zurich Instruments API installations. Theinstr.lib
directory is typically located on Linux at:/usr/local/natinst/LabVIEW-201x/instr.lib/
and on macOS at:
/Applications/National Instruments/LabVIEW 201x/instr.lib/
Previous Zurich Instruments installations will be folders located in the
instr.lib
directory that are named either:-
Zurich Instruments HF2
, or -
Zurich Instruments LabOne
.
These folders may simply be deleted (administrator rights required).
-
-
Navigate to the path where you unpacked LabOne or the Separate LabVIEW Package and copy the subdirectory
Zurich Instruments LabOne/
to the
instr.lib
directory in your LabVIEW installation as located in Step 1. Note, you will need administrator rights to copy to this directory.Note, when copying from the main LabOne tarball (Linux only), the
Zurich Instruments LabOne/
directory is located in[PATH]/LabOneLinux64/API/LabVIEW/
-
Restart LabVIEW and verify your installation as described in Verifying your Installation.
Verifying your Installation
If the LabOne LabVIEW API palette can be accessed from within LabVIEW, the LabOne LabVIEW API is correctly installed. See Locating the LabOne LabVIEW VI Palette for help finding the palette.
Getting Started with the LabOne LabVIEW API
Locating the LabOne LabVIEW VI Palette
In order to locate the LabOne LabVIEW VIs start LabVIEW and create a new VI. In the VI’s "Block Diagram" (CTRL-e) you can to access the LabOne LabVIEW API palette with a mouse right-click and browsing the tree under "Instrument I/O" → "Instr. Drivers", see Figure 1.

LabOne LabVIEW Programming Concepts
As described in LabOne Software Architecture a LabVIEW program communicates to a Zurich Instrument device via a software program running on the PC called the data server. In general, the outline of the instruction flow for a LabVIEW virtual instrument is as following:
-
Initialization: Open a connection from the API to the data server program.
-
Configuration: Perform the instrument’s settings. For example, using the virtual instrument
ziSetValueDouble.vi
. -
Data: Read data from the instrument.
-
Utility: Perform data analysis on the read data, potentially repeating Step 2 and/or Step 3.
-
Close: Terminate the API’s connection to the data server program.
The VI Tree.vi
included the LabOne LabVIEW API demonstrates this flow
and lists common VIs used for working with a Zurich Instruments device,
see Figure 2. The VI Tree.vi
can be found either via the LabOne VI palette, see
Locating the LabOne LabVIEW VI Palette , or by opening the file in the Public
folder of
your LabOne LabVIEW installation, typically located at:
C:\Program Files\National Instruments\LabVIEW 2012\instr.lib\Zurich Instruments LabOne\Public\VI Tree.vi

VI Tree.vi
. Press CTRL-h after selecting one of the VIs to obtain help.Using ziCore Modules in the LabOne LabVIEW API
LabOne ziCore
Modules Modules (e.g. Sweeper) enable
high-level measurement tools to use with your Zurich instrument device
in LabVIEW. The outline of the instruction flow for a LabVIEW Module is
as following:
-
Initialization: Create a ziModHandle from a ziHandle
ziModStart.vi
. -
Configuration: Perform the module’s settings. For example, using the virtual instrument
ziModSetValue.vi
. -
Subscribe: Define the recorded data node
ziModSubscribe.vi
. -
Execute: Start the operation of the module
ziModExecute.vi
. -
Data: Read data from the module. For example, using the
ziModGetNextNode.vi
andziModGetData.vi
. -
Utility: Perform data analysis on the read data, potentially repeating Step 2, Step 3 and/or Step 4.
-
Clear: Terminate the API’s connection to the module
ziModClear.vi
.
Finding help for the LabOne VIs from within LabVIEW
As is customary for LabVIEW, built-in help for LabOne’s VIs can be obtained by selecting the VI with the mouse in a block diagram and pressing CTRL-h to view the VI’s context help. See Figure 2 for an example.
Finding the LabOne LabVIEW API Examples
Many examples come bundled with the LabOne LabVIEW API which demonstrate the most important concepts of working with Zurich Instrument devices. The easiest way to browse the list of available examples is via the NI Example Finder: In LabVIEW select "Find Examples…" from the "Help" menu-bar and search for "LabOne", see Figure 3.
The examples are located in the directory
instr.lib/Zurich Instruments LabOne/Examples
found in LabVIEW
installation directory. In order to modify an example for your needs,
please copy it to your local workspace.

Running the LabOne Example VIs
This section describes how to run a LabOne LabVIEW example on your instrument.
Please ensure that the example you would like to run is supported by your instrument class and its options set. For example, examples for HF2 Instruments can be found in the Example Finder (see Finding the LabOne LabVIEW API Examples ) by searching for "HF2", examples for the UHFLI by searching for "UHFLI" and examples for the MFLI by searching for "MFLI". |
Device Connection
After opening one of the LabOne LabVIEW examples, please ensure that the
example is configured to run on the desired instrument type. ziOpen.vi
establishes a connection to a Data Server. The address is of the format
{<host>}{:<port>}::{<Device ID>}
. Usually it is sufficient to provide
the Device ID only highlighted in
Figure 4. The Device ID
corresponds to the serial number (S/N) found on the instrument rear
panel. The host and port are then determined by network discovery.
Should the discovery not work, prepend <host>:<port>::
to the Device
ID. Examples are "myhf2.company.com:8004::dev466" or
"myhf2.company.com:8004". In the latter case the first found instrument
on the data server listening on "myhf2.company.com:8004" will be
selected.

Running the VI and Block Diagram
The example can be ran as any LabVIEW program; by clicking the "Run" icon in the icon bar. Be sure to check the example’s code and explanation by pressing CTRL-e to view the example’s block diagram, see Figure 5.

LabVIEW Programming Tips and Tricks
Use the User Interface’s command log or Server’s text interface while programming with LabVIEW
As with all other interfaces, LabVIEW uses the "path" and "nodes" concept to address settings on an instrument, see LabOne Software Architecture. In order to learn about or verify the nodes available it can be very helpful to view the command log in the User Interface (see the bar in the bottom of the screen) to see which node has been configured during a previous setting change. The text interface (HF2 Series) provides a convenient way to explore the node hierarchy. |
Always close ziHandles and ziModHandles or LabVIEW runs out of memory
If you use the "Abort Execution" button of LabVIEW, your LabVIEW program will not close any existing connections to the ziServer. Any open connection inside of LabVIEW will persist and continue to consume about 12 MB of RAM so that with time you will run out of memory. Completely exit LabVIEW in order to release the memory again. |
Use shift registers
The structure of efficient LabVIEW code is distinguished by signals being "piped through" by use of shift registers in loops and by the absence of object replication. Using shift registers in LabVIEW avoids copying of data and, more important, running the garbage collector frequently. ![]() Figure 6. Examples of simple LabVIEW programs for the Zurich Instruments HF2 Series. Left: A well implemented loop, Right: An example while-loop implemented wrong.
|