FB_MDP_ReadIndex

FB_MDP_ReadIndex 1:

Update: Tc3_IPCDiag library

The TwinCAT 3 PLC library Tc2_MDP is the predecessor to Tc3_IPCDiag. With the new Tc3_IPCDiag library the number of readable parameters has been increased and the user interface has been optimized. It is recommended to use the Tc3_IPCDiag library.
Future extensions will no longer be performed in the Tc2_MDP library. It is not recommended to use the Tc2_MDP library for new projects. All functionalities of the Tc2_MDP library can also be found in the new Tc3_IPCDiag library.

The function block enables querying of any IPC diagnostics element. In addition to the Configuration Area, data from the device area are also accessible.

VAR_INPUT

VAR_INPUT
    bExecute    : BOOL;             (* Function block execution is triggered by a rising edge at this input.*)
    nIndex      : WORD;
    nSubIndex   : BYTE;
    pDstBuf     : DWORD;            (* 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.

nIndex: At this input the first part of the addressing for the required IPC diagnostic data is specified.

nSubIndex: At this input the second part of the addressing for the required IPC diagnostic data is specified.

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: To execute the query on the local device, it is not necessary to specify this input variable. Alternatively, an empty string can be specified. To direct the query to another computer, its AMS Net Id (of type T_AmsNetId) can be specified here.

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 include

TwinCAT v3.1.4013

PC or CX (x86, x64, ARM)

Tc2_MDP