24
the MQTT
broker
. Sample content for the most extensive option (when 91:
MqMo
=
FuLL
, maximum size 99B):
"AR6x2_1;PV=36.6 °C;MV1=100 %;MV2=100 %;MV3=0 %;cstat=0x0000;outA=7.320 mA;BIN=0" (AR6x2_
Addr
=
device name; PV = measurement value and unit; MV1 = value of the control signal for output 1; MV2 for the output
2;MV3 for output 3; cstat = work status of control algorithms, description in
chapter 11.5
;outA=
analog output
signal value mA / V; BIN = binary input status, 0 = closed, i.e. active).
Additionally, in order to optionally authorize the connection, the following fields are set in the MQTT packet:
client
ID
(created accordingto the template "
apar
MAC
",
where
MAC
is the EUI-48 hardware address of the
controller,
e.g.
"
aparFCC23D21C54A") and
user name
(as "
apar
PASS
", the last 2 digits of parameter 70:
PASS
, eg
" apar11"
) and
password
(parameter 70:
PASS
).
Protocol parameters useful for advanced needs: version 3.1.1, QOS = 0, retain = 1, keep alive = 0 (off).
In the event of frequent disconnection with the broker , check the reliability of the network/internet connection
(switch), test the possible impact of the message publication period (extend, recommended> 5s, parameter 97:
MqtP
), as well as MODBUS-TCP communication (temporarily stop if in use).
11.2. MODBUS–TCP SERIAL TRANSMISSION PROTOCOL
The MODBUS-TCP protocol is available for the Ethernet (RJ45) interface and uses the TCP/IP transport layer.
Parameters used by this service, such as the TCP port number, are described in
chapter 8,
Table 8, point VIII
.
The timeout for the MODBUS-TCP transmission, after which the open but unused port is closed, is 60s.
Available functions: READ - 3 or 4, WRITE - 6
Table 11.2.1. MODBUS-TCP protocol request frame format for the READ and WRITE functions
(frame length -
12B)
MODBUS protocol header (7 bytes)
Function
code
(READ or
WRITE)
register address
from
Table 11.5
(chapter 11.5)
number of registers to
read (1 ÷ 13) or value of a
register to write
Transaction and protocol
identifiers
Length field
(value = 6)
Unit ID
4 bytes
2 bytes
1 byte
1 byte
2 bytes (HB-LB)
2 bytes (HB-LB)
Example 11.2.1.
Reading a register with address 0: 0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x06 - 0xFF - 0x04 - 0x0000 -
0x0001
Table 11.2.2. Response frame format for the READ function
(minimum frame length - 11 bytes):
MODBUS protocol header (7 bytes)
Function
code
(READ)
number of bytes
in the data field (2
÷ 26)
data field - register
value (2B)
Transaction and protocol
identifiers
Length field
(max 29)
Unit ID
4 bytes
2 bytes
1 byte
1 byte
1 byte
2÷26
bytes (HB-LB)
Example 11.2.2
. The response frame for the register value equal to 0:
0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x05 - 0xFF - 0x04 - 0x01 - 0x0000
Table 11.2.3. Response frame format for the WRITE function
(frame length - 12 bytes)
copy of the query frame for the WRITE function (Table 11.2.1)
The error codes are the same as for the MODBUS-RTU protocol (
Table 11.4.5
)
Example 11.2.3.
Error frame for a non-existing register address to be read:
0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x05 - 0xFF - 0x84 - 0x02 - 0x0001