Tab ‘<device> I/O Mapping’

On this tab of the generic device editor you perform the mapping of the input, output and memory addresses of the controller to the variables of the application. In this way you create the so-called ‘I/O mapping’.

The application that is to take care of the I/O handling is defined on the tab PLC settings.

Note

You can use the ‘online configuration mode’ if the device supports it. In this mode you can access the I/Os of the hardware without having to load a real application to the device beforehand.

Note

You can also create the I/O mapping in the Edit I/O mapping dialog where you obtain a mapping list with search and filter functions for a complete device tree.

Hint

Mapping ‘too large’ data types If a variable of a data type that is larger than a byte is mapped to a byte address, the value of the variable will be truncated to byte size there! For monitoring the variable value in the I/O Mapping dialog, this means the following: In the root element of the address, the value is displayed that the variable currently has in the project. The current individual bit values of the byte are displayed in succession in the bit elements below that, but this may not be sufficient for the entire variable value.

Example of the tab I/O mapping for a CAN bus slave:

The tab contains a table for the editing of the I/O mapping. The information displayed for the inputs and outputs originates from the device description.

Find (1) Input field for a search string for the mapping table. The search results are marked in yellow.
Filter (2)

Drop-down list for filtering I/O mapping displayed listed in the mapping table:

  • Show all
  • Show outputs only
  • Show inputs only
  • Show unmapped variables only
  • Show mapped variables only
  • Show mappings to existing variables only
  • Show mappings to new variables only
Variable

Depending on the device, the inputs and outputs of the device appear as nodes and below them, indented, the associated channels or, depending on the device, only the implicitly created device instance.

The symbol indicates the type of channel:

: Input

: Output

Double-clicking the cell opens an input field.

  • Option 1: The variable already exists; specify complete path: <application name>.<module name>.<variable name>; example: app1.plc_prg.ivar; input assistance via .
  • Option 2: The variable does not exist yet; enter a simple name; automatically created internally as a global variable.
Mapping (3)

Type of mapping:

  • : Variable already exists
  • : New variable
Channel (4) Symbolic name of the channel.
Address (5)

Address of the channel, for example %IW0.

Address strikethrough: indicates that you should not assign any further variables to this address. Reason: Although the variable specified here – as an already existing variable – is managed at a different memory location, ambiguities could result during the writing of the values, particularly with outputs.

: indicates that this address has been edited and fixed. If the arrangement of the device objects in the device tree changes, CODESYS does not adapt this address automatically.

Type (6)

Data type of the channel, for example BOOL.

Structures or bit fields defined in the device description are displayed only if they are part of the IEC standard and are identified as IEC data types in the device description. Otherwise the table cell remains empty.

When mapping structured variables, the editor prevents you from entering both the structure variable (example: %QB0) and individual structure elements (example: %QB0.1 and QB0.2). Therefore, if there is a main entry with a subtree of bit channel entries in the mapping table, then the following applies: You can input a variable either into the line of the main entry, or into the lines of the subelements (bit channels), but not into both.

Default value

Default value of the parameter that applies to the channel Appears only if the option Set all outputs to default value is activated in the PLC settings for the behavior of the outputs at stop.

Note: For compiler version V3.5 SP11 and later, the initialization value of the variables is used automatically as the default value when mapping to an existing variable. You can edit the Default value field only if you map to a new created variable or if no mapping is specified. In older versions, users had to specify explicitly that the default value and initialization value were identical.

Unit (7) Unit for the parameter value, for example ms for milliseconds.
Description (8) Brief description of the parameter.
Current value Actual value of the parameter applied to the channel; appears only in online mode.
Reset mapping (9) CODESYS resets the mapping settings to the default values defined by the device description file.
Update variables (10)

Definition for the device object about updating I/O variables. The default value is defined in the device description:

  • Use settings from the superordinate device: Update according to the setting of the superordinate device.
  • Activates 1 (use bus cycle task if not used in another task): CODESYS updates the I/O variables in the bus cycle task if they are not used in any other task.
  • Activate 2 (always in bus cycle task): CODESYS updates all variables in each cycle of the bus cycle task, regardless of whether they are used and whether they are mapped to an input or output channel.
IEC objects
This part of the dialog appears only in the case of the implicit creation of an instance of the device object that can be accessed in the application. This can be used, for example, in order to restart a bus or to query information. Whether such an instance is available and how it can be used depends on the type of device. Please refer here to the online help for the special device configuration.

Hint

Please note that manually creating another instance of the device object can lead to malfunctions.

Note

If a UNION is represented by I/O channels in the mapping dialog, it depends on the device whether mapping to the root element is also possible.

See also