<!-- Source: https://docs.captron.com/application-notes/s7-access-iolink-pd -->

# 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](#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](#download) section.
- You have the device's **process data layout** at hand. It's in the device's TRM:

<table>
  <thead>
    <tr>
      <th>Device</th>
      <th>Process data</th>
      <th>Input length</th>
      <th>Output length</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>CANEO series10</td><td><a href="/trms/series10/process-data">series10 Process Data</a></td><td>10 bytes</td><td>8 bytes</td></tr>
    <tr><td>CANEO series4x</td><td><a href="/trms/series4x/process-data">series4x Process Data</a></td><td>10 bytes</td><td>14 bytes</td></tr>
    <tr><td>CANEO series5x</td><td><a href="/trms/series5x/io-link-process-data">series5x IO-Link Process Data</a></td><td>8 bytes</td><td>16 bytes</td></tr>
    <tr><td>CALIS</td><td><a href="/trms/calis/process-data">CALIS Process Data</a></td><td>8 bytes</td><td>none</td></tr>
    <tr><td>ORCA</td><td><a href="/trms/orca/process-data">ORCA Process Data</a></td><td>16 bytes</td><td>8 bytes</td></tr>
  </tbody>
</table>

### 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:

<table>
  <thead>
    <tr>
      <th>LED Control Mode</th>
      <th>Source file</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>Scene controlled by IO-Link Process Data</code></td><td><code>…_SceneControl.udt</code></td></tr>
    <tr><td><code>Advanced control by IO-Link Process Data</code></td><td><code>…_AdvancedControl.udt</code></td></tr>
  </tbody>
</table>

In the other modes, the device ignores the output process data. For details on each mode, see [series10 LED Control](/trms/series10/led-control), [series4x LED Control](/trms/series4x/led-control), and [ORCA LED](/trms/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.

---

## 1. Configure the IO-Link port

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:

<table>
  <thead>
    <tr>
      <th>Area</th>
      <th>Start address</th>
      <th>Range</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>Process Data Input</td><td><code>%IB68</code></td><td><code>%IB68</code> … <code>%IB75</code></td></tr>
    <tr><td>Process Data Output</td><td><code>%QB64</code></td><td><code>%QB64</code> … <code>%QB79</code></td></tr>
  </tbody>
</table>

---

## 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](/img/s7/Add_new_external_file.png)

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

   ![Context menu on CANEO_series5x.udt with Generate blocks from source](/img/s7/Generate_blocks_from_source.png)

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](/img/s7/PLC_data_types.png)

:::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:

<table>
  <thead>
    <tr>
      <th>Data type</th>
      <th>Byte</th>
      <th>Member</th>
      <th>S7 type</th>
    </tr>
  </thead>
  <tbody>
    <tr><td rowspan="5"><code>PII - CANEO series5x</code></td><td>0–3</td><td><code>Touch Inputs - Reserved</code></td><td><code>DWord</code></td></tr>
    <tr><td>4</td><td><code>Touch Inputs - Zone 4 actuated</code></td><td><code>Byte</code></td></tr>
    <tr><td>5</td><td><code>Touch Inputs - Zone 3 actuated</code></td><td><code>Byte</code></td></tr>
    <tr><td>6</td><td><code>Touch Inputs - Zone 2 actuated</code></td><td><code>Byte</code></td></tr>
    <tr><td>7</td><td><code>Touch Inputs - Zone 1 actuated</code></td><td><code>Byte</code></td></tr>
    <tr><td rowspan="7"><code>PIQ - CANEO series5x</code></td><td>0–5</td><td><code>Display Control - Text to display</code></td><td><code>Array[1..6] of Char</code></td></tr>
    <tr><td>6</td><td><code>Display Control - Text Color</code></td><td><code>Byte</code></td></tr>
    <tr><td>7</td><td><code>Display Control - Text Select</code></td><td><code>Byte</code></td></tr>
    <tr><td>8–11</td><td><code>Display Control - Number to display</code></td><td><code>DInt</code></td></tr>
    <tr><td>12–13</td><td><code>Display Control - Active Scenes (Bitmask)</code></td><td><code>Word</code></td></tr>
    <tr><td>14</td><td><code>Display Control - Reserved</code></td><td><code>Byte</code></td></tr>
    <tr><td>15</td><td><code>Display Control - Scene Selection Mode</code></td><td><code>Byte</code></td></tr>
  </tbody>
</table>

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:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Data type</th>
      <th>Address</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>PI</code></td><td><code>"PII - CANEO series5x"</code></td><td><code>%I68.0</code></td></tr>
    <tr><td><code>PO</code></td><td><code>"PIQ - CANEO series5x"</code></td><td><code>%Q64.0</code></td></tr>
  </tbody>
</table>

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](/img/s7/Tags.png)

:::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](/img/s7/WatchTable.png)

### 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:

