AddReadBit

AddReadBit 1:

Adds a read command on a BIT-type S7 data point to a request. The data point is specified via its absolute address in the S7 Controller. The address of the target variables passed on must be a BOOL data type (not BIT).

Syntax

METHOD AddReadBit    : HRESULT
VAR_INPUT
    pVar             : PVOID;
    nByteOff         : WORD;
    nBitOff          : BYTE;
    nArea            : E_S7COMM_DATAAREA;
    nDatablock       : WORD;
END_VAR

AddReadBit 2: Return value

Name

Data type

Description

AddReadBit

HRESULT

E_HRESULTAdsErr.NOTINIT = Function block has not been initialized correctly.

E_HRESULTAdsErr.BUSY = Request is active

E_HRESULTAdsErr.INVALIDDATA = A transfer parameter has been defined incorrectly

E_HRESULTAdsErr.INVALIDSIZE = The frame length is greater than the PDU length

AddReadBit 3: Inputs

Name

Data type

Description

pVar

PVOID

Address of the target variables in the TwinCAT PLC

nByteOff

WORD

Byte length of the data type to be read from the S7 Controller

nBitOff

BYTE

Bit offset in the S7 Controller

nArea

E_S7COMM_DATAAREA

S7 data area

nDatablock

WORD

ID of the data block. Is only sent if E_S7COMM_DATAAREA.DATA_BLOCKS is used as the data area.

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64)

Tc3_S7Comm (Communication)