FB_S7CommSingleRequest

FB_S7CommSingleRequest 1:

With the FB_S7CommSingleRequest function block, a read/write request can be carried out on a data point of an S7 communication connection. The bError output states whether the request was successfully carried out. Any errors occurring at the time of the request are displayed via the output sErrorTxt and nErrorID.

Syntax

Definition:

VAR_INPUT
    bExecute     : BOOL;
END_VAR
VAR_OUTPUT
    bError       : BOOL;
    sErrorTxt    : STRING;
    nErrorId     : WORD;
    bBusy        : BOOL;
END_VAR

FB_S7CommSingleRequest 2: Inputs

Name

Data type

Description

bExecute

BOOL

The function block is executed by a rising edge at this input.

FB_S7CommSingleRequest 3: Outputs

Name

Data type

Description

bError

BOOL

Switches to TRUE if an error occurs during execution.

sErrorTxt

STRING

Contains the error text in the event of an error.

nErrorId

WORD

Outputs an error code in the event of an error.

bBusy

BOOL

TRUE until the function block has executed a command. As long as bBusy = TRUE, the function block will not accept any new commands.

FB_S7CommSingleRequest 4: Methods

Name

Definition location

Description

AddReadVar

Local

Adds a read command for a particular S7 data point to the request.

AddReadBit

Local

Adds a read command for a particular BIT-type S7 data point to the request.

AddReadString

Local

Adds a read command for a particular STRING type S7 data point to the request.

AddReadByteArray

Local

Adds a read command to the request in an optimized manner if several data points located consecutively in the memory of the S7 Controller are to be read.

AddWriteVar

Local

Adds a write command for a particular S7 data point to the request.

AddWriteBit

Local

Adds a write command for a particular BIT-type S7 data point to the request.

AddWriteString

Local

Adds a write command for a particular STRING type S7 data point to the request.

AddWriteByteArray

Local

Adds a read command to the request in an optimized manner if several data points located consecutively in the memory of the S7 Controller are to be written.

RemoveRead

Local

Removes a variable from a read request.

RemoveWrite

Local

Removes a variable from a write request.

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64)

Tc3_S7Comm (Communication)