MBMasterRTU
Function Block - MODBUS-RTU Master.
This function block manages a master on MODBUS-RTU over a serial line and enables the management of various MODBUS functions. Function blocks MBMASTERTCP and MBMASTERRTU give an alternative to the MODBUS configurator. You do not need to configure anything in the fieldbus configurator to use these blocks.
Inputs
Parameter |
Description |
Description |
CNX |
BOOL |
A rising edge on this input to open the specified COM port. If the port is successfully open, the Ready output will be set to TRUE. If the opening fails, an error is reported by the Error output. |
SND |
BOOL |
A rising edge on this input starts a new exchange such as specified by other paramerters. A exchange can be started only if the Ready output is TRUE. |
SLAVE |
DINT |
Slave number (or unit number) of the MODBUS TCP server. |
FCODE |
DINT |
MODBUS function code. The following functions are supported: 1 = Read coil bits 2 = Read input bits 3 = Read holding registers 4 = Read input registers 5 = Write one coil bit 6 = Write one holding registers 7 = Read exception status 15 = Write N coil bits 16 = Write N holding registers 17 = Report slave ID 23 = Read/write holding registers |
ADDR |
DINT |
Address of the first address to read. Used only for functions 1, 2, 3, 4 and 23. |
NBR |
DINT |
Number of items to read. Used only for functions 1, 2, 3, 4 and 23. |
ADDW |
DINT |
Address of the first address to write. Used only for functions 5, 6, 15, 16 and 23. |
NBW |
DINT |
Number of items to write. Used only for functions 5, 6, 15, 16 and 23. Must be 1 for functions 5 and 6. |
DATA |
ARRAY OF ... |
Buffer containing the values read or written. Must be set on input before calling functions 5, 6, 15, 16 and 23. Filled on for other functions and also for function 23. The dimension of the array must be greater than or equal to the specified number of items. The data type of the array depends on the function: BOOL for functions 1, 2, 5 and 15 INT, UINT or WORD for functions 3, 4, 6, 16 and 23 SINT, USINT or BYTE for functions 7 and 17. |
TIMEOUT |
TIME |
Communication timeout for the complete exchange. |
PORT |
STRING |
Specification of the COM port (e.g. 'COM1:9600,N,8,1'). Refer to OEM's instruction for more information about COM port specification. |
Outputs
Parameter |
Description |
Description |
READY |
BOOL |
This output is TRUE when the connection is correctly established and no pending exchange is currently running. |
OK |
BOOL |
This output is set to TRUE at the end of a successful exchange. It is reset to FALSE when a new exchange is started. |
ERROR |
DINT |
Error report. Can be one of the following values: 1 = invalid function code Note: some devices may answer some other specific error reports |
MBMasterRTU |
IEC 61131-3 Automation platform > Drivers - Fieldbus configuration > MODBUS Master > Driver-specific information > Driver specific function blocks > MBMasterRTU |
Created with the Personal Edition of HelpNDoc: Easy EBook and documentation generator