Modbus PLC Device Tag

Help Contents


The Modbus PLC Device Tag PLC Device Tag Icon represents a logical link to a PLC that supports the Modbus protocol.

Configuration Properties

The Modbus PLC Device Tag supports the configuration properties of the PLC 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.
HasCommand22 BOOL 3.35 Whether the PLC Device supports Modbus command 22 (mask write holding register).
WordOrder USINT 1.1 For multi-word tags, the order of words. 0 = High word first. 1 = Low word first.
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.

HasCommand22 Property

The HasCommand22 configuration property tells the driver whether the Modbus PLC 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 PLC devices support Modbus command 22.

The value of this property affects how the Modbus driver writes bits to holding registers:

HasCommand22Driver Action
True Use command 22 to set or clear the bit.
False Use a three step process to set or clear the bit:
  1. Use command 3 to read the holding register.
  2. Set or clear the required bit.
  3. Use command 6 to write the holding register back.

If the modbus device does not support Modbus command 22, set HasCommand22 to False.

Caution Symbol 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:
  • HasCommand22 is False, and
  • Fernhill SCADA writes a bit value to a holding register, and
  • The PLC program is also updating the holding register.

PollMethod Property

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:

Automatic The driver tries three different poll methods in turn:
  1. Diagnostics command 08 with sub-function 00 (Return Query Data), or
  2. Read Holding Register 40001
  3. Read Output Coil 00001
Once a working poll method has been found, the driver will continue to poll the device with the working poll method.
Read Register The driver reads the register specified 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 small number of 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.

Tag Commands

The Modbus PLC Tag supports the tag commands of the PLC Device Tag plus these commands:

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.
Refresh 3.15 Requests an immediate refresh of all of the IO Data tags associated with the PLC.

Example Configuration

This is an example of a modbus device at unit address 1, communicating via a channel called ".Remote Plant":

Channel.Remote Plant

Relationships to Other Tag Types

The Modbus PLC Tag builds on the features of these tag types:

Further Information

PLC Device Tag

For properties common to all types of device.

Modbus Serial Communication Channel

For more information on serial communications.

Modbus TCP/IP Communication Channel

For more information on TCP/IP communications.

Modbus Register Blocks

For more information on the Modbus Register Block Tags that can be associated with Modbus Devices.

Alarm Handling

To learn about alarm management.


For the meaning of terms used in Fernhill SCADA.