![Aquaread BlackBox Скачать руководство пользователя страница 64](http://html.mh-extra.com/html/aquaread/blackbox/blackbox_instruction-manual_2960649064.webp)
Aquaread BlackBox™ Instruction Manual
10401-00618 Rev P
9.4. Data Packet Format
All Modbus data packets have the format:
Field
Size
Content
<a>
1 byte
Slave address (valid values 0x01-0xF7 when a single slave is
addressed, 0x00 for commands broadcast to all slaves)
<function-code>
1 byte
Function code that identifies the function of the data packet (valid
values 0x01-0x7F for commands & successful responses, 0x81-
0xFF for exception responses)
<data>
0-252 bytes Function dependent data
<crc>
2 bytes
16-bit cyclic redundancy check
In broadcast commands sent by the master, the address byte will contain 0. In unicast
commands, the address byte will contain the address of the slave device to which the
command is being sent.
In responses from slaves, the address byte will contain the address of the slave which
generated the response.
If the BlackBox successfully handles a command, its response will contain the same
function code as the command. If it cannot successfully handle a command, the Black Box
will generate an exception response with the function code set to 0x80 + the command's
function code.
In the <data> field, numerical values of size greater than 8 bits are transmitted most
significant byte first. In the <crc> field, the CRC is transmitted least significant byte first.
The maximum packet size is 256 bytes.
Table 3 summarises the Modbus functions supported by the BlackBox and the following
subsections describe their command & response packet formats.
Function
Function Code
Read Holding Registers
0x03
Read Input Registers
0x04
Write Holding Register
0x06
Write Holding Registers
0x10
Report Slave ID
0x11
Table 3: Supported Modbus Functions
9.4.1. Exception Responses
If a command is unsupported or has invalid parameters, the BlackBox will return an
exception response of the format:
Field
Size
Content
<a>
1 byte
Slave address
<exception-function-code>
1 byte
Function code of the c 0x80
<exception-code>
1 byte
The type of exception
1 – Unsupported command function code
2 – Invalid data address in command
3 – Invalid data value in command
<crc>
2 bytes
CRC
© 2019 Aquaread Ltd.
www.aquaread.com
Page 64 of 71