Modbus data addresses

A Modbus device is not required to contain all four groups of data. For example, a metering device may contain only holding registers. However, for each data group implemented, an “address convention” is used. Requests for data (made to a device) must specify a data address (and range) of interest.

The following sections provide more details:

Organization and addressing of data

Modbus data in a device is addressed as follows:

  • Coils — Addressed at 00000 — 0nnnn decimal, or “0x” addresses.

  • Inputs — Addressed at 10000 — 1nnnn decimal, or “1x” addresses.

  • Input Registers— Addressed at 30000 — 3nnnn decimal, or “3x” addresses.

  • Holding Registers — Addressed at 40000 — 4nnnn decimal, or “4x” addresses.

Note that data addressing (at least in decimal and hex formats) is zero-based, where the first instance of a data item, for example coil 1, is addressed as item number 0. As another example, holding register 108 is addressed as 107 decimal or 006B hex.

However, it is common for a vendor to list a device’s data items using a 5-digit Modbus address, for example, holding registers starting with 40001, as shown for a meter in Table 1.

Table 1. Example Modbus device register address documentation (portion)

Modbus Addr. Units Description Data Type
40001 kWH Energy Consumption, LSW Integer (multiplication required)
40002 kWH Energy Consumption, MSW Integer (multiplication required)
40003 kW Demand (power) Integer (multiplication required)
40004 VAR Reactive Power Integer (multiplication required)
40005 VA Apparent Power Integer (multiplication required)
40006   Integer (multiplication required)
40007 Volts Voltage, line to line Integer (multiplication required)
40008 Volts Voltage, line to neutral Integer (multiplication required)
40009 Amps Current Integer (multiplication required)
40010 kW Demand (power), phase A Integer (multiplication required)
40011 kW Demand (power), phase B Integer (multiplication required)
40012 kW Demand (power), phase B Integer (multiplication required)
40013 Power Factor, phase A Integer (multiplication required)
40014 Power Factor, phase B Integer (multiplication required)
40015 Power Factor, phase C Integer (multiplication required)
40259 kWH Energy Consumption Float, upper 16 bits
40260 kWH Energy Consumption Float, lower 16 bits
40261 kW Demand (power) Float, upper 16 bits
40262 kW Demand (power) Float, lower 16 bits

In the Table 1 example, each table row represents a 16-bit holding register. The holding register with Modbus address 40011 (phase B power), can be alternately addressed as a holding register (with an “implied 4nnnn value”) having a decimal address of “10” (“0010”), or a hex address of “A” (“000A”).

NoteInteger-stored data often requires additional math operations. NiagaraAX Modbus proxy points provide this capability “built-in,” via the proxy extension’s Conversion slot. For example, selecting “Linear” in Conversion provides entries for scale and offset, to process the raw Modbus value to a finished value. Typically, the vendor ‘s documentation for a Modbus device includes any “scaling” values needed for any such data items.

Consecutive addresses

Within any particular data group (coils, inputs, input registers, holding registers), it is typical for a Modbus device to use consecutive addresses, particularly for related data. For example, in the Table 1 example, holding registers 40001-40015 are used consecutively for integer data, where each is a separate, integer, “data point”.

In this example device, register 40259 begins a consecutive series of holding registers used to access “floating point” data values—note, however, that an address “gap” exists in this case. The address gap (while not necessary), was probably implemented by the device vendor for clarity. Note also that floating-point data values (being 32-bit based) require the use of two consecutive registers for each data point. See Numerical data types for related information.

Consecutive address usage (general)

Modbus messaging supports device queries for data using both a starting address and range, which is dependent on data items being consecutively addressed. This allows for message efficiency when retrieving multiple data points, as it can be handled in one message response.

The address range for data in any data group (coils, inputs, input registers, holding registers) received in a query must be implemented by the receiving device—otherwise, it will generate an exception response. For example, a read request of holding registers 40003—40015 to the device represented by Table 1 receives a normal response (data values), while a similar request to registers 40003-40017 results in an “illegal data address” response (as holding registers 40016 and 17 are not implemented). See Exception Responses for more information.

Consecutive address usage (NiagaraAX)

A NiagaraAX Modbus integration makes use of consecutively addressed data in two different ways:

  • When using the Point Manager to create proxy points, by using the “Number to Add” option in the New dialog box. See Figure 1 below for an example of where 8 points are being added.

    Figure 1. New dialog to create Modbus proxy points has “Number to Add” option for consecutive points


    New dialog to create Modbus proxy points has “Number to Add” option for consecutive points

    When you specify more than 1 point, additional points are automatically assigned consecutive addresses—relative to the “Starting Address” you specify for the first point.

  • Data polling in a client device may be improved by using “device polls”, where data values in consecutively addressed items are requested in a single message, reducing network messaging traffic.

    In NiagaraAX, this is configured in the device object (ModbusAsyncDevice, ModbusTcpDevice, ModbusTcpGatewayDevice), in the device’s DevicePollConfigTable slot. See Figure 2 below for an example.

    Figure 2. Modbus client device’s DevicePollConfigTable container slot allows “device polling” setup


    Modbus client device’s DevicePollConfigTable container slot allows “device polling” setup

    You can add child “DevicePollConfigEntry” objects manually in this container and configure, or optionally use the container’s right-click action: “Learn Optimum Device Poll Config”. Note that device polling should be configured only after proxy points are created, and typically already receiving values from (individual) point polling. For more details, see Device Poll Config.

Data address format in NiagaraAX

Generally speaking, when configuring a Niagara Modbus point for a data address, you should choose “Modbus” addressing from the available “Address Format” types (Figure 3). This lets you enter target data addresses directly from the device’s documentation, without having to “subtract 40001” for example, or perform other mental math.

Figure 3. Modbus address format recommended when adding proxy points


Modbus address format recommended when adding proxy points

Also, for read-only client points, using the Modbus address format also frees you from setting the register type property (“Reg Type”), as it automatically sets this property going by the leading numeral of the full Modbus address (3 for input registers, and 4 for holding registers), as shown in Figure 4.

Figure 4. Reg Type property of Modbus


Reg Type property of Modbus

NoteWhen entering a Modbus formatted address for a coil, “leading zeros” are ignored—for example the Modbus address “00109” is the same as entering Modbus “109”. Again, note that unlike Decimal or Hex address formats (“zero-based formats”), the Modbus address format is “one-based”, meaning that a coil addressed as Modbus 109 has a “Decimal address” of 108, and a “Hex address” of 6D.