WF-2000 Series Wi-Fi I/O
User’s Manual (Ver. 1.0, Sep./2012) ------------- 48
Modbus response from a server to a client contains the data requested.
If an error related to the Modbus function requested occurs, the field
contains an exception code that the server application can use to
determine the next action to be taken.
For example a client can read the ON/OFF states of a group of
digital input or output or it can read/write the data contents of a group of
registers.
When the server responds to the client, it uses the function code field
to indicate either a normal response or that some kind of error occurred
(called an exception response). For a normal response, the server
simply echoes to the request the original function code.
For an exception response, the server returns a code that is
equivalent to the original function code from the request PDU with its
most significant bit set to logic 1.
5.2.5 Data Encoding
Modbus uses a “big-endian” representation for address and data
items. This means that when a numerical quantity larger than single byte
is transmitted, the most significant byte (MSB, also called the high-order
byte) is send first. The following sub-topics describe the different byte of
encoding and show how the data is encoded as it is within the
Modbus/TCP packet.
5.2.5.1
Binary
A binary item is represented as a single bit within a data word. All
binary is packed into 16-bits data words, which are accessed using
function code 01 and 02. Therefore, a single register contains 16 bits of
binary data, each having a specific meaning.
Table 5-3: A single register contains 16 bits of binary data
Value
1st
2nd
0xAA55
(1010101001010101)
0xAA
(10101010)
0x55
(01010101)
ГК
Атлант
Инжиниринг
–
официальный
представитель
в
РФ
и
СНГ
+7(495)109-02-08 [email protected] www.bbrc.ru