Function codes
The inverter supports the following function codes:
|
Function code
|
Function name
|
Description
|
|
|
3
|
0x03
|
Read Holding Registers
|
Read one or more 16-bit data words.
|
|
6
|
0x06
|
Preset Single Register
|
Write a 16-bit data word.
|
|
16
|
0x10
|
Preset Multiple Registers
|
Write one or more 16-bit data words.
|
|
23
|
0x17
|
Read/Write 4X Registers
|
Within a transaction
–
write into a group of connected 4X holding registers.
–
read from a group of connected 4X holding registers.
|
Addressing
–
The function codes listed above exclusively refer to 4X registers in Modbus addressing.
–
All data in the inverter can only be accessed via 4X registers, i.e. via register addresses from 40001.
–
The 4xxxx reference is implicit, i. e. given by the function code used. In the
frame therefore the leading 4 is omitted in the addressing process.
–
Lenze supports the basic 1 addressing of Modbus, i.e. the numbering of the registers starts with 1 whereas addressing starts with 0.
For example, the address 0 is used in the frame when register 40001 is read.
Frame structure
Communication is established on the basis of the central medium access method. Communication is always started by a master request. The inverter (slave) then either gives a valid response or outputs an error code (provided that the request has been received and evaluated as a valid Modbus frame). Error causes can be invalid CRC checksums, function codes that are not supported, or impermissible data access.
All Modbus frames have the following basic structure:
–
A "frame" consists of a PDU (Protocol Data Unit)
and an ADU (Application Data Unit).
–
The PDU contains the function code and the data belonging to the function code.
–
The ADU serves the purposes of addressing and error detection.
–
The data are represented in Big Endian format (most significant byte first).
|
ADU (Application Data Unit)
|
|||
|
Slave address
|
Function code
|
Data
|
Checksum (CRC)
|
|
PDU (Protocol Data Unit)
|
|||
Error codes
In the event of an error, the Modbus node responds with a function code associated with the message:
|
Function code
|
Associated function code in the event of an error
|
Supported error codes
|
|
0x03
|
0x83
|
0x01, 0x02, 0x03, 0x04
|
|
0x06
|
0x86
|
0x01, 0x02, 0x03, 0x04
|
|
0x10
|
0x90
|
0x01, 0x02, 0x03, 0x04
|
|
0x17
|
0x97
|
0x01, 0x02, 0x03, 0x04
|
|
Error code
|
Designation
|
Cause(s)
|
|
0x01
|
Invalid function code
|
The function code is not supported by the inverter, or the inverter is in a state in which the request is not permissible or in which it cannot be processed.
|
|
0x02
|
Invalid data address
|
The combination of a start address and the length of the data to be transmitted is invalid.
Example: If you have a slave with 100 registers, the first register has the address 0 and the last register has the address 99. If there is a request of four registers now, from the start address 96, the request can be processed successfully (for registers 96, 97, 98, and 99). If, however, five registers from the start address 96 are queried, this error code is returned, since the slave has no register with the address 100.
|
|
0x03
|
Invalid data value
|
Error in the reset structure of a complex request, e. g. because the data length that has resulted implicitly is not correct.
The cause, however, is not that a (parameter) value is written outside the valid setting range. As a matter of principle, the Modbus protocol has no information on valid setting ranges of single registers or their meaning.
|
|
0x04
|
Slave device failure
|
A non-correctable error has occurred while the request was processed in the inverter.
|