Language selection:
Skip to main navigation Skip to main content Skip to page footer

Introduction to the creation of virtual Modbus TCP elements

A virtual Modbus TCP sensor is used to read and write data from external devices, counters, and sensors via the Modbus TCP/IP protocol. Please note that your IoT-enabled Didactum measuring and control device must be equipped with firmware version "didactum-2.8.3-b333" or higher. Didactum devices support the Modbus TCP/IP protocol from this firmware version onwards.

Adding the virtual element Modbus-TCP Read

To create a "Modbus TCP (Read)" element in the IoT-enabled measurement and control system, go to the "System Tree" menu and then click the "+" button in the upper right corner. The "Add a new element" selection menu will then appear.

After clicking on "Modbus TCP (Read)," a new window labeled "Modbus TCP (Read)" will open.

Description of the settings in the menu “TCP mode (read)”:

#NameDescription
1Name:Label / name of the element (can be named individually).
2User‑defined type:Defines the symbol displayed in the “System tree” of the Didactum system.
3Units of measurement:The unit in which the value is displayed in the “System tree”.
4Minimum value:Defines the minimum measurement range; if the value is outside this range, the sensor switches to the state “Not connected”.
5Maximum value:Defines the maximum measurement range; if the value is outside this range, the sensor switches to the state “Not connected”.
6Alarm and warning levels:Alarm and warning thresholds of the Modbus TCP element are configured here.
7Hysteresis:Option to create a hysteresis function for the Modbus‑TCP read element.
8Expression:Function of the form f(x). The default value for the sensor equals the measured value: “x”, i.e., corresponds to the expression “x”. To calculate an indirect sensor value, any of the following allowed expressions can be used: "(", ")", as well as:
•    Operators: "+", "-", "*", "/", "%", "^" (power);
•    Functions: "abs", "sqrt", "exp", "ln", "log", "sin", "cos", "tan", "asin", "acos", "atan";
•    Constants: "pi" (3.1415926...), "e" (2.7182818...) 
Example: "0.1*x+0.5"

On the “Additional” tab of the “Modbus TCP (read)” menu the following fields are available:

Description of the menu items:

#NameDescription
1IP addressModbus TCP slave IP address of the external equipment.
2PortModbus TCP slave port (standard port: 502).
3Register indexStarting address of the Modbus protocol registers in hexadecimal notation, e.g. “0F4A”.
4Function codeThe following functions are supported by the Didactum system:
•   0x01 – Read Coil Status
•   0x02 – Read Input Status
•   0x03 – Read Holding Register
•   0x04 – Read Input Register
5Data typeDefines how the data should be interpreted:
•   16 bits signed int
•   16 bits unsigned int
•   32 bits signed int
•   32 bits unsigned int
•   32 bits IEEE floating point
6Data orderingDetermines the byte order in the Modbus protocol response:
•   low byte first, low word first
•   low byte first, high word first
•   high byte first, low word first
•   high byte first, high word first
7Polling periodDefines the time interval for querying the sensor value. Polling intervals from 10 seconds up to a maximum of 5 minutes are supported.

Additional notes: Using the “Test” button you can establish a test connection to a Modbus device. Additional fields display the byte sequence of the connection data in hexadecimal format.

“Modbus raw answer” – contains the received answer data without header and checksum. “Modbus value” – contains the data value interpreted according to the selected data type.

Adding the virtual Modbus TCP element "write"

To create a "Modbus TCP (write)" element in the SNMP-compatible Didactum measurement and control system, click the "+" button in the "System Tree" menu. Select the "Modbus TCP (write)" entry. The Didactum device will then open the following menu:

The following fields are offered to you in this menu:

#NameDescription
1Name:Label / name of the element (can be named individually).
2IP address:Modbus‑TCP slave IP address of the external device.
3Port:Modbus‑TCP slave port (standard 502).
4Register index:Starting address of the Modbus protocol registers in hexadecimal notation, e.g. “0F4A”.
5Function code:The following functions are supported by the Didactum monitoring & control device:
0x05 – Write Single Coil
0x06 – Write Single Register
6Write value:Decimal integer value that is to be written to the specified register.

Notes: Using the “Test” button you can immediately write a value into the Modbus register. Now writing via Modbus TCP can be added as an action in the “Logic Schemes” menu entry:

This website uses cookies

This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Cookie Policy.

Essential cookies enable basic functions and are necessary for the website to function properly.
Statistics cookies collect information anonymously. This information helps us to understand how our visitors use our website.
Marketing cookies are used by third parties or publishers to display personalized advertisements. They do this by tracking visitors across websites.