<table>
  <thead>
    <tr>
      <th>Member</th>
      <th>Address</th>
      <th>Force value</th>
      <th>Meaning</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>Display Control - Text Color</code></td><td><code>%QB70:P</code></td><td><code>16#07</code></td><td>White</td></tr>
    <tr><td><code>Display Control - Text Select</code></td><td><code>%QB71:P</code></td><td><code>16#02</code></td><td>Text given</td></tr>
    <tr><td><code>Display Control - Text to display[1]</code> … <code>[5]</code></td><td><code>%QB64:P</code> … <code>%QB68:P</code></td><td><code>'H'</code> <code>'A'</code> <code>'L'</code> <code>'L'</code> <code>'O'</code></td><td>Text to show</td></tr>
  </tbody>
</table>

![Force table writing Text Color, Text Select, and the text HALLO to the PO output tags](/img/s7/ForceTable.png)

For the meaning of each value, see the device's process data page listed under [Prerequisites](#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

- **CANEO series10 Process Data:** [/trms/series10/process-data](/trms/series10/process-data)
- **CANEO series4x Process Data:** [/trms/series4x/process-data](/trms/series4x/process-data)
- **CANEO series5x IO-Link Process Data:** [/trms/series5x/io-link-process-data](/trms/series5x/io-link-process-data)
- **CALIS Process Data:** [/trms/calis/process-data](/trms/calis/process-data)
- **ORCA Process Data:** [/trms/orca/process-data](/trms/orca/process-data)

---

## 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](#3-import-the-plc-data-types).

<table>
  <thead>
    <tr>
      <th>Device</th>
      <th>LED Control Mode</th>
      <th>Source file</th>
      <th>PLC data types</th>
    </tr>
  </thead>
  <tbody>
    <tr><td rowspan="2">CANEO series10</td><td><code>Scene controlled by IO-Link Process Data</code></td><td><a href="/downloads/udt/CANEO_series10_SceneControl.udt" download>CANEO_series10_SceneControl.udt</a></td><td><code>PII - CANEO series10 Standard</code><br/><code>PIQ - CANEO series10 Standard Scene Control</code></td></tr>
    <tr><td><code>Advanced control by IO-Link Process Data</code></td><td><a href="/downloads/udt/CANEO_series10_AdvancedControl.udt" download>CANEO_series10_AdvancedControl.udt</a></td><td><code>PII - CANEO series10 Standard</code><br/><code>PIQ - CANEO series10 Standard Advanced Control</code></td></tr>
    <tr><td>CANEO series10 Signal</td><td><code>Advanced control by IO-Link Process Data</code></td><td><a href="/downloads/udt/CANEO_series10-Signal_AdvancedControl.udt" download>CANEO_series10-Signal_AdvancedControl.udt</a></td><td><code>PII - CANEO series10 Standard Signal</code><br/><code>PIQ - CANEO series10 Standard Signal Advanced Control</code></td></tr>
    <tr><td rowspan="2">CANEO series4x</td><td><code>Scene controlled by IO-Link Process Data</code></td><td><a href="/downloads/udt/CANEO_series4x_SceneControl.udt" download>CANEO_series4x_SceneControl.udt</a></td><td><code>PII - CANEO series40 Puck Display M12 connector</code><br/><code>PIQ - CANEO series40 Puck Display M12 connector Scene Control</code></td></tr>
    <tr><td><code>Advanced control by IO-Link Process Data</code></td><td><a href="/downloads/udt/CANEO_series4x_AdvancedControl.udt" download>CANEO_series4x_AdvancedControl.udt</a></td><td><code>PII - CANEO series40 Puck Display M12 connector</code><br/><code>PIQ - CANEO series40 Puck Display M12 connector Advanced Control</code></td></tr>
    <tr><td>CANEO series5x</td><td>—</td><td><a href="/downloads/udt/CANEO_series5x.udt" download>CANEO_series5x.udt</a></td><td><code>PII - CANEO series5x</code><br/><code>PIQ - CANEO series5x</code></td></tr>
    <tr><td>CALIS</td><td>—</td><td><a href="/downloads/udt/CALIS.udt" download>CALIS.udt</a></td><td><code>PII - CALIS Level Sensor</code></td></tr>
    <tr><td rowspan="2">ORCA</td><td><code>Scene controlled by IO-Link Process Data</code></td><td><a href="/downloads/udt/ORCA_SceneControl.udt" download>ORCA_SceneControl.udt</a></td><td><code>PII - ORCA</code><br/><code>PIQ - ORCA Scene Control</code></td></tr>
    <tr><td><code>Advanced control by IO-Link Process Data</code></td><td><a href="/downloads/udt/ORCA_AdvancedControl.udt" download>ORCA_AdvancedControl.udt</a></td><td><code>PII - ORCA</code><br/><code>PIQ - ORCA Advanced Control</code></td></tr>
  </tbody>
</table>
