Skip to Navigation

LJM Library

T7 Architecture

Download

See T7 and Digit Software to download the LJM Library and LabJack applications.

See the LJM Support page to download minor updates.

 

Features

 

Cross Platform

Support for Windows, Mac OS X, and Linux allows for the same code to be run on different operating systems with the same results, whether it's on your Windows desktop, MacBook laptop, or Raspberry Pi running a distribution of Linux.

 

Supported In Multiple Languages

Written in C++ with a C API, LabJack maintains and supports wrappers for many programing languages.

C/C++

#include "LabJackM.h"

    ...

    int error, handle;
    double voltage;
    error = LJM_OpenS("T7", "USB", "ANY", &handle);
    
    // Read the voltage on AIN0
    error = LJM_eReadName(handle, "AIN0", &voltage);

    ...

 

For more LJM C/C++ code, see the C/C++ Examples page.

Python

from labjack import ljm

handle = ljm.openS("T7", "USB", "ANY")

# Read the voltage on AIN0
voltage = ljm.eReadName(handle, "AIN0")

 

For more LJM Python code, see the Python Examples page.

MATLAB

ljmAsm = NET.addAssembly('LabJack.LJM');

    ...
	
    [ljmError, handle] = LabJack.LJM.OpenS('T7', 'USB', 'ANY', handle);
    
    % Read the voltage on AIN0
    [ljmError, voltage] = LabJack.LJM.eReadName(handle, 'AIN0', 0);
    
    ...

 

For more LJM MATLAB code, see the MATLAB Examples page.

C# .NET

using LabJack;

    ...

    int handle;
    LJM.OpenS("T7", "USB", "ANY", ref handle);

    // Read the voltage on AIN0
    double voltage;
    LJM.eReadName(handle, "AIN0", ref voltage);

    ...

 

For more LJM C# .NET code, see the C# .NET Examples page.

Some other supported languages:

LJM's API allows for easy integration into most languages. If the language you use isn't currently supported, feel free to contact us for assistance in integrating LJM into your project.

 

LJM Is For Any Level Of Expertise

You don't need to be familiar with Modbus to use LJM. Simply use LJM's Easy Functions for direct access to all the features your LabJack device provides.

If you do prefer to use Modbus, LJM's Raw Byte Functions provide byte-level control to manually send and receive Modbus packets.

 

Modbus Interpretation

Using LJM's name-to-address map, you can communicate with LabJack devices using the readable names of data values, such as "AIN0", "AIN0_RANGE", "ETHERNET_IP", or "WIFI_STATUS".

LJM provides functions that convert readable Modbus register names to a register addresses, such as LJM_NameToAddress. Or, you can directly interact with your LabJack device using the Name-style Easy functions. (Although you can use the Address-style Easy functions if you prefer.)

You can easily look up Modbus registers on the Modbus Map page.

 

Easy Device Connection

Connecting to a LabJack device is simple. Here's some ways you can connect:

Just want to open any LabJack device? Open a connection to the
first found LabJack device.
Just want to connect to any device
on the network or on a USB hub?
Filter based on connection type.
Just want to open any LabJack Digit or T7? Filter based on device type.
Got a network with static IP address? Open by IP address.
Got a T7 on a DHCP network or on a large USB hub? Open by serial number.

Don't want to mess with serial numbers or IP addresses,
but you still want to open a particular device?

Open by customizable name.

 

Easy Debugging

Using the LJM_ErrorToString function, LJM converts error codes to near-English. Here's some examples of errors and their output from LJM:

  • 1227 means "LJME_DEVICE_NOT_FOUND"
  • 2420 means "DEVICE_NAME_MUST_BE_ALPHANUM"

LJM's activity log file allows you to see what's going on inside LJM. LJM's Debug Logger output includes data packets, trace information, warnings, and errors. Here's some of the features the Debug Logger sports:

  • Configurable logger priority/verbosity level
  • Log to an arbitrary file location
  • Set the log file maximum size
  • Add user-code debug information in-line to the activity log file with the Debug Logger system using the LJM_Log function

For applications with limited processing power, LJM can log messages according to your particular processing constraints. Set the logger mode to:

  • Never log (default)
  • Log continuously
  • Collect log messages and only output them when an error occurs

 

Configurable Behavior

Customize the behavior of the LJM library to fit your needs. See the full list of Configuration Parameters.

You can also put a configuration file on your system and load it into LJM, so that one configuration that works well can be loaded for multiple programs. (It's also easy to edit!)

 

Questions?

Don't hesitate to ask:

LJM also has a detailed User's Guide and plenty of example code in multiple programming languages.