Tag of Analog Input

<< Click to Display Table of Contents >>

Navigation:  Modbus Universal MasterOPC Server > Quick Start > Example2 - Device Connection via Modbus RTU >

Tag of Analog Input

Let's start from a tag for a poll of an input analog value.

In order to define an address and a register type of a variable required, you should refer to documentation of a network protocol of the device. In Modbus, there are 4 main regions: Coils, Discrete Inputs, Holding Registers and Input Registers, and each function has the specified number, which the Master (in our case, the OPC server) must send when requesting a device. Some manufacturers specify region names in a map of Modbus registers, but others specify function numbers.

Compliance region Modbus read and write functions

Region

Read function

Write function

Coils

0x01

0x05 - single, 0x0F - multiply

Discrete_Inputs

0x02

not supported

Holding_Registers

0x03

0x06 - single, 0x10 - multiply

Input_Registers

0x04

not supported

Refer to the page 12 of the device protocol documentation:

teg_vkhodnogo_znacheniya

In Jumo devices, function numbers are specified. In our case, a device for reading  supports the function 0x03 or 0x04; that is, we can set the tag region Holding Registers or Input Registers. It is better to use the Holding Registers region because we are going to write to setpoints as well.  

Refer to the page 22 of the device documentation, and find the variable required, Analog Input.

teg_vkhodnogo_znacheniya1

Our tag has the address 0x2B, the data type Float, and the access type ReadOnly. A tag region will use Holding Registers. Now we know all tag parameters, therefore let's add it to the OPC server.

In the device context menu, click the command Add - Tag.

teg_vkhodnogo_znacheniya2

In the window displayed, set a tag name (Value) and specify other parameters: Region - Holding Registers, Data Type in Device and Data Type in Server - Float, Access Type - ReadOnly.

Some words about setting a register address. In the Modbus OPC server, all addresses are set in the decimal format. In the device documentation, a device address is specified in the HEX format - 0x2B. The OPC server is supplied with the function of automatic conversion from HEX to DEC. To use that function, input into the field an address 0xYourAddress and click Enter;  this converts a HEX number to the DEC format, and, the left of the field, the initial HEX number is displayed for clarity.

teg_vkhodnogo_znacheniya3

In addition, some words about the Byte Swapping setting. If a byte swapping is set incorrectly,  the OPC server receives incorrect data. According to the Modbus standard,  the High word first byte sequence order  is used for 4-byte numbers (Float, Int32, Uint32). Open the byte swapping editor, and set the byte sequence order required.

teg_vkhodnogo_znacheniya4

Click OK to add the tag to the tree,  

teg_vkhodnogo_znacheniya5