www.accuenergy.com
23
V: 1.0 Revised: Sept. 2019
Chapter 9: Description of Modbus-TCP Protocol
9.1.3 Function Field
The function code field of a message frame contains eight bits. Valid codes are in the range
of 1-255. When a message is sent from a client to a server device, the function code field
tells the server what kinds of action to perform.
Code
Meaning
Action
02
Read Digital Input (DI) Status Obtain current status of Digital Input
03
Read Data
Obtain current binary value in one or more
registers
16
Write Multiple-registers
Place specific value into a series of consecu-
tive multiple-registers
9.1.4 Data Field
The data field is constructed using sets of two hexadecimal digits, in the range of 00 to FF.
The data field of messages sent from a master to slave contains additional information
which the slave must use to take the action defined by the function code. This can include
information such as the register addresses, the quantity of registers to query and the count
of the actual number of data bytes. For example, if the master requests a slave to read a
group of holding registers(function code 03), the data field specifies the starting register
and how many registers are to be read.
If the master needs to write data(function code 10 hexadecimal) to a group of registers
in the slave, the data field specifies the starting register, how many registers to write, the
count of data bytes to follow in the data field and the data to be written into the registers.
9.2 Format of communication
9.2.1 Explanation of frame
Transaction
identifier hi
Transaction
identifier lo
Protocol
identifier hi
Protocol
identifier lo
Length hi
Length lo
Unit
identifier
00H
00H
00H
00H
00H
06H
01H