Skip to main content

Siemens S7 — Accessing IO-Link Process Data

This guide shows how to read and write the IO-Link process data of a CAPTRON sensor from a Siemens S7 controller in TIA Portal. By the end you'll be reading the sensor's inputs and writing its outputs through named tags — instead of picking individual bytes out of the I/O area.

The key is a pair of PLC data types per device that mirror its process data byte by byte: one for the inputs (PII - …) and one for the outputs (PIQ - …). CAPTRON provides them as TIA Portal source files for the CANEO, CALIS, and ORCA product lines (see Download). You import the file for your device and place the data types on the I/O addresses of the IO-Link port.

The steps are the same for every device. This guide uses a CANEO series5x Duo-Touch Display on a CPU 1214C as the example.

Prerequisites​

Before starting, make sure:

  • TIA Portal is installed and you have a project with an S7 CPU. This example uses a CPU 1214C DC/DC/DC and TIA Portal V16.
  • An IO-Link master is configured in the device configuration.
  • The CAPTRON device is wired to an IO-Link port on the master.
  • You have downloaded the source file for your device from the Download section.
  • You have the device's process data layout at hand. It's in the device's TRM:
DeviceProcess dataInput lengthOutput length
CANEO series10series10 Process Data10 bytes8 bytes
CANEO series4xseries4x Process Data10 bytes14 bytes
CANEO series5xseries5x IO-Link Process Data8 bytes16 bytes
CALISCALIS Process Data8 bytesnone
ORCAORCA Process Data16 bytes8 bytes

Choose the LED control mode​

For the CANEO series10, CANEO series4x, and ORCA, the layout of the output process data depends on the IO-Link parameter LED Control Mode. Set this parameter on the device first, then use the source file that matches it:

LED Control ModeSource file
Scene controlled by IO-Link Process Data…_SceneControl.udt
Advanced control by IO-Link Process Data…_AdvancedControl.udt

In the other modes, the device ignores the output process data. For details on each mode, see series10 LED Control, series4x LED Control, and ORCA LED.

The CANEO series5x has no LED Control Mode parameter: its output process data always has the same layout, and the Scene Selection Mode field in the process data decides whether the scenes are controlled from the PLC. The CALIS has no output process data.


Configure the IO-Link port so that its process data length matches the device (see the table above). For the CANEO series5x in this example, that is 8 bytes input and 16 bytes output.

Depending on the master, you set this by choosing a port submodule of the right size in the device configuration or in the master's port configuration tool.

note

Some IO-Link masters place additional bytes in front of the process data, such as a port qualifier or status byte. Check the master's manual for the exact position of the device data within the port's I/O area.


2. Note the I/O start addresses​

Open the Device view, select the IO-Link master or port submodule, and read the I address and Q address from the Device overview. These are the start addresses of the port's process data — byte 0 of the TRM layout is the byte at the start address.

This example uses:

AreaStart addressRange
Process Data Input%IB68%IB68 … %IB75
Process Data Output%QB64%QB64 … %QB79

3. Import the PLC data types​

  1. In the project tree, expand your PLC and open External source files. Double-click Add new external file and select the source file for your device — here CANEO_series5x.udt.

    Add new external file under External source files in the TIA Portal project tree

  2. Right-click the imported file and choose Generate blocks from source.

    Context menu on CANEO_series5x.udt with Generate blocks from source

  3. The new data types appear under PLC data types — for the series5x, PII - CANEO series5x for the inputs and PIQ - CANEO series5x for the outputs.

    PLC data types PII - CANEO series5x and PIQ - CANEO series5x in the project tree

note

The _SceneControl and _AdvancedControl files of a device share the same input data type, but each has its own output data type, ending in Scene Control or Advanced Control. You can import both files into the same project, for example when you use devices of the same type in both modes. When you generate the second file, TIA Portal asks whether to overwrite the existing input data type. Confirm: both files define it identically.

What's in the data types​

Each member sits at the byte position given in the device's process data layout. For the CANEO series5x:

Data typeByteMemberS7 type
PII - CANEO series5x0–3Touch Inputs - ReservedDWord
4Touch Inputs - Zone 4 actuatedByte
5Touch Inputs - Zone 3 actuatedByte
6Touch Inputs - Zone 2 actuatedByte
7Touch Inputs - Zone 1 actuatedByte
PIQ - CANEO series5x0–5Display Control - Text to displayArray[1..6] of Char
6Display Control - Text ColorByte
7Display Control - Text SelectByte
8–11Display Control - Number to displayDInt
12–13Display Control - Active Scenes (Bitmask)Word
14Display Control - ReservedByte
15Display Control - Scene Selection ModeByte

