Skip to main content
Skip table of contents

LabVIEW Examples for U12 - Windows

LabVIEW is one of, if not the, most popular programming languages used by our customers. LabVIEW is a graphicalprogramming language, as demonstrated in the code snippet below, but understand that it is still a programming language not a simple software tool.

Note that using a LabJack in LabVIEW is not identical to using NI hardware in LabVIEW.  The NI hardware is talked to through the NI-DAQ driver, while the U12 is talked to through the LabJack U12 Windows Library.  That means that you will not use measurement & automation explorer, DAQ assistant, or similar NI wizards.


Getting Started

  1. Go through the U12 Quickstart Tutorial.  Among other things this will install the U12 Windows Library and confirm basic operation of the U12.

  2. In LabVIEW you will be making calls to the U12 Library to write to and read from the device.  The U12 Library is documented in Section 4 of the U12 Datasheet.

  3. Download the applicable LabVIEW##_LJU12 archive (attached below) and extract the entire archive.  You can store this folder anywhere, but if you want shortcuts in the LabVIEW function palette (optional) copy the "LabJack" sub-folder to the \vi.lib\addons\ folder in your LabVIEW directory.

  4. Navigate to the folder \LabVIEW##_LJU12\ and open any of the example files.  The code snippet below shows the Wiring Diagram from "simple eanalogin loop with".

The U12 LabVIEW examples are for Windows only.

Code Snippet

This example uses 2 calls to the U12 Windows Library:

  • EAnalogIn returns 1 voltage reading from 1 analog input.

  • EAnalogIn is called in a loop that iterates every 100 milliseconds.  The loop stops if their is an error or if the stop button (on the front panel) is pressed.

  • GetErrorString converts the numeric U12 errorcode to a readable string.

Short Video Tutorial

A short tutorial for how to use the U12 LabVIEW libraries is published on YouTube:

LabVIEW Can't Find Sub-VIs

We provide VIs that call all the U12 functions defined in Section 4 of the U12 Datasheet.  These VIs are located in a VI library called ljackuw.llb, so if LabVIEW is looking for any of the basic U12 functions point it to the llb file.

If LabVIEW is looking for other sub-VIs, point it to the extracted folder (downloaded below) or perhaps the "sub" folder below that.  If the sub-VI is not found there it might be a feature not supported by your version of LabVIEW.

LJlogger & LJstream

The main U12 installer includes executable versions of LJlogger & LJstream.  The source for these is included in the LabVIEW archive attached here, but most users looking to build a custom LabVIEW application should start with one of the simpler examples in the archive, or perhaps LJsimplelog.

LabVIEW Function Palette and Example Packages

You can extract the LabVIEW##_LJU12 archive anywhere, but if you want U12 shortcuts in the LabVIEW function palette (optional) then take the following extra step.

When you extract the LabVIEW##_LJU12 archive (attached below) you will get a folder of the same name with various sub-folders including one called "LabJack" which contains a dir.mnu file (function palette definitions) and ljackuw.llb (a VI library with VIs that call the various U12 Library functions).  Move this "LabJack" folder to the \vi.lib\addons\ folder in your LabVIEW directory.

Note that as of September 2016, the main U12 installer no longer includes the LabVIEW examples.  Rather they are available below as a separate download.

LabVIEW71_LJU12_20190730 (for LV 7.1 or newer) (for LV 6) (LV6 archive reverted to LV5)

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.