FB_MDP_Read

 

FB_MDP_Read 1:

 

The function block enables an element of an MDP module to be queried.

 

VAR_INPUT

VAR_INPUT
    bExecute        : BOOL;             (* Function block execution is triggered by a rising edge at this input.*)
    stMDP_DynAddr   : ST_MDP_Addr;
    pDstBuf         : POINTER TO BYTE;              (* Contains the address of the buffer for the received data. *)
    cbDstBufLen     : UDINT;                (* Contains the max. number of bytes to be received. *)
    tTimeout        : TIME := DEFAULT_ADS_TIMEOUT;  (* States the time before the function is cancelled. *)
    sAmsNetId       : T_AmsNetId;          (* keep empty '' for the local device *)
END_VAR

bExecute

The function block is called by a rising edge on the input bExecute, if the block is not already active.

stMDP_DynAddr

The MDP addressing belonging to the selected network module is specified at this input. The structure is of the type ST_MDP_Addr. The dynamic Module ID must already be specified with it.

pDstBuf

The memory address of the data buffer is specified at this input. The received data are stored there if the query is successful.

cbDstBufLen

The length of the data buffer in bytes is specified at this input.

tTimeout

Specifies a maximum length of time for the execution of the function block.

sAmsNetId

For local access don't specify this input or allocate an empty string. For remote access to another computer specify its AMS Net Id.

VAR_OUTPUT

VAR_OUTPUT
    bBusy       : BOOL;
    bError      : BOOL;
    nErrId      : UDINT;
    nCount      : UDINT;
END_VAR

bBusy

This output is TRUE as long as the function block is active.

bError

Becomes TRUE as soon as an error situation occurs.

nErrID

Returns an error code if the bError output is set.

nCount

This output indicates the number of bytes read.

Requirements

Development environment

Target platform

PLC libraries to be linked

TwinCAT v2.11.0 Build >= 1541

PC or CX (x86, ARM)

TcMDP.Lib