The data types of the other devices follow the same pattern: member names are the field names from the TRM, and reserved or unused bytes are kept as placeholder members so that every field lands at the right offset.


4. Create the I/O tags​

Open a PLC tag table and create one tag per direction. Use the PLC data type as the data type and the port's start address as the address:

NameData typeAddress
PI"PII - CANEO series5x"%I68.0
PO"PIQ - CANEO series5x"%Q64.0

TIA Portal lays the structure over the I/O area, so each member addresses exactly one field of the process data. For example, "PI"."Touch Inputs - Zone 1 actuated" resolves to %IB75 and "PO"."Display Control - Number to display" to %QD72.

For a device without output process data, such as the CALIS, create only the input tag.

Tags

note

Use one pair of tags per device. For a second device, create two more tags of the same data types on that port's start addresses — for example PI_Port2 and PO_Port2.


5. Test with a watch table and a force table​

Download the project to the CPU and go online.

Read the inputs​

Create a watch table under Watch and force tables, add the input members, and click Monitor all. In the example, touching zone 1 on the display changes "PI"."Touch Inputs - Zone 1 actuated" to 16#01.

Watch table monitoring PI Touch Inputs - Zone 1 actuated at %IB75 with value 16#01

Write the outputs​

Open the Force table and add the output members. Because the S7-1200 forces I/O directly at the peripheral, the addresses are shown with the :P suffix (for example %QB70:P).

Enter force values and start forcing. In the example, the display shows the text HALLO in white:

MemberAddressForce valueMeaning
Display Control - Text Color%QB70:P16#07White
Display Control - Text Select%QB71:P16#02Text given
Display Control - Text to display[1] … [5]%QB64:P … %QB68:P'H' 'A' 'L' 'L' 'O'Text to show

Force table writing Text Color, Text Select, and the text HALLO to the PO output tags

For the meaning of each value, see the device's process data page listed under Prerequisites.

info

Forcing is meant for commissioning and testing. Stop forcing when you're done, otherwise the forced values override what your program writes.


6. Use the tags in your program​

In the user program, access the members by name in any block. Example in SCL for the CANEO series5x:

// Show the number 12345 in green while touch zone 1 is actuated
IF "PI"."Touch Inputs - Zone 1 actuated" = 16#01 THEN
"PO"."Display Control - Text Select" := 1; // Number given
"PO"."Display Control - Text Color" := 2; // Green
"PO"."Display Control - Number to display" := 12345;
ELSE
"PO"."Display Control - Text Select" := 0; // From Scene
END_IF;

Reference​


Download​

TIA Portal source files with the PLC data types for each device. Add the file for your device under External source files as described in step 3.

DeviceLED Control ModeSource filePLC data types
CANEO series10Scene controlled by IO-Link Process DataCANEO_series10_SceneControl.udtPII - CANEO series10 Standard
PIQ - CANEO series10 Standard Scene Control
Advanced control by IO-Link Process DataCANEO_series10_AdvancedControl.udtPII - CANEO series10 Standard
PIQ - CANEO series10 Standard Advanced Control
CANEO series10 SignalAdvanced control by IO-Link Process DataCANEO_series10-Signal_AdvancedControl.udtPII - CANEO series10 Standard Signal
PIQ - CANEO series10 Standard Signal Advanced Control
CANEO series4xScene controlled by IO-Link Process DataCANEO_series4x_SceneControl.udtPII - CANEO series40 Puck Display M12 connector
PIQ - CANEO series40 Puck Display M12 connector Scene Control
Advanced control by IO-Link Process DataCANEO_series4x_AdvancedControl.udtPII - CANEO series40 Puck Display M12 connector
PIQ - CANEO series40 Puck Display M12 connector Advanced Control
CANEO series5x—CANEO_series5x.udtPII - CANEO series5x
PIQ - CANEO series5x
CALIS—CALIS.udtPII - CALIS Level Sensor
ORCAScene controlled by IO-Link Process DataORCA_SceneControl.udtPII - ORCA
PIQ - ORCA Scene Control
Advanced control by IO-Link Process DataORCA_AdvancedControl.udtPII - ORCA
PIQ - ORCA Advanced Control