Direct Modbus TCP | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


Direct Modbus TCP

Direct Modbus TCP Overview

Because the T7 and T4 transmit all of their information using Modbus TCP, they are compatable with dozens of 3rd party libraries. If we don't support a particular language required for an application, try searching for a Modbus TCP library that is compatible with your language of choice. The following is a list of libraries that we have successfully used to communicate with our devices using Modbus TCP.

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 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.

Direct Modbus API Documentation

For more information about LabJack's Direct Modbus implementation check out the API documentation section.

Modbus TCP Example Code Table

Modbus TCP Example Code Table (Referencable)

Direct Modbus TCP Example Code

T7 T4

T7, T4

Libraries... Windows Mac Linux
C/C++ (Streaming)

To use a 3rd party Modbus program, such as a Rockwell/Allen Bradley application, there is no download - simply follow the instructions on the Modbus Client Applications page.

More information about Modbus as well as some getting started information can be found on the Modbus API Documentation page. A list of the available Modbus registers that the T7 supports is available on the Modbus Map page.


I am attempting to read two values using two Modbus messages.  The first attempts to get AIN0 and the second attempts to get DIO18_EF_READ_A (set to be a high speed counter).  I send these messages on a 10Hz clock.  If I send only the AIN0 message, I get AIN0 responses.  If I send only the DIO18_EF_READ_A message, I get DIO18_EF_READ_A responses.  If I attempt to send both messages back to back, I only get responses from the first message.  Both messages are sent successfully according to the socket write command (I'm writing in C++).  What is happening to the second message?

Can your software capture the raw packets sent and received so we can look at what is going on?  Similar to what you see for the Command and Response in the "Examples" at the bottom of the Modbus TCP - Protocol Details page.  Or if your software can't capture it perhaps you can use Wireshark or similar.

Thanks for the help.  I used Wireshark to grab the messages to send to you and found that the two back to back messages (written with different TCP write calls) got packed into the same TCP packet.  The T7 responded to the first part of the packet and ignored the rest.  I fixed it by flushing the socket before sending the second message.  Now both messages are sent in their own TCP packets and all is well.