FB_ReadCoils

Overview

Type:

Function block

Available as of:

V1.0.0.0

Extends:

FB_ReadWriteMultipleInOutputs

Functional Description

The function block is used to read coils from an external device using the Modbus protocol (function code 0x01).

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_uiStartingAddress

UINT

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

i_uiQuantity

UINT

Specifies the number of objects to be read.

Range: 1...2000

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

Input/Output

Data type

Description

iq_axBuffer

ARRAY[*] OF BOOL

Array of Booleans, 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.