Benutzer-Werkzeuge

Webseiten-Werkzeuge


modbus_tcp_ip_en

Modbus TCP/IP

The Modbus TCP/IP driver can read and write (client mode) data points and registers from server devices. It can also provide data points and registers as a server device.

Each Modbus server can provide four different types of registers.

Holding register 16Bit register with read and write capability
Input register 16Bit register with read capability
Coil register 1Bit register with read and write capability
Status register 1Bit register with read capability

For the registers different read and write functions are used.

Register read Register write multiple linked registers (MultiWrite, default) (MultiWrite, default)
Holding 03 06 16
Input 04
Coil 01 05 15
Status 02

The name of the Modbus driver is: mbtcp
The routing address of the first driver is 860
The data points file of the first Modbus driver is: mbtcp1.txt
The configuration file for global settings of the first Modbus driver: mbtcp1.cfg

For the Modbus driver as well as all other gateway drivers the following definitions are valid:

Type Description
M Integer value (binary data points, counters) which can/shall only be read by the gateway
S Integer value which can be either read or written by the gateway. (to M-BUS writing is not possible)
X Floating point value (with decimal place) which can/shall only be read by the gateway
Y Floating point value (with decimal place) which can be either read or written by the gateway. (to M-BUS writing is not possible)
A String, is used e.g. with BACnet Trends and ESPA4.4.4 data points

Addresses are defined as follows:

<ip> <server/unit_ID> <register> <no>[.<bit>]

Communication state with Modbus server: „<server> failure“

While following definition is valid:

Parameter Range of value Description
<ip> Host Name or IP-address of the server device 0.0.0.0 means local (Modbus server Mode)
<server/unit_ID> 1 - 255 Address of the Modbus server device
<register> holding,
input,
coil,
status
Type of register
<no> 0 - 65535 register address
<bit> 0-15 / 0-1 Bit within the register / Byte within the register - depend on format

The address of the Coil-Register 120 of server „192.168.1.1 2“ is defined in the data point file mbtcpX.txt as follows:

[M 192.168.1.1 2 coil 120]

In order to inform the driver how to handle the stored information the format for each data point must be defined.:

format = <format> [S:<swap>] [F:<fact>] [O:<ofs>] [M:<mode>]

While <format> can be as follows:

<format> Description
BIT Bit within the register
UINT8 8bit unsigned
UINT16 16bit unsigned
UINT32 32bit unsigned
SINT8 8bit signed
SINT16 16bit signed
SINT32 32bit signed
FLOAT32 32bit IEEE754 floating point
FLOAT64 64bit IEEE754 floating point
FIXED32 32bit Integer
FIXED48 48bit Integer

For Coil- or status registers no format is required.

32bit-formats require more than one register, Missing registers are built from successing registers. Those registers are not available for following registers anymore!

For the correct interpretation of data points some devices require an inverted byte order of the register content. This can be solved by using the parameter <swap>.

When using the format BIT for single bits of holding or input registers the <swap> parameter will be ignored.

While <swap> can have following values:

<swap> Description
0 little endian (Intel)
1 big endian (Motorola, default)

The parameter „F:“ contains a factor. The value received will be divided by the value in „F:“ factor.

In order to enable integer values to contain decimal places the integer value is divided by the factor F:. A value can be multiplied by 10 on the sender's side and divided again on receiver's side by 10. E.g. a temperature of 20.5 °C will be transferred as „205“. To ensure a correct display of the temperature on receiver's side the format parameter „F:10.0“ will divide the value by 10 and the correct value of 20.5 will be displayed again.

Default value for factor is 1

Parameter „O“ represents an offset. This offset is added to the data point's value.

Parameter „M“ allows to link additional modes with the data point.

M: can have following values:

<mode> Description
0 MultiWrite (default, Modbus Function 15 for COIL, 16 for HOLDING)
1 SingleWrite (Modbus Function 5 for COIL, 6 for HOLDING)
2 Masked (Only for format „BIT“ in conjunction with 16Bit registers, Modbus Function 22)

Typical data point definitions for remote data point can be:

[M 192.168.1.1 2 status 5]
 name = digital operation mode statement
 query = pe
 format = BIT
[S 192.168.1.1 2 coil 10]
 name = digital given value   
 query = pe
 format = BIT
 writecache = yes
[M 192.168.1.1 2 input 10.3]
 name = digital operation mode statement
 query = pe
 format = BIT
[S 192.168.1.1 2 holding 11.5]
 name = digital given value
 query = pe
 format = BIT
 writecache = yes
[M 192.168.1.1 2 holding 15]
 name = multistate message z.B. 0, 1, 2 for Off, On, Auto
 query = pe
 format = UINT16
[S 192.168.1.1 2 holding 16]
 name = multistate given value e.g. level switch 0, 1, 2 for Off, On, Auto
 query = pe
 format = UINT16
 writecache = yes
[X 192.168.1.1 2 input 17]
 name = Temperature value (Register 17+18)
 query = pe
 format = FLOAT32
[Y 192.168.1.1 2 holding 17]
 name = Temperature given value, one decimal place
 query = pe
 format = SINT16 F:10
 writecache = yes

Typical local data points can be:

[S 0.0.0.0 2 status 5]
 name = digital operation mode statement
 query = pe
 format = BIT
 writecache = yes
[M 0.0.0.0 2 coil 10]
 name = digital given value
 query = pe
 format = BIT
[S 0.0.0.0 2 input 10.3]
 name = digital operation mode statement
 query = pe
 format = BIT
 writecache = yes
[M 0.0.0.0 2 holding 11.5]
 name = digital given value
 query = pe
 format = BIT
[S 0.0.0.0 2 holding 15]
 name = multistate message e.g. level switch 0, 1, 2 for Off, On, Auto
 query = pe
 format = UINT16
 writecache = yes
[M 0.0.0.0 2 holding 16]
 name = multistate message e.g. level switch 0,1,2 for Off, On, Auto
 query = pe
 format = UINT16
[Y 0.0.0.0 2 input 17]
 name = Temperature value (Register 17+18)
 query = pe
 format = FLOAT32
 writecache = yes
[X 0.0.0.0 2 holding 17]
 name = Temperature given value, one decimal place
 query = pe
 format = SINT16 F:10
modbus_tcp_ip_en.txt · Zuletzt geändert: 10.09.2020 17:49 von oni