AddReadVar

Adds a read command on an S7 data point to a request. The data point is specified via its absolute address in the S7 Controller.
Syntax
METHOD AddReadVar   : HRESULT
VAR_INPUT
    pVar            : PVOID;
    nByteSize       : WORD;
    nByteOff        : WORD;
    nArea           : E_S7COMM_DATAAREA;
    nDatablock      : WORD;
END_VAR Return value
 Return value
| Name | Data type | Description | 
|---|---|---|
| AddReadVar | 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 | 
 Inputs
 Inputs
| Name | Data type | Description | 
|---|---|---|
| pVar | PVOID | Address of the target variables in the TwinCAT PLC | 
| nByteSize | WORD | Byte length of the data type to be read from the S7 Controller | 
| nByteOff | WORD | Byte offset in the S7 Controller | 
| nArea | 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) |