The Modbus Device Tag
represents a logical link to a device that supports the Modbus protocol.
The Modbus Device Tag supports the configuration properties of the PLC Scanned Device Tag, plus these properties:
Property | Type | Version | Description |
---|---|---|---|
Channel | Reference | 1.0 | The Modbus Communication Channel to the device. |
Unit | USINT | 1.0 | The Modbus unit address of the device. |
DataAddressFormat | USINT | 3.86 |
Defines the format of data address properties. The options are:
|
WordOrder | USINT | 1.1 | For multi-word tags, the order of words. 0 = High word first. 1 = Low word first. |
HasCommand05 | BOOL | 3.36 | Whether the PLC Device supports Modbus command 05 (force single coil). |
HasCommand06 | BOOL | 3.36 | Whether the PLC Device supports Modbus command 06 (preset single register). |
HasCommand15 | BOOL | 3.36 | Whether the PLC Device supports Modbus command 15 (force multiple coils). |
HasCommand16 | BOOL | 3.36 | Whether the PLC Device supports Modbus command 16 (preset multiple registers). |
HasCommand22 | BOOL | 3.35 | Whether the PLC Device supports Modbus command 22 (mask write holding register). |
PollMethod | USINT | 3.35 | How to test whether the device is online. 0 = Automatic, 1 = Read Register. |
PollRegisterAddress | STRING | 3.35 | When PollMethod is set to Read Register, the register address to read. |
PollRegisterCount | UINT | 3.35 | When PollMethod is set to Read Register, the number of registers to read. |
In a Modbus Device, a Data Address is the location of an item of data in a Modbus Device. The DataAddressFormat property defines the format of a Data Address.
These Data Address Formats are supported:
DataAddressFormat | Address Format |
---|---|
Standard Modbus | The address uses the standard Modbus convention. For more information see Standard Modbus Data Address. |
Enron Modbus | The address uses the Enron Modbus convention. For more information see Enron Modbus Data Address. |
DirectLogic | The address uses the DirectLogic convention. For more information see DirectLogic Data Address. |
For Standard Modbus, the HasCommand05 and HasCommand15 properties tell the driver the available commands to write output coils.
Most Modbus Devices support both command 05 (write single coil) and command 15 (write multiple coils). If a Modbus Device does not support command 05, set HasCommand05 to False. If a Modbus Device does not support command 15, set HasCommand15 to False.
This table shows how the driver writes output coils depending on the configuration of HasCommand05 and HasCommand15:
HasCommand05 | HasCommand15 | Description |
---|---|---|
True | True | Single bit writes use command 05. Multiple bit writes use command 15. |
False | True | Single and multiple bit writes use command 15. |
True | False | Single bit writes use command 05. Multiple bit writes result in an error. |
False | False | Single and multiple word writes result in an error. |
For Standard Modbus, the HasCommand06 and HasCommand16 properties tell the driver the available commands to write holding registers.
Most Modbus Devices support both command 06 (preset single register) and command 16 (preset multiple registers). If a Modbus Device does not support command 06, set HasCommand06 to False. If a Modbus Device does not support command 16, set HasCommand16 to False.
This table shows how the driver writes holding registers depending on the configuration of HasCommand06 and HasCommand16:
HasCommand06 | HasCommand16 | Description |
---|---|---|
True | True | Single word writes use command 06. Multiple word writes use command 16. |
False | True | Single and multiple word writes use command 16. |
True | False | Single word writes use command 06. Multiple word writes result in an error. |
False | False | Single and multiple word writes result in an error. |
For Standard Modbus, the HasCommand22 configuration property tells the driver whether the Modbus Device supports Modbus command 22. Modbus command 22 is a masked write operation to a holding register. It allows the Modbus master to set or clear bits in a holding register in one operation. Not all Modbus Devices support this command.
The value of this property affects how the Modbus driver writes bits to holding registers:
HasCommand22 | Driver Action |
---|---|
True | Use command 22 to set or clear the bit. |
False |
Use a three step process to set or clear the bit:
|
If the Modbus device supports Modbus Command 22, set HasCommand22 to True.
![]() |
When HasCommand22 is False, avoid writes from Fernhill SCADA to holding registers
that are also updated by the PLC program. The following conditions could result in unexpected
changes to holding register values:
|
The Modbus driver sends a poll command the PLC Device at a regular interval to check if the PLC Device is online. Provided the PLC Device sends a response to the poll command, the PLC Device status will be online. The PLC Device status will be online even if the PLC Device replies with an exception response.
The PollMethod property tells the driver what Modbus command to use as a PLC Device Poll. These options are supported:
PollMethod | Description |
---|---|
Automatic |
The driver tries three different poll methods in turn:
|
Read Register |
The driver reads the register defined by the PollRegisterAddress property. The PollRegisterCount property tells the driver how many registers to read. |
The PollMethod is an advanced configuration option. In most applications PollMethod should be set to the default option: Automatic.
A few PLC devices do not implement Modbus correctly. For example:
Setting PollMethod to "Read Register" and configuring PollRegisterAddress and PollRegisterCount appropriately may help establish communications with devices that do not implement Modbus correctly.
The Modbus Device Tag supports the tag commands of the PLC Scanned Device Tag, plus these properties:
Tag Command | Version | Description |
---|---|---|
DirectWriteWord | 2.3 | Directly writes one or more words to an address in the PLC. |
DirectWriteBit | 2.3 | Directly writes a single bit to an address in the PLC. |
This is an example of a Modbus device at unit address 1, communicating via a channel called ".Remote Plant":
Property | Value |
---|---|
Channel | .Remote Plant |
Unit | 1 |
The Modbus Device Tag builds on the features of these tag types:
For properties common to all types of device.
Modbus Serial Communication ChannelFor more information on serial communications.
Modbus TCP Communication ChannelFor more information on setting up a TCP/IP communication channel for Modbus.
Modbus Register BlocksFor more information on the Modbus Register Block Tags that can be associated with Modbus Devices.
To learn about abnormal conditions in SCADA applications.
For the meaning of terms used in Fernhill SCADA.