Skip to main content
Skip table of contents

Direct Modbus TCP

Introduction

Modbus is a simple and common protocol used in industrial environments. Many LabJack devices use Modbus TCP, which sends Modbus packets via TCP/IP.

LabJack devices act as Modbus TCP servers. They only respond to requests from a Modbus TCP client. Requests to a Modbus server can be sent by a Modbus client over a TCP/IP connection such as Ethernet or WiFi. We do not know of any clients that can speak Modbus TCP over USB (except for the LJM library for T-series devices).

Modbus TCP/UDP is the only protocol used by T-series devices.  Even the high-level LJM library uses Modbus TCP for all T-series device communications.

The U3, U6, and UE9 have limited Modbus support. UD devices use a proprietary low-level protocol described in the Low Level UD User's Guide.

The High-level LJM Library

The high-level LJM library is recommended for T-series device control. For a comparison between LJM and direct Modbus TCP communications, see the Direct Modbus TCP Example Code page.

Custom Protocol Details

Our high-level LJM library supports some features that are not standard to Modbus protocol.  These features are available to anyone using Modbus in their own application, but these features are not typically supported by commercial off-the-shelf (COTS) Modbus clients.

Spontaneous Stream Data

When our LJM library starts stream mode acquisition, it launches a background thread that constantly listens for incoming data from the device. The device can spontaneously send data packets at any time without being asked for each data packet. The data is formatted as Modbus TCP packets, but spontaneous data transfer is not a standard Modbus feature.  Command-response stream is another option for stream mode communications. Neither option is supported by standard COTS Modbus clients. For more stream mode implementation details, see the T-series Datasheet Stream Mode documentation.

Feedback Function (MBFB)

This is a custom function we have defined that allows register writes and reads in the same packet.  No COTS Modbus client support this proprietary function, but most device control can be achieved with standard write and read functions.

Getting Started

T-Series devices have five test registers that should be used before trying to read/write to other registers. This will help in trying to debug any getting-started related issues with addressing or bit-wise (byte-flipping) issues.

Modbus Client Applications

Available Modbus TCP/UDP client applications.

Example Code

Available modbus TCP/UDP library examples are on our examples page.

Modbus Map

The Modbus Map defines the address and name of all registers, along with other information.  This section has a dynamic map that allows you to filter and search.

T-Series Error Codes

T-series devices support standard Modbus error codes as well as some custom device error codes. These are documented on our LJM Error Codes page.

Modbus Protocol Details

Lengthy (and confusing) detail about Modbus TCP can be found at modbus.org, but all the information actually needed is covered in this section.

UD Modbus (Old)

The U3, U6, and UE9 implemented a deprecated Modbus system called UD Modbus.

Common Questions Regarding Modbus and Modbus TCP

What is a Modbus client and server?

These terms describe the relationship between two devices and how they communicate with each other using the Modbus protocol.  The modbus client (or master) sends a request to the modbus server and performs any associated actions. The server then returns a response to the request. In a given application, there may be many Modbus server devices (the device that is connected to a system's I/O, relays, alarms, thermocouples, RTDs, etc) spread across a factory floor that are being controlled by computers (example code), industrial SCADA systems (aka modbus client applications), human machine interface (HMI) devices, or PLCs that can speak Modbus TCP (read more on LabJack's with HMIs and PLCs).

What is a Modbus master and slave?

These are not standard Modbus terms, but you may sometimes see a Modbus client referred to as the master device and a Modbus server as the slave device.

Where can I find the Modbus register tables?

On the Modbus Map page.

Which LabJack devices can use Modbus TCP?

All T-series devices support Modbus TCP and Modbus UDP.

Can you control Modbus devices over the internet?

Yes you can. See the LabJack via Internet App Note for additional information.

JavaScript errors detected

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

If this problem persists, please contact our support.