Ways of mapping PLC variables to the HMI control

There are three types of mapping variables for mapping the controls to the PLC: MTP library mapping, custom object (e.g. FB) mapping, and direct variable mapping.

MTP library mapping

The TF8400 | TwinCAT 3 MTP Runtime library includes standardized interfaces. The following shows a sequence which displays how a particular standardized type is bound to the corresponding control.

Ways of mapping PLC variables to the HMI control 1:

MTP library FBs are instantiated in the PLC and become available for mapping in the HMI project.

Ways of mapping PLC variables to the HMI control 2:
Ways of mapping PLC variables to the HMI control 3:

The result appears immediately after mapping:

Ways of mapping PLC variables to the HMI control 4:

Custom FB mapping

Using the special 'TcHmi.ProcessLibrary' pragma attribute makes a custom FB available for mapping to the control via the Data Symbol property. The pragma attributes must be used to create the FB. Then all its instances pass to the mapped control:

Ways of mapping PLC variables to the HMI control 5:
Ways of mapping PLC variables to the HMI control 6:

More detailed information on using PLC attributes is given in the PLC attribute functionality and Using PLC attribute functionality chapters.

PLC variable direct mapping/overwriting

This is the standard method of variable mapping in TwinCAT HMI: every property of the HMI Process Library control which is available via the Property Window can be mapped to a separate variable of a corresponding type.

Ways of mapping PLC variables to the HMI control 7:
Ways of mapping PLC variables to the HMI control 8:

Separate mapping for each control instance

Mapping variables to the control properties (which are needed) has to be done separately for each HMI control instance.

Sometimes, some specific properties of the control which have already been mapped to MTP or custom FB via the Data Symbol property need to be overridden; this constitutes a complex scenario. It makes using the controls more flexible.

Ways of mapping PLC variables to the HMI control 9:

Mapped data prioritization

Data set via specific properties has priority over the Data Symbol property.