Operations Tab

<< Click to Display Table of Contents >>

 

Operations Tab

This topic describes how to configure the Operations tab on this Driver's configuration window, where all operations used on I/O Tags are defined, as shown on the next figure.

Configuring operations is no longer used when configuring Tags by Strings, it is only used in the old numerical configuration, the N/B parameters, on Elipse SCADA.

Operations tab on this Driver's configuration window

Operations tab on this Driver's configuration window

Operations

For a proper usage of this Driver, users must define which reading and writing Modbus functions are used for each I/O Tag. To do so, if Tag configuration is performed using the old N/B numerical parameters in Elipse SCADA, select the Operations tab on the configuration window.

For this Driver, Operations are configurations defining how each I/O Tag performs data writings and readings to and from a device.

An operation is simply a definition of a pair of protocol functions, one for writing and another one for reading, and a specification for additional conversions on the format of data that can be linked to application Tags. In other words, in this Driver the N or B numerical parameters of I/O Tags do not directly reference protocol functions, but rather pre-configured operations, which by their turn not only inform functions, protocol's native or even special ones, to use when communicating, as well as the way native protocol data must be interpreted.

Configuration of I/O Tag parameters is described later on topic Configuring an I/O Tag. Next, there is a description of the configuration of operations, which must be later linked to each I/O Tag.

 

NOTE

Operations work only as a template to configure I/O Tags, and user can, and usually want to, set a single operation to several Tags, which have in common the same value for their N2/B2 parameters.

 

Functions

The Modbus protocol defines reading and writing functions, which can access distinct address spaces on a device, and with specific data types. Functions 03 and 16, for example, protocol's most used ones, are responsible for reading and writing Holding Registers, which are simply 16-bit unsigned integer values (Words).

Modbus protocol's default functions provide data only in basic 16-bit Bit and Word formats. There are no additional data formats in protocol's specification.

A list of all Modbus functions supported by this Driver, which can be set to the configured operations, can be checked on topic Supported Functions.

In addition to protocol functions, this Driver also contains some Special Functions that are not part of protocol's standard, with a proprietary format and commonly used for reading events (SOE).

 

Data Formatting

In addition to allow linking functions, from the protocol or special ones, to specific Tags, operations also allow defining an additional formatting to apply to data, providing support to additional data types, not specified by the protocol, such as 32-bit (Float) and 64-bit (Double) floating point values. Supported data types are described on topic Supported Data Types.

It is important to notice that, when 32- and 64-bit data types are defined in operations, users must define protocol functions that work with 16-bit registers. This way, reading data with more than 16 bits results in reading several 16-bit Modbus registers from a device, that is, to read a Tag linked to an operation defining a 32-bit Float data type, this Driver must read two consecutive 16-bit registers from a device, concatenate them, and then perform a conversion to a Float format.

Users can also define eight-bit data types, Byte, Int8, or Char, in operations. Notice that, as protocol functions do not allow reading and writing isolated bytes, for each two Block Elements of eight-bit data types, this Driver is forced to access a distinct 16-bit register on a device. For that reason, this Driver does not allow writing eight-bit data types to Tags, to isolated Block Elements, or to Blocks with odd or unitary sizes. Writing eight-bit data types must be always performed with even-size Blocks.

 

User-Defined Data Types

In addition to pre-defined data types, native or built-in data types, described on topic Supported Data Types, this Driver also allows user-defined data types. These data types must be declared on a specific window, by clicking User Defined Types on the Operations tab. Such data types are structures created from pre-defined data types. For more information about user-defined data types, please check topic User-Defined Data Types.

 

Byte Order

In addition to protocol's reading and writing functions and the data type used, each operation also allows setting additional manipulations to bytes, related to a byte order, that is, the order of bytes inside every value. These are called swap options, Swap Bytes, Swap Words, and Swap DWords. Such options only need to be enabled for devices that do not respect protocol's default byte order.

The Modbus protocol defines that its 16-bit values always use a byte order known as big endian, also known as Motorola, because it is used by that manufacturer. The big endian standard always defines a byte order so that the most significant byte of each value comes first. Thus, as an example, when reading the hexadecimal value 1234h, the device first sends the most significant byte 12h and then the least significant one, 34h.

For devices that do not implement protocol's default byte order, and use another one known as little endian or Intel, data is sent with the least significant bytes first. Users must then enable those swap options to reverse that byte order.

There are also devices that use different byte orders for 32- and 16-bit types. For devices that, for example, use Modbus' default byte order (big endian) for 16-bit types, but provide 32-bit data with the least significant Word first (little endian), users must only enable the Swap Words option, leaving the Swap Bytes option deselected. Possible situations are the following:

For devices that provide data using Modbus' default byte order, Motorola or big endian, with the most significant bytes first, users must left all swap options disabled. This is the most common situation

For devices using another byte order standard, with the least significant bytes first, little endian, users must enable all swap options referring to the data type used, that is, for 16-bit types, enable the Swap Bytes option. For 32-bit data types, enable the Swap Bytes and Swap Words options. For 64-bit types, all these swap options must be enabled

In the least common case, devices that use different byte orders for different data sizes, providing, for example, the most significant byte of each Word first, but the least significant Word of each DWord first, then users must evaluate in which case each swap option must be enabled, so that it converts a value returned by a device to protocol's default big endian format

 

NOTE

All mentioned swap options have no effect for Bit data types or for data types with an eight-bit size, Byte, Char, and Int8. Swapping occurs inside every data type, that is, the Swap Words option has no effect for 16-bit data types, as well as the Swap DWords option has no effect for 32-bit data types. BCD data types also do not allow swapping.

 

