« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LabVIEW Examples for U12 - Windows

 

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

http://www.ni.com/gettingstarted/labviewbasics/

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.

 

Prerequisites

 

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 chart.vi".

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.

     

    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 installer included 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

    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.

     

     

     

    For further information see the forum topic titled "Getting started with the LabJack U12 in LabVIEW".

    Note that the U12 installer might have already copied LabVIEW examples to your machine if LabVIEW properly reported its current version and location.  Go to your root c:\ folder and search the entire drive for ljackuw.llb.

     

    2 comments

    Does your latest version work for version 8.5 of labVIEW or should I just try to get it working on 7. Additionally any chance of becoming compatible with additional platforms in the future?

    The version included with the normal U12 installation (LabVIEW60_LJU12) should work with LV 8.5, and is recommended for LV8.5, or you can download LabVIEW71_LJU12 above to use with LV 8.5.

    As for additional platforms, do you mean newer versions of LabVIEW?  We support all newer versions.