AddWriteVar

AddWriteVar 1:

Adds a write command on an S7 data point to a request. The data point is specified via its absolute address in the S7 Controller.

Syntax

METHOD AddWriteVar    : HRESULT
VAR_INPUT
    pVar              : PVOID;
    nByteSize         : WORD;
    nByteOff          : WORD;
    nArea             : E_S7COMM_DATAAREA;
    nDatablock        : WORD;
END_VAR

AddWriteVar 2: Return value

Name

Data type

Description

AddWriteVar

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

AddWriteVar 3: Inputs

Name

Data type

Description

pVar

PVOID

Address of the source variables in the TwinCAT PLC

nByteSize

WORD

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

nByteOff

WORD

Byte 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)