LXM32M

3 Basics

 

 

3.4.4"Function Code" 23 (ReadWrite Multiple Registers)

This "Function Code" 23 (ReadWrite Multiple Registers) allows you to read and write several consecutive parameters, starting at any address.

Modbus request Structure of the Modbus request:

Field

Bytes

Value

Meaning

 

 

 

 

Function Code

1

23 = 17h

Read/Write Multiple Registers

 

 

 

 

Read Starting

2

(various)

Address of the first parameter to be read

Address

 

 

 

 

 

 

 

Quantity To Read

2

2 * n

Number of 16 bit values to be read

 

 

 

(1 parameter has the value 2 since a parameter

 

 

 

consists of a 32 bit value)

 

 

 

 

Write Starting

2

(various)

Address of the first parameter to be written

Address

 

 

 

 

 

 

 

Quantity To Write

2

2 * m

Number of 16 bit values to be written

 

 

 

(1 parameter has the value 2 since a parameter

 

 

 

consists of a 32 bit value)

 

 

 

 

Write Byte Count

1

4 * m

Number of data bytes

 

 

 

 

Write Registers

4 * m

(various)

Parameter values

Value

 

 

 

 

 

 

 

Modbus response Structure of the positive Modbus response:

Field

Bytes

Value

Meaning

 

 

 

 

Function Code

1

23 = 17h

Read/Write Multiple Registers

 

 

 

 

Byte Count

1

2 * n

Number of data bytes

 

 

 

 

Read Registers

2 * n

(various)

Parameter values

Value

 

 

 

 

 

 

 

Structure of the negative Modbus response

Field

Bytes

Value

Meaning

 

 

 

 

Function Code

1

17h + 80h = 97h

Read/Write Multiple Registers

 

 

 

 

Exception Code

1

01h ... 04h

See chapter

 

 

 

"3.3.2 Modbus response to a Modbus request"

 

 

 

 

0198441113843, V1.01, 01.2012

Modbus-TCP module

31

Page 31
Image 31
Schneider Electric LXM32M manual Function Code 23 ReadWrite Multiple Registers