3 Basics | LXM32M |
|
|
3.4.3"Function Code" 16 (Write Multiple Registers)
This "Function Code" 16 (Write Multiple Registers) allows you to write several consecutive parameters, starting at any address.
Modbus request Structure of the Modbus request:
Field | Bytes | Value | Meaning |
|
|
|
|
Function Code | 1 | 16 = 10h | Write Multiple Registers |
|
|
|
|
Starting Address | 2 | (various) | Address of the first parameter to be written |
|
|
|
|
Quantity Of Regis- | 2 | 2 * m | Number of 16 bit values to be written |
ters |
|
| (1 parameter has the value 2 since a parameter |
|
|
| consists of a 32 bit value) |
|
|
|
|
Byte Count | 1 | 4 * m | Number of data bytes |
|
|
|
|
Registers Value | 2 * m | (various) | Parameter values |
|
|
|
|
Modbus response Structure of the positive Modbus response:
Field | Bytes | Value | Meaning |
|
|
|
|
Function Code | 1 | 16 = 10h | Write Multiple Registers |
|
|
|
|
Starting Address | 2 | (various) | Corresponds to the Modbus request |
|
|
|
|
Quantity Of Regis- | 2 | 2 * m | Corresponds to the Modbus request |
ters |
|
|
|
|
|
|
|
Structure of the negative Modbus response
Field | Bytes | Value | Meaning |
|
|
|
|
Function Code | 1 | 10h + 80h = 90h | Write Multiple Registers |
|
|
|
|
Exception Code | 1 | 01h ... 04h | See chapter |
|
|
| "3.3.2 Modbus response to a Modbus request" |
|
|
|
|
0198441113843, V1.01, 01.2012
30 |