3 Basics | LXM32M |
|
|
3.4Modbus services - "Function Code"
The table below provides an overview of the available Modbus serv- ices:
"Function | Meaning under Modbus | Meaning from device per- |
Code" |
| spective |
|
|
|
3 | Read Multiple Registers | Reading a parameter |
|
|
|
8 | Diagnostics | Diagnostics |
|
|
|
16 | Write Multiple Registers | Writing a parameter |
|
|
|
23 | Read/Write Multiple Registers | Reading and writing parame- |
|
| ters |
|
|
|
43 | Read Device Identification | – |
Subcode14 |
|
|
|
|
|
90 | UMAS File Transfer (Upload) | – |
|
|
|
3.4.1"Function Code" 3 (Read Multiple Registers)
This "Function Code" 3 (Read Multiple Registers) allows you to read several consecutive parameters, starting at any address.
Modbus request Structure of the Modbus request:
Field | Bytes | Value | Meaning |
|
|
|
|
Function Code | 1 | 3 = 03h | Read Multiple Registers |
|
|
|
|
Starting Address | 2 | (various) | Address of the first parameter to be read |
|
|
|
|
Quantity Of Regis- | 2 | 2 * n | Number of 16 bit values to be read |
ters |
|
| (1 parameter has the value 2 since a parameter |
|
|
| consists of a 32 bit value) |
|
|
|
|
Modbus response Structure of the positive Modbus response:
Field | Bytes | Value | Meaning | |
|
|
|
|
|
Function Code | 1 | 3 | = 03h | Read Multiple Registers |
|
|
|
|
|
Byte Count | 1 | 4 | * n | Number of data bytes |
|
|
|
| |
Registers Value | 4 * n | (various) | Parameter values | |
|
|
|
|
|
Structure of the negative Modbus response
Field | Bytes | Value | Meaning |
|
|
|
|
Function Code | 1 | 03h + 80h = 83h | Read Multiple Registers |
|
|
|
|
Exception Code | 1 | 01h ... 04h | See chapter |
|
|
| "3.3.2 Modbus response to a Modbus request" |
|
|
|
|
0198441113843, V1.01, 01.2012
28 |