ModbusRequest (FB)¶
FUNCTION_BLOCK ModbusRequest
- InOut:
Scope
Name
Type
Initial
Comment
Input
hComPortRTS_IEC_HANDLExExecuteBOOLTriggers sending a Modbus request on a rising edge following the PLCopen specification
xAbortBOOLAborts the current request if TRUE
usiSlaveAddrUSINTSlave address, range 1..247
uiFunctionCodeUINT3
Modbus function code
uiReadOffsetUINT0
Address offset to start reading from, range 0..65535
uiReadLenUINT1
Number of registers to read, range 1..125
uiWriteOffsetUINT0
Address offset to start reading from, range 0..65535
uiWriteLenUINT1
Number of registers to write, range 1..121
tTimeoutTIMETimeout for the request in ms
pWriteBufPOINTER TO BYTE
Pointer to a buffer holding the data to be send to the Slave
pReadBufPOINTER TO BYTE
Pointer to a buffer for writing the data received from a Slave
transmissiontransmission type (RTU or ASCII)
Output
xBusyBOOLIs TRUE as long as a request is in progress
xDoneBOOLIs TRUE if a request finished successfully
xErrorBOOLIs TRUE if a request finished unsuccessfully
xAbortedBOOLIs TRUE after a request in progress has been aborted by “xAbort”
byModbusErrorCodeBYTESpecifies the current error as defined in the “MB_ErrorCodes” enumeration