FB_WriteReadMultipleRegisters

Overview

Type:

Function block

Available as of:

V1.0.0.0

Extends:

FB_ExecuteAbortDiag

Functional Description

The function block is used to write and read holding registers of an external device using the Modbus protocol (function code 0x17). Write operations are performed before read operations.

Interface

Input

Data type

Description

i_xExecute

BOOL

A rising edge of the input i_xExecute starts the execution of the function block.

Refer to Behavior of Function Blocks with the Input i_xExecute and i_xAbort.

i_xAbort

BOOL

A rising edge of the input i_xAbort aborts the execution of the function block.

Refer to Behavior of Function Blocks with the Input i_xExecute and i_xAbort.

i_sServerAddr

STRING[80]

Address identifier for connecting to the external device.

The address is specified in the format ip address:[port]/[unit ID].

Values in square brackets are optional. If they are not entered, the default values 502 and 255 are used.

Example: 192.168.178.123:502/255

If the format or a value of an element is invalid, the error message ET_Result.ServerAddressInvalid is generated.

i_timTimeout

TIME (T#60s)

Timeout for the operation. If the specified time expires during execution, the process is aborted. A value of T#0s deactivates the timeout monitoring in the function block.

i_uiStartingAddressWrite

UINT

Specifies the address of the first object to be written. The first object corresponds to the first item in the buffer.

i_uiQuantityWrite

UINT

Specifies the number of objects to be written.

Range: 1...121

If a value is not specified, the amount of objects determined by the buffer is taken into account.

i_uiStartingAddressRead

UINT

Specifies the address of the first object to be read. The first object corresponds to the first item in the buffer.

i_uiQuantityRead

UINT

Specifies the number of objects to be read.

Range: 1...125

If a value is not specified, the amount of objects determined by the buffer is taken into account.

Input/Output

Data type

Description

iq_awBufferWrite

ARRAY[*] OF WORD

Array of words, providing a buffer containing the values to write.

iq_awBufferRead

ARRAY[*] OF WORD

Array of words, providing a buffer to store the read data.

Output

Data type

Description

q_xBusy

BOOL

If this output is set to TRUE, the function block execution is in progress.

q_xDone

BOOL

If this output is set to TRUE, the execution has been completed successfully.

q_xAborted

BOOL

If this output is set to TRUE, the function block execution has been aborted.

q_xError

BOOL

If this output is set to TRUE, an error has been detected. For details, refer to q_etResult and q_etResultMsg.

q_etResult

ET_Result

Provides diagnostic and status information as a numeric value.

q_sResultMsg

STRING [80]

Provides additional diagnostic and status information as a text message.