Modbus Function Codes; Supported Function Codes; Read Actual Values Or Settings (Function Code 03/04H); Master And Slave Device Packet Transmission Example - GE UR Series Manual

Hide thumbs Also See for UR Series:
Table of Contents

Advertisement

MODBUS FUNCTION CODES

Algorithm
2
2.2 Modbus function codes

2.2.1 Supported function codes

Modbus officially defines function codes from 1 to 127 though only a small subset is generally needed. The relay supports
some of these functions, as summarized in the following table. Subsequent sections describe each function code.
Table 2-4: Function codes
Function code
Hex
Dec
03
3
04
4
05
5
06
6
10
16

2.2.2 Read actual values or settings (function code 03/04h)

This function code allows the master to read one or more consecutive data registers (actual values or settings) from a
relay. Data registers are always 16-bit (two-byte) values transmitted with high order byte first. The maximum number of
registers that can be read in a single packet is 125. See the
Since some PLC implementations of Modbus only support one of function codes 03h and 04h. The UR interpretation allows
either function code to be used for reading one or more consecutive data registers. The data starting address determines
the type of data being read. Function codes 03h and 04h are therefore identical.
The following table shows the format of the master and slave packets in Modbus RTU. Modbus TCP/IP ADUs have a MBAP
instead of slave address, and CRC is in another stack layer. The example shows a master device requesting three register
values starting at address 4050h from slave device 11h (17 decimal); the slave device responds with the values 40, 300,
and 0 from registers 4050h, 4051h, and 4052h, respectively.
Table 2-5: Master and slave device packet transmission example
Master transmission
Packet format
SLAVE ADDRESS
FUNCTION CODE
DATA STARTING ADDRESS - high
DATA STARTING ADDRESS - low
2-4
1.
FFFF (hex) --> A
2.
0 --> i
3.
0 --> j
4.
Di (+) Alow --> Alow
5.
j + 1 --> j
6.
shr (A)
7.
Is there a carry?
8.
Is j = 8?
9.
i + 1 --> i
10.
Is i = N?
11.
A --> CRC
Modbus definition
Read holding registers
Read holding registers
Force single coil
Preset single register
Preset multiple registers
Example (Hex)
11
04
40
50
No: go to 8; Yes: G (+) A --> A and continue.
No: go to 5; Yes: continue
No: go to 3; Yes: continue
GE Multilin definition
Read actual values or settings
Read actual values or settings
Execute operation
Store single setting
Store multiple settings
Memory map
section on page 2-9 for the data registers.
Slave response
Packet format
SLAVE ADDRESS
FUNCTION CODE
BYTE COUNT
DATA #1 - high
CHAPTER 2: MODBUS COMMUNICATION
Example (Hex)
11
04
06
00
UR SERIES – COMMUNICATIONS GUIDE

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents