| Name | Type | Section | Description |
|---|---|---|---|
| request | BOOL |
Input | Activates configuration of the port on rising edge |
| port | WORD |
Input | Communication port, Hardware Identifier |
| baud | UINT |
Input | Selection of the data transmission rate. Valid values are: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200 bit/s. |
| parity | UINT |
Input | Selection of parity:
|
| flowControl | UINT |
Input | Selection of flow control:
|
| rtsOnDelay | UINT |
Input | Selection RTS ON delay:
|
| rtsOffDelay | UINT |
Input | Selection RTS OFF delay:
|
| responseTimeout | UINT |
Input | Response timeout: 5 ms to 65535 ms - Time in milliseconds that ModbusMaster waits for a response from the slave. |
| MB_DB | P2P_MB_BASE |
Input/Output | A reference to the instance data struct of the ModbusMaster or ModbusSlave instructions. |
| done | BOOL |
Output | TRUE, if the instruction finished without error |
| error | BOOL |
Output | TRUE, for one cycle once the instruction has been completed with an error. |
| status | WORD |
Output | Error code. See Parameter Status. |
ModbusCommonLoad is executed to configure a port for the Modbus RTU protocol. Once you have configured the port for the Modbus RTU protocol, it can only be used by the ModbusMaster or ModbusSlave instructions.
You have to run ModbusCommonLoad for the configuration of each communication port that is to be used for Modbus communication. You must assign a unique ModbusCommonLoad instance to each port that you use. Only run ModbusCommonLoad again if you need to change communication parameters, such as data transmission rate or parity, or in case the network has returned.
For example, an instance is assigned to the instruction if you add ModbusMaster or ModbusSlave to your program. You need to connect the MB_DB parameter of the ModbusCommonLoad instruction to the MB_DB parameter of the ModbusMaster or ModbusSlave instruction.