![APAR AR654 Скачать руководство пользователя страница 39](http://html1.mh-extra.com/html/apar/ar654/ar654_user-instruction_2951917039.webp)
39
Table 18.3. Response frame format for the READ
function (minimum frame length - 7 bytes):
address of
the device
function 4 or
3
number of bytes in the data
field (max. 66*2=132 bytes)
data field - register value
CRC check sum
1 byte
1 byte
1 byte
2 ÷ 132
bytes (HB-LB)
2 bytes (LB-HB)
Example 18.3
. Response frame for register value equal to 0: 0x01 - 0x04 - 0x02 - 0x0000 - 0xB930
Table 18.4. Response frame format for the WRITE
function (frame length - 8 bytes):
copy of the request frame for the WRITE function (Table 18.2)
Table 18.5. Special answer
(function field = 0x84 or 0x83 in the case of the READ function and 0x86 in the case of
the WRITE function):
Error code
(HB-LB in the data field)
Error description
0x0001
non-existing register address
0x0002
wrong write register value
0x0003
improper function number
Example 18.5.
Error frame for a non-existing read register address:
0x01 - 0x84 - 0x02 - 0x0001 –0x5130
19. MODBUS–TCP SERIAL TRANSMISSION PROTOCOL
The MODBUS-TCP protocol is accessible to the Ethernet (RJ45) interface and uses the TCP/IP transport layer. The
parameters used by the service, to include the TCP port number, are described in chapter 12.8.
Available functions
: READ - 3 or 4, WRITE - 6
Table 19.1. Request frame format of the MODBUS-TCP protocol for the READ and WRITE functions
(frame
length -12B)
Heading of the MODBUS protocol (7 bytes)
Function
code
(READ or
WRITE)
register address
from Table 20
(chapter 20)
number of read registers
(1 ÷ 66) or value of write
register
Transaction and protocol
identifiers
Length field
(value = 6)
Unit identifier
4 bytes
2 bytes
1 byte
1 byte
2 bytes (HB-LB)
2 bytes (HB-LB)
Example 19.1.
Reading of a register with address 0: 0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x06 - 0xFF - 0x04 - 0x0000 - 0x0001
Table 19.2. Response frame format for the READ
function (minimum frame length - 11 bytes):
Heading of the MODBUS protocol (7 bytes)
Function
code
(READ)
number of bytes
in the data field (2
÷ 132)
data field - register
value (2B)
Transaction and protocol
identifiers
Length field
(maximum 135)
Unit identifier
4 bytes
2 bytes
1 byte
1 byte
1 byte
2 ÷ 132
bytes (HB-LB)
Example 19.2
. Response frame for register value equal to 0:
0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x05 - 0xFF - 0x04 - 0x01 - 0x0000
Table 19.3. Response frame format for the WRITE
function (frame length - 12 bytes)
copy of the request frame for the WRITE function (Table 19.1)
The error codes are the same as in the case of the MODBUS-RTU protocol (Table 18.5)
Example 19.3.
Error frame for a non-existing read register address:
0x00 - 0x00 - 0x00 - 0x00 - 0x00 - 0x05 - 0xFF - 0x84 - 0x02 - 0x0001