ModbusRequest (FB)¶
FUNCTION_BLOCK ModbusRequest
- InOut:
- Scope - Name - Type - Initial - Comment - Input - hComPort- RTS_IEC_HANDLE- xExecute- BOOL- Triggers sending a Modbus request on a rising edge following the PLCopen specification - xAbort- BOOL- Aborts the current request if TRUE - usiSlaveAddr- USINT- Slave address, range 1..247 - uiFunctionCode- UINT- 3 - Modbus function code - uiReadOffset- UINT- 0 - Address offset to start reading from, range 0..65535 - uiReadLen- UINT- 1 - Number of registers to read, range 1..125 - uiWriteOffset- UINT- 0 - Address offset to start reading from, range 0..65535 - uiWriteLen- UINT- 1 - Number of registers to write, range 1..121 - tTimeout- TIME- Timeout for the request in ms - pWriteBuf- POINTER TO BYTE - Pointer to a buffer holding the data to be send to the Slave - pReadBuf- POINTER TO BYTE - Pointer to a buffer for writing the data received from a Slave - transmission- transmission type (RTU or ASCII) - Output - xBusy- BOOL- Is TRUE as long as a request is in progress - xDone- BOOL- Is TRUE if a request finished successfully - xError- BOOL- Is TRUE if a request finished unsuccessfully - xAborted- BOOL- Is TRUE after a request in progress has been aborted by “xAbort” - byModbusErrorCode- BYTE- Specifies the current error as defined in the “MB_ErrorCodes” enumeration