Direct Modbus TCP | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

Direct Modbus TCP

Introduction

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

LabJack devices that speak Modbus are Modbus TCP Servers. Software or devices that can act as a Modbus TCP Client, can talk directly to a Modbus Server over a TCP/IP connection such as Ethernet or WiFi. We do not know of any clients that can speak Modbus TCP over USB.

Modbus TCP/UDP is the only protocol used by the T4 and T7.  Even the LJM library is using Modbus packets under-the-hood for all communication with these devices.  That said, our high-level LJM library uses a couple features that are not "standard" Modbus.  These features are an option for anyone using Modbus in their own application, but for standard COTS Modbus clients these features are likely not an option:

  • Spontaneous Stream Data - When our LJM library starts a stream, it launches a background thread that is constantly listening for incoming data from the device such that the device can spontaneously send data packets at any time without being asked for each data packet.  The data packets are formed as Modbus TCP packets, but sending them spontaneously is not standard and would not be supported by any COTS Modbus clients.  Command-response stream is an option, but still would not work with any COTS Modbus clients.
  • Feedback Function (MBFB) - This is a custom function we have defined that is very efficient, and in particular allows writes and reads in the same packet.  No COTS Modbus client will support this proprietary function, but all the same things can be done with separate standard write and read functions.

The U3, U6, and UE9 have limited Modbus support, and for full functionality use a proprietary low-level protocol described in Section 5 of each datasheet.

Getting Started

The T7 and T4 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.

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:

  • Q: What is a Modbus Master-Slave/Client-Server?
    A: A Modbus Client-Server is the same as Master-Slave.  These terms describe the relationship between two devices and how they communicate with each other using the Modbus protocol.  The modbus master (or TCP client) asks the questions and the modbus slave (or a Modbus TCP server) performs any associated actions and returns a response to the request.  In a given application, there may be many modbus slave 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).
  • Q: Where can I find the Modbus register tables?
    A: On the Modbus Map page.
  • Q: Which LabJack devices can use Modbus TCP?
    A: The T-Series devices support Modbus TCP and Modbus UDP for device discovery purposes.
  • Q: Can you control Modbus over the internet?
    A: Yes, you can, by port-forwarding.  However it is more secure to set-up a data collection machine that then relays the information to a server.  For remore applications, another option is to use something like the Sierra Wireless AirLink RV50 to collect data and send it out via LTE cellular networks.