8
Address Field
The address field of a message frame contains
8 bits. Valid slave device addresses are in the
range of 0 – 247 decimal. The individual slave
devices are assigned addresses in the range
of 1 – 247. (0 is reserved for broadcast mode,
which all slaves recognize.) A master
addresses a slave by placing the slave address
in the address field of the message. When
the slave sends its response, it places its own
address in this address field to let the master
know which slave is responding.
Function Field
The function field of a message frame contains
8 bits. Valid codes are in the range of 1 – 255
decimal. When a message is sent from a
master to a slave device, the function code
field tells the slave what kind of action to
perform.
When the slave responds to the master, it
uses the function code field to indicate either
a normal (error-free) response, or that some
kind of error occurred (called an exception
response). For a normal response, the slave
simply echoes the original function code. For
an exception response, the slave returns a
code that is equivalent to the original function
code with its most-significant bit set to a logic
1. In addition, the slave places a unique code
into the data field of the response message.
This tells the master what kind of error
occurred, or the reason for the exception. See
the
Exception Codes
section in this manual
for definitions.
Data Field
The data field is constructed using sets of two
hexadecimal digits, in the range of 00 to FF
hexadecimal. These are made from one RTU
character. The data field of messages sent
from a master to slave device contains
additional information which the slave must
use to take the action defined by the function
code. This can include items like coil or register
addresses, the quantity of items to be handled,
and the count of actual data bytes in the field.
The data field can have a length of zero.
CRC Check Field
Messages include an error-checking field that
is based on a cyclical redundancy check (CRC)
method. The CRC field checks the contents
of the entire message. It is applied regardless
of any parity check method used for the
individual characters of the message. The CRC
value is calculated by the transmitting device,
which appends the CRC as the last field in
the message. The receiving device
recalculates a CRC during receipt of the
message and compares the calculated value
to the actual value received in the CRC field.
If the two values are not equal, a bus timeout
results.
The error checking field contains a 16-bit binary
value implemented as two 8-bit bytes. When
this is done, the low-order byte of the field is
appended first, followed by the high-order byte.
The CRC high-order byte is the last byte sent
in the message.
Coil/Register Addressing
All data addresses in Modbus messages are
referenced to zero. The first occurrence of a
data item is addressed as item number zero.
For example:
The coil known as ‘coil 1’ in a programmable
controller is addressed as coil 0000 in the data
address field of a Modbus message. Coil 127
decimal is addressed as coil 007E
HEX
(126
decimal).
Holding register 40001 is addressed as register
0000 in the data address field of the message.
The function code field already specifies a
‘holding register’ operation. Therefore, the
‘4XXXX’ reference is implicit. Holding register
40150 is addressed as register 0095B
HEX
(149
decimal).
Modbus RTU
Message
Framing
Structure
(continued)
Содержание Mobrus RTU TR1 Series
Страница 30: ......