MDP element access options
The TwinCAT PLC MDP library offers the most diverse function blocks, to enable extensive access to MDP data.
There are two basic types of function blocks in the library.
On the one hand the general 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 available here offer fast access to the most important MDP information.
The type of MDP access and the differences between the two types of function blocks will be described in greater detail below. All function blocks have a uniform look & feel.
All function blocks are called by a rising 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). The example in this documentation supplies further handling tips. 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.
More detailed information about the structure of the MDP can be found in the MDP Information Model. Further options for accessing the MDP are also described there.
General function blocks
In order to be able to query or set an MDP 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 implicitly determines the Dynamic Module ID. Every single MDP element can be selected and queried.
For these both function blocks is a previous call of FB_MDP_ScanModules not necessary.
Specific function blocks
The function blocks available here offer fast access to the most important MDP information.
For example, calling the function block FB_MDP_NIC_Read suffices in order to query all important information about a network adapter (see MDP NIC module). 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.