To check if a device uses some unusual byte order format, check its manufacturer's documentation. In case this information is not found on that documentation, please contact manufacturer's technical support.

The topic Frequently Asked Questions contains tips on byte order configurations for some devices that are known to use swap options.

 

Bit Mask

The Use Bit Mask option is an advanced feature, used in specific and unusual cases where users want to read only a bit from the value returned by a device, but they cannot use application's bit mapping.

For most users, application's bit mapping fields are the best alternative to access bit masks, and there is no need to use this Driver's feature.

This feature was initially created to allow reading bits from Holding Registers by specialized E3 libraries, in situations that prevented the usage of application's bit mapping.

In this case, this Driver reads a value from a device normally and then masks it, to return to Tag's Value field only the specified bit, 0 (zero) or 1 (one). The definition of a bit number to return is performed on I/O Tag's N3/B3 parameter.

The Use Bit Mask option can only be used with integer data types with 16 bits or more (Int16, Int32, Word, or DWord). In addition, operations that enable this option can only be used for reading. The Modbus function for writing operations (Write) that use this mask option can be defined as None.

 

Driver's Default Operations

By default, when a new Driver is added to an application, that Driver is already created with default operations, described on the next table.

Default operations

Operation

Reading

Writing

Data Type

Purpose

1

3 - Read Holding Registers

16 - Write Multiple Registers

Word

Reading and writing unsigned 16-bit integers

2

3 - Read Holding Registers

16 - Write Multiple Registers

DWord

Reading and writing unsigned 32-bit integers

3

3 - Read Holding Registers

16 - Write Multiple Registers

Int16

Reading and writing signed 16-bit integers

4

3 - Read Holding Registers

16 - Write Multiple Registers

Int32

Reading and writing signed 32-bit integers

5

3 - Read Holding Registers

16 - Write Multiple Registers

Float

Reading an writing 32-bit floating point values

6

1 - Read Coil Status

15 - Write Multiple Coils

Bit

Reading and writing bits

7

2 - Read Discrete Inputs

None

Bit

Reading bits from a Discrete Input data block

 

These operations are the most commonly used, and operation 1 (one) is the most common one. For most devices, select all operations needed among the ones provided by default, there is no need to create new operations or change the configuration of these default operations.

 

Defining New Operations

To add a new operation to this Driver, click Add.

Adding a new operation

Adding a new operation

To configure this new operation, select a number for it, used on I/O Tag's N2/B2 parameter, which function to use for reading, and which function to use for writing, as well as informing a data type to be read or written by this Driver. Notice that, when clicking Add, this Driver already suggests a value that is not in use for this new operation.

For more information about supported data types, please check topic Supported Data Types. All other fields can be configured as needed. The next table contains a description of these fields.

Field options for operations

Option

Description

Size

A size in bytes of each element of the selected data type must be informed. This field is automatically filled in for fixed-size data types, such as Byte, Word, and Int16, and it must be filled in for String and BCD data types. For Strings, this size defines exactly the number of bytes sent or received for each String value, that is, for each Tag or Block Element. If the String read or written has a shorter size, the remaining bytes are filled in with zeroes to complete its configured size. The String data type in this Driver has no defined maximum limit size, this limit is the maximum allowed by the protocol for frame's data area of a certain function

Swap Bytes

Indicates that this Driver must reverse the byte order, one by one, to retrieve a value

Swap Words

Indicates that this Driver must reverse the byte order, two by two, in Words, to retrieve a value

Swap DWords

Indicates that this Driver must reverse the byte order, four by four, in DWords, to retrieve a value

Use Bit Mask

Enables a bit masking of registers, using the N3/B3 parameter. This option only affects readings and can only be used with integer data types, signed or unsigned, with at least 16 bits of size, Int16, Int32, Word, or DWord. Operations with this option enabled cannot be used for writing. For most users, it is recommended to use application's bit mapping, and leave this option deselected. For more information, please check the specific section

 

Protocol functions that can be configured in operations' Read and Write fields are described on topic Supported Functions. The next table describes each one of the available options.

Available options on the Operations tab

Option

Description

Import Configuration

This option allows importing configurations for operations from versions prior to Modbus Master/Slave Driver version 2.0, which stored these configurations on a modbus.ini file. This Driver does not use INI files anymore to store such configurations, which are now stored on the application file. For more information, please check topic Import and Export Operations

Export Configuration

This option executes the opposite operation of the previous option, generating an INI file containing all operation configurations, in the current format or in the same format of this Driver's previous versions. This way, users can store operation configurations of a certain device on a file, and these configurations can be used by other applications. For more details, please check topic Importing and Exporting Operations

Show Operations in Tag Browser

If this option is not selected (default), templates of Tags configured by Strings (Device and Item fields) are displayed on Tag Browser. If it is selected, templates of Tags numerically configured (N/B parameters) are displayed on Tag Browser. When creating new instances of this Driver, this option is deselected by default. In legacy applications, when this Driver's version is updated from a version previous to 3.1, this option is already selected, keeping the behavior of previous versions

Add

Adds a new operation to the list

Edit

Updates the selected operation on the list, which is equivalent of double-clicking an item

Remove

Removes the selected operation from the list

 

NOTE

The Swap Bytes, Swap Words, and Swap DWords options, as already explained, were added to provide compatibility with devices that do not comply with Modbus protocol's standard on data encoding (byte order). If these options remain disabled, this Driver's behavior corresponds to protocol's standard, which is the recommended option for most devices.

Was this page useful?