MDP element access options

The TwinCAT 3 PLC Tc2_MDP library offers a wide range of function blocks to facilitate comprehensive access to MDP data.

There are two basic types of function blocks in the library.
Firstly the generic function blocks. They can be used to query and set arbitrary parameters in the MDP themselves by means of discrete access.
Furthermore, specific function blocks offer the possibility of accessing certain data as well as groupings of several data with one call.

The function blocks have a uniform appearance.
All function blocks are called by a positive edge on the bExecute input. Afterwards, cyclic calling of the function block (bExecute = FALSE) returns the result of the query at the output as soon as the processing of the query has been completed (bBusy = FALSE). Each function block must be called (bExecute = FALSE) for as long as it takes for the internal processing (bBusy = FALSE) to be completed. During that time, all inputs of the function block must remain unchanged.

In general, the MDP is a model that describes hardware and software components in the form of modules. Information about these modules as well as about the device itself can be queried and changed.
A module consists of one or more tables. Each table consists of a fixed number of subindices. A subindex corresponds to a concrete element that can be accessed.
You can find more information on the setup of MDP in the MDP Information Model (Device Manager documentation). Further options for accessing the MDP are also described there.

Generic function blocks

In order to be able to query or set an IPC diagnostics parameter, the dynamic module ID of the module in which the parameter is located must be known.
This is determined with the aid of the function block FB_MDP_ScanModules.

Individual parameters can now be read or written by means of FB_MDP_Read and FB_MDP_Write. In addition to the dynamic Module ID, the number of the selected table (Table ID), the selected subindex within the table as well as further information is thereby specified for the query.

Likewise, the complete header of a module (ST_MDP_ModuleHeader) can be queried with the function block FB_MDP_ReadModuleHeader.
The complete contents of a selected table within a module can be queried with the function block FB_MDP_ReadModuleContent.

The function block FB_MDP_ReadModule bundles the above queries. The function block implicitly determines the dynamic Module ID and queries both header and table.
The function block FB_MDP_ReadElement also determines the dynamic module ID implicitly. It can be used to query any individual IPC diagnostics parameter.
Accordingly, with these two function blocks it is not necessary to call FB_MDP_ScanModules beforehand.

Specific function blocks

The function blocks available here offer fast access to the most important IPC diagnostic information.

For example, it is sufficient to call the function block FB_MDP_NIC_Read in order to query all important information about a Network Interface Card (see Device Manager documentation Module NIC). The module header is also queried and output in each case.
The specific function blocks likewise implicitly determine the dynamic Module ID, so that a prior call of FB_MDP_ScanModules is superfluous.