About Modbus server devices

Modbus server (slave) devices include types ModbusSlaveDevice and ModbusTcpSlaveDevice. Both of these device components represent the station as a “virtual” Modbus slave, that is, the station listens for Modbus queries from a remote Modbus master, and sends responses.

Both Modbus server devices are similar, having a single frozen Points device extension, with the default Modbus Server Point Manager view. The same type of Modbus server proxy points are used under Points device extensions.

NoteDevice types are specific to a particular parent network type—for example, you cannot copy a ModbusSlaveDevice under a ModbusTcpSlaveNetwork, or a ModbusTcpSlaveDevice under a ModbusSlaveNetwork. This is not a problem when working in the device manager for either of the slave networks, as the “New” function (to add devices) automatically selects the proper child device component.

In addition to common device slots (see “Common device components” in the Drivers Guide), both types of Modbus server devices have similar properties for Modbus configuration. This includes overrides of “network level” device data settings and register range configurations for Modbus data items.

The following sections provide more details on these Modbus server device configuration:

Modbus Config (server device level)

Each Modbus server device has a “Modbus Config” container slot with 3 properties—you can access them on the device’s property sheet, as well as the New or Edit dialog for a device object when in the device manager view (of its parent network). Figure 39 shows the properties in the New dialog for a device.

Figure 39. Modbus Config properties in New/Edit dialog when working in network’s device manager view


Modbus Config properties in New/Edit dialog when working in network’s device manager view

These properties allow you to “override” the network-level (global) equivalent settings for handling Modbus data from and to this virtual device, and are described as follows:

  • Override Network

    The default, false, means the network-level settings are used. Set this to true whenever you want the settings below to be used instead of the equivalent network-level values.

  • Float Byte Order

    Specifies the byte-order used to assemble or receive floating-point (32-bit) values in messages.

  • Long Byte Order

    Specifies the byte-order used to assemble or receive long integer (32-bit) values in messages.

Typically you leave these properties at defaults, particularly if only one Modbus server device—in which case you could adjust them (globally) at the network level.

NoteAs a Modbus slave (server), by default Niagara supports Modbus function codes 15 and 16 (Force Multiple Coils, Preset Multiple Registers), so you do not see these selections like you do in a client Modbus device.

Modbus Register Range Tables

Each Modbus server device has four frozen container slots for setting “valid address ranges” for each of the four “virtual” data item types (coils, inputs, holding registers, input registers), as follows:

  • Valid Coils Range

  • Valid Status Range

  • Valid Holding Registers Range

  • Valid Input Registers Range

Queries received by the device must be for data items within the defined (and enabled) valid address ranges. Otherwise the station generates/sends an exception response back. In addition, server Modbus proxy points under the device must be configured to fall within these address ranges, or else they will have a fault status.

You can see these range components under the device when expanded in the Nav tree, as well as in the device’s property sheet, as shown in Figure 40.

Figure 40. Modbus Register Range Tables of Modbus server device


Modbus Register Range Tables of Modbus server device

By default, as copied from the modbusSlave or modbusTcpSlave palette, a Modbus server device has a single “Default”-named Register Range Entry in each valid range container, with each having an enabled range of from 1 to 64, as shown in Figure 40 for “Valid Coils Range.” The same default applies to the “Valid Holding Registers Range,” and so on.

As needed, for any data item range you can edit property values, add additional valid range entries, or perhaps disable ranges. For example, you could disable the “Valid Status Range” entry, so that any Modbus master queries to this device to read discrete status (inputs) would yield an exception response. As another example, you could add multiple ranges for holding registers.

Configuring Valid Register Ranges

You add additional register ranges using either of these two methods:

  • Use the right-click “Add Range” action on any Modbus Register Range type (Figure 41). This provides a dialog in which you specify another Modbus Register Range Entry component, added under that range type container.

  • Manually, by duplicating/re-editing Register Range Entry components (or by coping entries from the modbusSlave or modbusTcpSlave palette and editing as necessary).

Figure 41. Action “Add Range” to create additional server register range entries


Action “Add Range” to create additional server register range entries

Each Modbus Register Range Table container also has a separate “Clear” action you can use to remove all existing Modbus Register Range Entry children.

Modbus Register Range Entry

Figure 42 shows a Modbus Register Range Entry child of one of the Modbus Register Range Tables expanded, and its properties that were specified.

Figure 42. Expanded Modbus Register Range Entry in Modbus server device


Expanded Modbus Register Range Entry in Modbus server device

Properties of a Modbus Register Range Entry are described as follows:

  • Enabled — By default, is true. If set to false, any associated Modbus server proxy points will have a fault status, and any queries received to this address range result in an exception response

  • Starting Address Offset — The first register in the specified range.

  • Size — The number of registers in the range.

For example, if a holding register range is set to a starting address of 250 with a size of 75, it will have an effective Modbus address range of 40250 to 40325.

NoteIf using multiple ranges under any of the Modbus Register Range Tables, be careful not to “overlap” any range entries. In other words, any specific register address should be in only one range entry.