« Close

Datasheets and User Guides

App Notes

Software & Driver

 

Modbus Map

Modbus - Modbus Map [referenceable]

The filter and search tool below displays information about the Modbus registers of T-series devices.

  • Name:  The string name that can be used with the LJM library to access each register.
  • Address:  The starting address of each register, which can be used through LJM or with direct Modbus.
  • Details:  Click to get text pulled from the description field in the JSON.
  • Type:  Specifies the datatype, which specifies how many registers each value uses.
  • Access:  Each register is readable, writable, or both.
  • Tags:  Used to associate registers with particular functionality.  Useful for filtering.

For the U3, U6 and UE9, see the deprecated Modbus system called UD Modbus.

0-Based Addressing

The addresses defined in the map above are the same addresses in the actual Modbus packet, and range from 0 to 65535.

Some clients subtract 1 from all addresses.  You tell the client you want to read address 2000, but the client puts 1999 in the actual Modbus packet.  That means if you want to read Modbus address 2000, you have to tell the client 2001.  We use 0-65535 addressing everywhere, so if you want to read an address we document as 2000, then 2000 should be in the Modbus packet. 

Single Overlapping Map of Addresses from 0-65535

We have a single map of addresses from 0 to 65535.  Any type of register can be located anywhere in that range regardless of data type or whether it is read-only, write-only, or read-write.

Some client software uses addresses written as 4xxxx.  In this case, the 4 is a special code that means to use the Modbus read function 0x03 and the xxxx is an address from 0-9999 that might additionally have 1 subtracted before being put in the Modbus packet.  The magic number of 40000 (or 40001) has no mention in the Modbus spec that we can find.  What this means in terms of how to talk to the LabJack depends on what exactly the client is doing, but if you want to read from an address we have defined as x (0-65535), then x should be the address in the Modbus packet sent out over TCP.

Big-Endian

Modbus is specified as big-endian, which means the most significant value is at the lowest address.  With a read of a 16-bit (single register) value, the 1st byte returned is the MSB (most significant byte) and the 2nd byte returned is the LSB (least significant byte).  With a read of a 32-bit (2 register) value, the value is returned MSW then LSW, where each word is returned MSB then LSB, so the 4 bytes come in order from most significant to least significant.

We have seen some clients that expect Modbus to be implemented with big-endian bytes but with the least significant word before the most significant word. In other words, the client software flips the order of the words within a 32-bit value.  For example, a read of TEST (address 55100) should return 0x00112233, but the client returns 0x22330011.

Data Type Constants

TypeInteger Value
LJM_UINT16 0
LJM_UINT32 1
LJM_INT32 2
LJM_FLOAT32 3
LJM_BYTE 99
LJM_STRING 98
 

Many registers are sequentially addressed.  The Modbus Map gives you the starting address for the first register, and then—depending on whether the data type is 16-bits or 32-bits—you increment the address by 1 or 2 to get the next value:

Address = StartingAddress + 1*Channel#    (UINT16)

Address = StartingAddress + 2*Channel#    (UINT32, INT32, FLOAT32)

Note that the term "register" is used 2 different ways throughout documentation:

  • A "register" is a location that has a value you might want to read or write (e.g. AIN0 or DAC0).
  • The term "Modbus register" generally refers to the Modbus use of the term, which is a 16-bit value pointed to by an address of 0-65535.

Therefore, most "registers" consist of 1 or 2 "Modbus registers".

For example, the first entry in the Modbus Map has the name AIN#(0:254), which is shorthand notation for 255 registers named AIN0, AIN1, AIN2, ..., AIN254.  The AIN# data type is FLOAT32, so each value needs 2 Modbus registers, an thus the address for a given analog input is channel*2.

ljm_constants.json

LabJack distributes a constants file called ljm_constants.json that defines information about the Modbus register map. The filter and search tool above pulls data from that JSON file.

The ljm_constants Bitbucket repository contains up-to-date text versions of the Modbus register map: