I/O Mapping

Overview

The I/O Mapping view of the device editor is named <devicetype> I/O Mapping (for example, PROFIBUS DP I/O Mapping). It serves to configure an I/O mapping of the controller. Therefore, project variables used by the application are assigned to the input, output, and memory addresses of the controller.

Define the application which should handle the I/Os in the PLC settings view.

See the following chapters:

General Information on Mapping I/Os on Variables

Whether an I/O mapping can be configured for the present device depends on the device. It can be that the view is only used to show the implicitly created device instance. See description of the IEC objects.

Basically, note the following for the mapping of I/Os to variables:

  • Variables requiring an input cannot be accessed by writing.

  • An existing variable can only be mapped to one input.

  • Instead of using the I/O Mapping view, you can also assign an address to a variable via the AT declaration.

    However, consider the following:

    • You can use AT declarations only with local or global variables; not however, with input and output variables of POUs.

    • The possibility of generating force variables for I/Os (refer to Implicit Variables for Forcing I/Os) will not be available for AT declarations.

    • If AT declarations are used with structure or function block members, all instances will access the same memory location. This memory location corresponds to static variables in classic programming languages such as C.

  • The memory layout of structures is determined by the target device.

  • For each variable which is assigned to an I/O channel in the I/O Mapping view, force variables can be created during a build run of the application. You can use them for forcing the input or output value during the commissioning of a machine, for example, via a visualization. Refer to the chapter Implicit Variables for Forcing I/Os.

Automatic I/O Mapping

The automatic I/O mapping function automatically creates IEC variables as soon as a device or module with I/O modules is added to the Devices Tree and maps them on each input and/or output. By default, the function is activated.

You can deactivate and configure the function in the Project > Project Settings > Automatic I/O mapping dialog box.

The dialog box provides the following elements:

Element

Description

Create variable on I/Os mapping

By default, the option is activated.

Select this option to activate the automatic I/O mapping function and to assign names of your choice to the inputs and outputs.

Mapping area

Bitwise

Select this option to create variables for each bit.

Module-wise

Select this option to create a variable for each module, not for the individual bits.

Naming Rule area

text box

Enter the following characters preceded by a # symbol to specify the parts the variable name will consist of:

  • Enter #X to integrate an i for inputs and a q for outputs in the variable name.

  • Enter #T to integrate the prefix code for the data type of the variable in the variable name. The prefixes that are used for the different data types are listed in the Best Practices for the Naming of Identifiers chapter.

  • Enter #D to integrate the name of the device in the variable name.

  • Enter #C to integrate the name as defined in the Channel column in the variable name.