Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Current »

Connecting Modbus devices

Related articles are:

Connecting Modbus devices

Description

A virtual "Modbus TCP" sensor is used to read and write data from external equipment via Modbus TCP/IP protocol.
Support Wake-on-LAN standard that allows a remote device to be turned on or awakening by a network message.

Adding the Modbus reading virtual element

To create a "Modbus TCP (reading)" element, press add button "  " inside "Group tree" or "System tree" menu. Then choose "Modbus TCP (reading)". A modal window will appear:

Click on the "Modbus TCP (reading)". Modbus element form will be opened:

Fields in the form available for change:

NameDescription
NameCreated element name
User-defined typeDefines the icon to be displayed in the "System tree"
Units of measurementThe unit of measure in which the value is displayed in the "System tree"
Minimum valueDetermines the minimum measurement range, when the value is out of range, the sensor goes into "Not connected" state
Maximum valueDetermines the maximum measurement range, when the value is out of range, the sensor goes into a "Not connected" state
Alarm and warning levelsDefines the alarm and warning thresholds, as for other sensors, see Sensor configuration
HysteresisOption of setting the hysteresis state, see Sensor configuration
Expression

Function of the form f (x). The default value for the sensor is equal to the measured value: "x", ie corresponds to the expression "x". To calculate the indirect value of the sensor is possible to use an arbitrary expression, which are permissible "(", ")", as well as:

    • operators: "+", "-", "*", "/", "%" (remainder of the division), "^" (exponentiation);
    • functions: "abs","sqrt","exp","ln","log","sin","cos","tan","asin","acos","atan";
    • constants: "pi" (3.1415926...), "e" (2.7182818...)

        For example: "0.1*x+0.5"


The Modbus TCP configuration is available in the "Additional" tab:

Fields in the form available for change:

NameDescription
IP addressModbus TCP slave IP address of external equipment
PortModbus TCP slave port (default 502)
Slave addressSlave address of Modbus TCP
Register index

Modbus protocol register start address in hexadecimal view, like 0F4A

Function codeThe following functions are supported:
  • 0x01 - Read Coil Status
  • 0x02 - Read Input Status
  • 0x03 - Read Holding Register
  • 0x04 - Read Input Register
Data type

Determines how to present the data:

  • 16 bits signed int
  • 16 bits unsigned int
  • 32 bits signed int
  • 32 bits unsigned int
  • 32 bits IEEE floating point
Data ordering

Determines byte order in Modbus protocol response message:

  • low byte first, low word first
  • low byte first, high word first
  • high byte first, low word first
  • high byte first, high word first
Polling periodDefines the time of polling the sensor value. From 10 seconds to 5 minutes. 
Wake-on-LAN functionEnable the Wake-on-LAN function. Wake-on-LAN function can only be enabled if the Polling period is from 1 minute and more. 
Waiting timeWaiting time until the remote device turns on after the Wake-on-LAN command. From 1 to 15 seconds.
Device MAC addressWake-on-LAN command is sent for the MAC address of the remote device.  

To determine the MAC address of the remote device specified in the IP address field click "Get MAC". Make sure the remote device is turned on and is not in power saving mode.

The Test the button allows you to make a test connection with a Modbus device. In additional fields, the bytes sequence of connection, data is displayed, in hexadecimal form. Modbus raw answer - data of the received answer, without a header and checksum. Modbus value - contains the data value interpreted under the selected Data typeDo not forget that if the Wake-on-LAN function is enabled, before writing will be a delay at the set time Waiting time.

Adding the Modbus writing virtual element

To create a "Modbus TCP (writing)" element, press add button "  " inside "Group tree" or "System tree" menu. Then choose "Modbus TCP (writing)". Modbus element form will be opened:


Fields in the form available for change:

NameDescription
NameCreated element name
IP addressModbus TCP slave IP address of external equipment
PortModbus TCP slave port (default 502)
Slave addressSlave address of Modbus TCP
Register index

Modbus protocol register start address in hexadecimal views, like 0F4A

Function codeThe following functions are supported:
  • 0x05 - Write Single Coil
  • 0x06 - Write Single Register
Writing valueDecimal integer value that will be writing in the specified register
Wake-on-LAN functionEnable the Wake-on-LAN function
Waiting timeWaiting time until the remote device turns on after the Wake-on-LAN command. From 1 to 15 seconds.
Device MAC addressWake-on-LAN command is sent for the MAC address of the remote device.

To determine the MAC address of the remote device specified in the IP address field click "Get MAC". Make sure the remote device is turned on and is not in power saving mode.

The Test the button allows you to make a value entry immediately into the Modbus register. Do not forget that if the Wake-on-LAN function is enabled, before writing will be a delay at the set time Waiting time.

Now the Modbus TCP writing can be inserted as a THEN task in logic schemes:




Developer notes:

  • No labels