ClientRequestReadWriteMultipleRegistersWide (FB)

FUNCTION_BLOCK ClientRequestReadWriteMultipleRegistersWide EXTENDS ModbusFB.ClientRequest

ReadWriteMultipleRegister client request (FC23) for registers > 16bit.

For details about client request see |ClientRequest|. For details about “wide registers” and endianess see ServerTCP_extended or ServerSerial_extended.

Please note: The write operation is performed before the read.

Please visit https://forge.codesys.com/prj/codesys-example/modbus/home to find examples.

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

xExecute

BOOL

Rising edge: Starts defined operation
FALSE: Resets the defined operation after ready condition was reached

ETrigTo

udiTimeOut

UDINT

Max. operating time for executing [µs], 0: No operating time limit

ETrigTo

Output

xDone

BOOL

Ready condition reached

ETrigTo

xBusy

BOOL

Operation is running

ETrigTo

xError

BOOL

Error condition reached

ETrigTo

Inout

rClient

Client

Reference to |Client|.

ClientRequest

Input

uiUnitId

UINT

0

Unit-Id to send the request to.

ClientRequest

udiReplyTimeout

UDINT

(50 * 1000)

50 ms

ClientRequest

uiMaxRetries

UINT

0

Maximum number of request retries in case of “reply timeout”.

ClientRequest

Output

eErrorID

Error

Error status

ClientRequest

eException

ExceptionCodes

Request exception code.

ClientRequest

uiRetryCnt

UINT

0

Number of request retries in case of “reply timeout”.

ClientRequest

Input

uiWriteStartItem

UINT

0

First “data item” to write.

uiWriteQuantity

UINT

1

Number of “data items” to write.

pWriteData

POINTER TO BYTE

0

Pointer to write data.

uiWriteDataItemSize

UINT

write “data item” size / register width (in bytes). The ClientRequest has to know about the “data item” size a-priori to provide memory for result data. In case the server unexpectedly does have a different “data item” size than assumed, the ClientRequest can not succeed.

uiReadStartItem

UINT

0

First “data item” to read.

uiReadQuantity

UINT

1

Number of “data items” to read.

pReadData

POINTER TO BYTE

0

Pointer to read data.

uiReadDataItemSize

UINT

read “data item” size / register width (in bytes).