Modbus Slave PLC Device Tag

Help Contents

Introduction

The Modbus Slave PLC Device Tag PLC Device Tag Icon represents a virtual Modbus Device that can be polled by external drivers.

Configuration Properties

The Modbus Slave PLC Device Tag supports the configuration properties of the Common Core Tag, plus these properties:

Property Type Version Description
Channel Reference 3.10 The Modbus Slave Communication Channel to the device.
Address USINT 3.10 The Modbus unit address of the device.
WordOrder USINT 3.10 For multi-word tags, the order of words:
  1. High word first
  2. Low word first
CoilCount UDINT 3.82 The number of coils in the Modbus Slave Device.
  • You can configure up to 65536 coils.
  • To access coils in the range 10000 to 65536, the Modbus master would need to support 6-digit addressing.
  • If you set CoilCount to more than 65536, only 65536 coils will be created.
DiscreteInputCount UDINT 3.82 The number of discrete inputs in the Modbus Slave Device.
  • You can configure up to 65536 discrete inputs.
  • To access discrete inputs in the range 10000 to 65536, the Modbus master would need to support 6-digit addressing.
  • If you set DiscreteInputCount to more than 65536, only 65536 discrete inputs will be created.
InputRegisterCount UDINT 3.82 The number of input registers in the Modbus Slave Device.
  • You can configure up to 65536 input registers.
  • To access input registers in the range 10000 to 65536, the Modbus master would need to support 6-digit addressing.
  • If you set InputRegisterCount to more than 65536, only 65536 input registers will be created.
HoldingRegisterCount UDINT 3.82 The number of holding registers in the Modbus Slave Device.
  • You can configure up to 65536 holding registers.
  • To access holding registers in the range 10000 to 65536, the Modbus master would need to support 6-digit addressing.
  • If you set HoldingRegisterCount to more than 65536, only 65536 holding registers will be created.

Data Properties

The Modbus Slave PLC Device Tag supports the data properties of the Common Core Tag, plus these additional properties:

Property Type Description
State UINT The current state of the Virtual PLC.
StateDescription WSTRING A string that describes the current state of the Virtual PLC.
EventCount UDINT The number of Modbus commands successfully processed, excluding poll commands and fetch event counter commands. This value is also returned in the second word of the response to Modbus command 11 (Read comm event counter).
MessageCount UDINT The number of Modbus messages received by the Virtual PLC. This value is also returned by Modbus Command 08 (Diagnostics) using sub-function 14 (Slave Message Count).
ExceptionCount UDINT The number of Modbus exceptions returned by he Virtual PLC. This value is also returned by Modbus Command 08 (Diagnostics) using sub-function 13 (Bus Exception Count).

Tag Commands

The Modbus Slave PLC Tag does not support any tag commands.

Modbus Slave Data Map

The Modbus Slave Data Map is a text file to define the relationship between:

For example, you can map Holding Register 40001 to an I/O Analog Data Point Tag associated with a PLC. How the virtual PLC responds to external requests is shown in this table:

External Request Virtual PLC Response
Read holding register 40001 The value of the I/O Analog Data Point Tag is returned.
Write holding register 40001 The write command is forwarded to the PLC via the I/O Analog Data Point Tag.

Data Map Examples

  1. To map output coil 00005 to a Digital Data Point Tag called Digital-Tag-1:
    BOOL "0005" %"Digital-Tag-1";
  2. To map bit 1 in holding register 40001 to a Digital Data Point Tag called Digital-Tag-2:
    BOOL "40001.1" %"Digital-Tag-2";
  3. To map holding register 40002 to an Analog Data Point Tag called Analog-Tag-1 where: Use:
    WORD "40002" %"Analog-Tag-1" Scale 655.35;
  4. To map holding registers 40003 & 40004 to an Analog Data Point Tag called Analog-Tag-2 writing a float value directly across 2 registers:
    REAL "40003" %"Analog-Tag-2";
  5. To map holding register 40005 to a Word Data Point Tag called Word-Tag-1:
    WORD "40005" %"Word-Tag-1";
  6. To map holding registers 40006 & 40007 to a Double Word Data Point Tag called DWord-Tag-2:
    DWORD "40005" %"DWord-Tag-1";

Editing the Data Map

To edit the data map, do one of the following:

In either case the Data Map Editor will open.

Data Map Syntax

The syntax of the data map is:

data-map ::=
  data-binding *

data-binding ::=
  data-type data-address tag-reference ['Offset' offset-value] ['Scale' scale-value];

data-type ::=
  BOOL | SINT | USINT | BYTE | INT | UINT | WORD | DINT | UDINT | DWORD |
LINT | ULINT | LWORD | REAL | LREAL | TIME | TIME_OF_DAY | TOD | DATE | DATE_AND_TIME | DT;

data-address ::=
  '"' address-value '"'

tag-reference ::=
  '%' '"' address-value '"'

offset-value ::=
  integer | real | time

scale-value ::=
  integer | real

Relationships to Other Tag Types

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

Further Information

Modbus Data Address Format

For a description of how Modbus data addressing works in Fernhill SCADA.

Common Core Tag

For properties common to all tag types.

Modbus Slave Serial Communication Channel

For more information on serial communications to the Modbus Virtual PLC Device.

Modbus Slave TCP Communication Channel

For more information on TCP/IP communications to the Modbus Virtual PLC Device.

Glossary

For the meaning of terms used in Fernhill SCADA.