| Name | Type | Section | Description |
|---|---|---|---|
| stationAddress | UINT |
Input | Modbus RTU station address |
| holdingRegister | ARRAY[*] OF BYTE |
Input/Output | A buffer to be read or written. |
| NDR | BOOL |
Output | TRUE, if new data was written by the Modbus master |
| DR | BOOL |
Output | TRUE, if the instruction has stored the data received by the Modbus master in the target area. |
| error | BOOL |
Output | TRUE, for one cycle once the instruction has been completed with an error. |
| status | WORD |
Output | Error code. See Parameter Status. |
The function codes of the Modbus communication (1, 2, 4, 5 and 15) can read and write bits and words directly in the process image input and in the process image output of the CPU. The holdingRegister parameter must be defined as data type greater than one byte for these function codes. The table below shows the sample assignment of Modbus addresses to the process image in the CPU.
Assignment of Modbus addresses to the process image
The function codes of the Modbus communication (3, 6, 16) use a Modbus hold register which is an address area in the memory area of the flags or a data block. The type of holding register is specified by the holdingRegister parameter of the ModbusSlave instruction.
Diagnostics functions
| Function codes | Subfunction | Description |
|---|---|---|
| 08 | 0000H | Output request data of echo test: The ModbusSlave instruction returns the echo of a received data word to the Modbus master. |
| 08 | 000AH | Clear communication event counter: The ModbusSlave instruction clears the communication event counter used for Modbus function 11. |
| 08 | - | Call communication event counter |