« Close

Datasheets and User Guides

App Notes

Software & Driver

 

Getting Started

Modbus - Getting Started [referenceable]

To get started with direct Modbus TCP, first try writing & reading to/from the test registers.

See the Examples section on the Modbus Protocol Details page.

If using COTS Modbus Client software, keep the following in mind:

  • The LabJack is a Modbus TCP Server.  A Modbus TCP Client can send a command to the LabJack and get back a response.  Sometimes a Server is called the Slave and a Client is called the Master.
  • We use a single register map with addresses from 0 to 65535.  Each address points to a 16-bit value that might be readable, writable, or both.
  • The meaning of the registers are defined in our Modbus Map.
  • Use function 3, 4, 6, or 16.  Choose "Holding" if needed.

If you don't have a better way to see the bytes written and read for each packet, you can use Wireshark to get a TCP capture.

Test Registers

Name Start Address Type Access Default
TEST 55100 UINT32 R 1122867
TEST_UINT16 55110 UINT16 R/W 17
TEST_UINT32 55120 UINT32 R/W 1122867
TEST_INT32 55122 INT32 R/W -2003195205
TEST_FLOAT32 55124 FLOAT32 R/W -9999.0

TEST

A read of this test register should always return 0x00112233 or d1122867. If your software has the word swap quirk, you will incorrectly read 0x22330011 or 573767697. If your software has the address-1 quirk, a UINT16 (1-register) read from 55101 will incorrectly return 0x0011 (should read 0x2233).

TEST_UINT16

Write a value and read back to test UINT16 operation. Default is 0x0011 or d17.

TEST_UINT32

Write a value and read back to test UINT32 operation. Default is 0x00112233 or d1122867. If your software has the word swap quirk, the default will incorrectly read 0x22330011 or 573767697.

TEST_INT32

Write a value and read back to test INT32 operation. Default is 0x8899AABB or d-2003195205. If your software has the word swap quirk, the default will incorrectly read 0xAABB8899 or -1430550375.

TEST_FLOAT32

Write a value and read back to test FLOAT32 operation. Default is 0xC61C3C00 or -9999.0. If your software has the word swap quirk, the default will incorrectly read 0x3C00C61C or 0.00786.