Modbus Function Code 3

Read Multiple Holding Registers on Modbus

It is used for reading contents on a contiguous block of holding registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered 1-16 are addressed as 0-15.

Request

Function code1 Byte0x03
Starting Address2 Bytes0x0000 to 0xFFFF
Quantity of Registers2 Bytes1 to 125 (0x7D)
Table 1 - Command structure

Response

The register data in the response message is packed in two byte values per register (Table 2). For each register, the first byte contains the high order bits and the second contains the low order bits.

Function code1 Byte0x03
Byte count1 Byte2 x N*
Register valueN* x 2 Bytes
*N = Quantity of Registers
Table 2 - Response structure

Error

Error code1 Byte0x83
Exception code1 Byte01 or 02 or 03 or 04
Table 3 - Error structure. Scroll below for details.

Example

Request

This command is requesting the content of analog output holding registers # 40112 to 40114 from the slave device with address 11. Each register contains 16 bits.

0B 03 006F 0003 357C
  • 0B: The Slave Address (0B hex = address 11)
  • 03: The Function Code 3 (Read Multiple Holding Registers)
  • 006F: The Data Address of the first register requested (006F hex = 111, +40001 offset = input #40112).
  • 0003: The total number of registers requested (read 3 registers 40112 to 40114).
  • 357C: The CRC (Cyclic Redundancy Check) for error checking.

Response

0B 03 06 AE41 5652 4340 FACD
  • 0B: The Slave Address (0B hex = address 11)
  • 03: The Function Code 3 (Read Multiple Holding Registers)
  • 06: The number of data bytes to follow (3 registers x 2 bytes each = 6 bytes)
  • AE41: The contents of register 40112
  • 5652: The contents of register 40113
  • 4340: The contents of register 40114
  • FACD: The CRC (Cyclic Redundancy Check)

Workflow Diagram for Modbus FC 3

read states of multiple holding registers
Figure 1 - Read states of Multiple Holding Registers

Contents retrieved from

  • http://modbus.org/
  • http://www.simplymodbus.ca/

More information