Devices with I/O channels Permalink

This tab is displayed in device editors for devices with I/O channels. It shows the available channels and allows for the mapping of input, output, and memory addresses of the controller to variables or entire function blocks of the application. You create the 'I/O Mapping' in this way.

For more information, see: ⮫ “Configuring Devices and I/O Mapping ”, ⮫ “Linking a device input with an existing project variable ("mapping") ”, ⮫ “Mapping a device input to a recently created project variable ”, ⮫ “Linking a device with a function block instance ”, ⮫ “Changing and fixing an address value in the I/O map ”, ⮫ “Configuration of the I/O variable update ”, ⮫ “Monitoring of variables in the I/O map in online mode ”, ⮫ “Generating implicit variables for the forcing of I/Os ”, ⮫ “I/O mapping in one dialog for multiple devices ”

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

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 download an actual application to the device beforehand.

If an I/O channel is not referenced in the application, then its value will not be updated. If you want to monitor non-referenced I/O channels, then you need to enable the “Always update variables” option on the ⮫ “Tab: PLC Settings ”. Alternatively, you could also enable this option on the “I/O Mapping” tab of a device. Then enabling is valid only for this one device and its children.

NOTICE

NOTICE
NOTICE
NOTICE

NOTICE

NOTICE

Mapping data types which are "too large"

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 that, in the root element of the address, the value is displayed which 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 “<device name> I/O Mapping” tab for a CAN bus slave:

_cds_img_io_mapping_dialog.png

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

“Find” (1)

Input field for a string to search for in the mapping table

The search results are highlighted in yellow.

“Filter” (2)

List box with filters for the I/O mappings displayed in the mapping table:

  • “Show all”

  • “Show only outputs”

  • “Show only inputs”

  • “Show only unmapped variables”

  • “Show only mapped variables”

  • “Show only mapping to existing variables”

  • “Show only mapping to new variables”

_cds_icon_add_fb.png “Add FB for IO channel” (11)

Depending on the device, available if the channel entry is selected in the mapping table

Opens the “Select Function Block” dialog for selecting the function block that should be linked directly to the channel

_cds_icon_goto_definition.png “Go to instance” (12)

Available if the entry is selected in the mapping table

Jumps to the corresponding entry on the “<device name> IEC Objects” tab

“Variable”

Depending on the device, the inputs and outputs of the device are displayed 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:

_cds_icon_input_channel.png: Input

_cds_icon_output_channel.png: Output

Double-click the cell to open an input field.

  • Possibility 1: The variable already exists.

    Specify the full path: <application name>.<POU name>.<variable name>

    Example: ‎app1.plc_prg.ivar‎; Input Assistant via _cds_icon_three_dots.png

  • Possibility 2: The variable does not exist yet.

    Specify simple names

    Automatically created internally as a global variable

Depending on the device, inputs or outputs can be linked directly to a function block. In this case, the _cds_icon_add_fb.png “Add FB for IO channel” button can be clicked. See above.

“Mapping” (3)

Type of mapping:

  • _cds_icon_map_to_existing_variable.png: Existing variable

  • _cds_icon_create_new_variable.png: New variable

  • _cds_icon_map_fb.png: Mapping to function block instance

“Channel” (4)

Symbolic name of the channel.

“Address” (5)

Address of the channel (example: ‎%IW0‎)

Address strikethrough: Indicates that you should not assign any more variables to this address. Reason: Although the variable specified here is managed – as an existing variable –at a different memory location, ambiguity could result when the values are written, particularly with outputs.

_cds_icon_address_fixed.png: Indicates that this address has been edited and fixed

If the arrangement of the device objects in the device tree changes, then CODESYS does not adapt this address automatically.

“Type” (6)

Data type of the channel (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 specifying 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” is selected in the “PLC Settings” for the behavior of the outputs at stop.

Note: For compiler version V3.5 SP11 and higher, 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 (example: ‎ms‎ for milliseconds)

“Description” (8)

Short description of the parameter

“Current value”

Actual value of the parameter applied to the channel; displayed in online mode only

The change of the default value by an online change is allowed, however the value is applied only after a "Reset cold" or "Reset warm".

“Reset Mapping” (9)

CODESYS resets the mapping settings to the default values as defined in the device description file.

“Always update variables” (10)

Definition for the device object about updating I/O variables

The default value is defined in the device description:

  • “Use parent device setting”: Update according to the setting of the superordinate device.

  • “Enabled 1 (use bus cycle task if not used in any task)”: CODESYS updates the I/O variables in the bus cycle task if they are not used in any other task.

  • “Enabled 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.

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.

For more information, see: ⮫ “Fieldbus Devices and I/O Drivers ”