Modbus Device Tag

Help Contents

Introduction

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

Configuration Properties

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:
  • Standard Modbus
  • Enron Modbus
  • DirectLogic
See DataAddressFormat Property for more information.
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.

DataAddressFormat Property

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:

DataAddressFormatAddress 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.

HasCommand05 and HasCommand15 Properties

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:

HasCommand05HasCommand15Description
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.

HasCommand06 and HasCommand16 Properties

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:

HasCommand06HasCommand16Description
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.

HasCommand22 Property

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:

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 supports Modbus Command 22, set HasCommand22 to True.

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:

PollMethodDescription
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 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.

Tag Commands

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.

Example Configuration

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

PropertyValue
Channel.Remote Plant
Unit1

Relationships to Other Tag Types

The Modbus Device 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 Communication Channel

For more information on setting up a TCP/IP communication channel for Modbus.

Modbus Register Blocks

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

Alarm Conditions

To learn about abnormal conditions in SCADA applications.

Glossary

For the meaning of terms used in Fernhill SCADA.