« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LabVIEW for LJM - Windows

LJM LabVIEW Examples (Software Platform)

LabVIEW example VIs for the LJM library.

Release
05/29/2015

LJM LabView Examples (Referencable)

The LJM library is the high level code library for the T7 device. 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 T7 is talked to through the LabJack LJM library.  That means that you will not use measurement & automation explorer, DAQ assistant, or similar NI wizards.

Prerequisites

Getting Started

  1. Go to the T7 Support Homepage and follow the Quickstart steps to install Windows software and confirm basic operation.
  2. In LabVIEW you will be making calls to our LJM Library to write and read registers on the device.  Go to the main LJM Page for an introduction, and proceed to the LJM User's Guide for more details.
  3. For more information about what registers to write and read, see the T7 Datasheet and the Modbus Map.
  4. Download the LabVIEW_LJM archive (attached below), extract the entire archive, and read the "readme.txt" contained within.  The readme really does have some good information not found anywhere else.
  5. Navigate to the folder \LabVIEW_LJM\Examples\ and open any of the example files.  The code snippet below shows the Wiring Diagram from "LJM_eReadName Example.vi".

Currently developed and tested on Windows only.

Code Snippet

This example uses 5 calls to the LJM library:

    • LJM_OpenS specifies which device you want to open and returns a handle for that device.
    • LJM_GetHandleInfo returns information about the device we just opened.
    • We pass a register name to LJM_eReadName and it reads the value of that register.  In this case we are reading the register named "SERIAL_NUMBER" which returns the serial number of the device.  For more names refer to the T7 Datasheet or Modbus Map.
    • LJM_Close closes the connection to the device so it is available to other processes.
    • LJM_ErrorToString converts the numeric error code to a readable string.

      About LabVIEW & LJM

      With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers.  Look at the device's datasheet to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.

       

      **Note**:  2 substantial changes were made to the LabVIEW_LJM archive with the 2015_01_23 release:

      1.  In LJM function call VIs that have the NumFrames parameter, that parameter is now optional with a default value of -1 which means "Auto-Detect the Number of Frames".  If you do not wire anything to NumFrames, or pass -1, this signals the VI to use the size of aNames or aAddresses to determine the number of frames.  This should not break any code using previous versions of these VIs.

      2.  A few changes were made to the inputs & outputs of LJM_eStreamStart.vi, and these changes will break code using a previous version of this VI.  See the front panel of LJM_eStreamStart.vi for more details.

       

      5 comments

      when I run "DIO EF Config 1 PWM and 1 Counter.vi" I have an error message: "LabJack Error #2508:  HW_CNTR0_NOT_AVAILABLE occured at LJM_eWriteAddresses.vi"

      The problem is that that example enables Clock0 for the PWM output.  Clock0 uses CounterA & CounterB so they are not available:

      http://labjack.com/support/datasheets/t7/digital-io/extended-features/ef...

      We will change the example to use CounterC on CIO2.

      In the config list use:

      DIO18_EF_TYPE
      DIO18_EF_ENABLE

      ... and then read:

      DIO18_EF_READ_A

      Forgot to click the "List" box.  Now it is showing.

      "LabJack Error #1298:  LJME_ATTR_LOAD_COMM_FAILURE occured at LJM_OpenS.vi"

      LV2014, 64bit machine.  The LJControlPanel and LJStreamUD work just fine.

      The .dll is installed in the systems32 folder.

      What LabJack are you using? The LJM driver and examples only support the LabJack T7 and Digit. For UD devices (U3/U6/UE9) use the UD driver and examples:

      http://labjack.com/support/ud/examples/labview