<!-- Source: https://docs.captron.com/application-notes/CaneoSeries5x-siemens-s7-1200-application-example -->

# CANEO series5x + Siemens S7-1200 — IO-Link Integration Guide

This guide walks through integrating a **CANEO series53 Multi-Touch Display (CD53D-8)** with a **Siemens S7-1200** controller and an **SM 1278 IO-Link master** in **TIA Portal**. The CD53D-8 has three touch zones and a 16 segment display, which makes it a good example for both directions of IO-Link process data: you read the touch zones and write a number, a color, or a text to the display.

By the end, you will have:

- the IO-Link port configured in **S7-PCT**,
- the process data available as PLC tags with named members (no manual byte offsets),
- a small SCL function block that turns the three zones into an up/down counter, shows the counter value on the display, and confirms a reset with the text `OK`.

## Prerequisites

- **TIA Portal** (this example uses V16) with a project for your CPU. This example uses a **CPU 1214C DC/DC/DC**.
- An **SM 1278 4xIO-Link master** in the device configuration. This example uses slot 2, with the I/O address range starting at byte **8** (I 8…39 / Q 8…39).
- **S7-PCT** (Port Configuration Tool; this example uses V3.5 SP1), which is installed together with TIA Portal and started from the device configuration.
- The **CANEO series53 Multi-Touch Display** wired to **port 1** of the SM 1278.
- The **IODD** for the device: <a href="/downloads/iodds/CAPTRON-CANEO-series53-Multi-Touch-Display-20260915-IODD1.1.zip" download>CAPTRON-CANEO-series53-Multi-Touch-Display-20260915-IODD1.1.zip</a>. See [series5x IO-Link Interface](/trms/series5x/io-link-interface) for all variants.

:::info
This example was created with TIA Portal V16 and S7-PCT V3.5 SP1. The screenshots were taken with the English user interface of TIA Portal. To change the user interface language, open **Options → Settings** in TIA Portal.
:::

---

## 1. Open S7-PCT and import the IODD

1. In TIA Portal, open the **device view** of your CPU.
2. In the device overview, right-click the **SM 1278 IO-Link master** and select **Start device tool**. S7-PCT opens.
3. In S7-PCT, select **Options → Import IODD** and choose the unzipped IODD file of the CANEO series53 Multi-Touch Display.

## 2. Assign the device to the port

In the **Catalog** on the right, open **CANEO SENSORbutton** and look for the **CANEO series53 Multi-Touch Display** with article number **CD53D-8**. Drag it onto **port 1** in the **Port Info** table.

The port mode changes to **IO-Link**, and the **Details** section shows the vendor, article number, and IODD file name of the assigned device.

![S7-PCT Ports tab with the CANEO series53 Multi-Touch Display assigned to port 1 of the SM 1278](/img/application-notes/s7-1200/s7-pct-ports-device-assigned.png)

## 3. Check the PLC addresses and export the data types

Open the **Addresses** tab and tick **Show PLC addresses**. S7-PCT now shows the absolute addresses in the PLC instead of offsets relative to the module start.

For the CD53D-8 on port 1, with the module starting at byte 8, the process data are mapped as follows:

<table>
  <thead>
    <tr>
      <th>Direction</th>
      <th>Member</th>
      <th>PLC data type</th>
      <th>Address</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>In</td><td><code>Touch Inputs - Reserved</code></td><td><code>DWord</code></td><td><code>%ID8</code></td></tr>
    <tr><td>In</td><td><code>Touch Inputs - Reserved_1</code></td><td><code>Byte</code></td><td><code>%IB12</code></td></tr>
    <tr><td>In</td><td><code>Touch Inputs - Zone 3 actuated</code></td><td><code>Byte</code></td><td><code>%IB13</code></td></tr>
    <tr><td>In</td><td><code>Touch Inputs - Zone 2 actuated</code></td><td><code>Byte</code></td><td><code>%IB14</code></td></tr>
    <tr><td>In</td><td><code>Touch Inputs - Zone 1 actuated</code></td><td><code>Byte</code></td><td><code>%IB15</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Text to display</code></td><td><code>String</code> (6 bytes)</td><td><code>%QB8</code> … <code>%QB13</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Text Color</code></td><td><code>Byte</code></td><td><code>%QB14</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Text Select</code></td><td><code>Byte</code></td><td><code>%QB15</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Number to display</code></td><td><code>DInt</code></td><td><code>%QD16</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Active Scenes (Bitmask)</code></td><td><code>Word</code></td><td><code>%QW20</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Reserved</code></td><td><code>Byte</code></td><td><code>%QB22</code></td></tr>
    <tr><td>Out</td><td><code>Display Control - Scene Selection Mode</code></td><td><code>Byte</code></td><td><code>%QB23</code></td></tr>
  </tbody>
</table>

The input bytes run in reverse order: zone 1 is the **last** byte of the input data. This follows the IO-Link bit offsets described in [series5x IO-Link Process Data](/trms/series5x/io-link-process-data).

Click **Create PLC data type source file** and save the generated `.udt` file. It contains one data type for the inputs (`PII - …`) and one for the outputs (`PIQ - …`).

![S7-PCT Addresses tab with Show PLC addresses enabled](/img/application-notes/s7-1200/s7-pct-addresses-plc-addresses.png)

:::note
The names in the process data depend on the product variant (one, two, three, or four touch zones). For example, byte 12 appears as `Touch Inputs - Zone 4 actuated` or as `Touch Inputs - Reserved_1`. Always use the names and addresses that S7-PCT shows for your device.
:::

:::tip[No byte swapping needed]
IO-Link and the S7 CPU both use big-endian byte order. The 4-byte **Number to display** therefore maps directly onto a `DInt`, and you can write it like any other variable. You do not need the byte reordering that other controller families require.
:::

## 4. Load the configuration into the IO-Link master

Click **Load** in S7-PCT to transfer the port configuration to the SM 1278.

:::warning
A TIA download of **Software (only changes)** does not transfer the port configuration. If you skip this step, the master does not start IO-Link communication on the port, and the process data stay at 0.
:::

Once the device communicates, the green **C** LED of port 1 on the SM 1278 is lit continuously. If it is off or flashing, check the port number, the wiring, and the 24 V supply of the master.

## 5. Import the data types into TIA Portal

1. In the project tree, open **External source files → Add new external file** and select the `.udt` file from step 3.
2. Right-click the file and select **Generate blocks from source**.
3. Two new entries appear under **PLC data types**: `PII - …` (inputs) and `PIQ - …` (outputs).

![Generate blocks from source on the external UDT file](/img/application-notes/s7-1200/tia-generate-blocks-from-udt.png)

## 6. Create the PLC tags

Open the default tag table and add two tags:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Data type</th>
      <th>Address</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>PDin</code></td><td><code>"PII - …"</code></td><td><code>%I8.0</code></td></tr>
    <tr><td><code>PDout</code></td><td><code>"PIQ - …"</code></td><td><code>%Q8.0</code></td></tr>
  </tbody>
</table>

The start address is the port's **Input Start** and **Output Start** from the S7-PCT **Addresses** tab. TIA Portal then lays out all members of the data type from that address, so you can address every field by name, for example `"PDin"."Touch Inputs - Zone 1 actuated"`.

![Default tag table with the expanded PDin and PDout tags and their addresses](/img/application-notes/s7-1200/tia-plc-tags-pdin-pdout.png)

### Fix the STRING error

The data type file exported by S7-PCT does not use the correct PLC data type for the IO-Link `StringT` field **Display Control - Text to display**. It declares the field as `String`, and TIA Portal does not accept data types that contain a `String` in the tag table. When you assign the `PIQ - …` data type to `PDout`, TIA Portal shows the message *PLC data types that contain STRINGS cannot be used in the PLC tag table*.

![Error message for a data type that contains a STRING](/img/application-notes/s7-1200/tia-plc-tags-string-error.png)

Open the `PIQ - …` data type and change the data type of **Display Control - Text to display** to `Array[0..5] of Char` manually. The array maps the characters of the display byte for byte. Repeat this change each time you generate the blocks from the `.udt` file again.

![PIQ data type with Text to display changed to Array of Char](/img/application-notes/s7-1200/tia-piq-text-to-display-array-of-char.png)

:::tip
Alternatively, correct the `.udt` file before you import it in step 5. Open it in a text editor and change the data type of **Display Control - Text to display** from `String` to `Array[0..5] of Char`. The generated `PIQ - …` data type is then correct right away, and you do not need to change it again after a new import.
:::

## 7. Check the process data in a watch table

Before you write any program code, check the connection:

1. Create a watch table and add the members of `"PDin"` and `"PDout"`.
2. Download the project to the CPU (see step 9), go online, and click **Monitor all**.
3. Touch the zones of the CD53D-8. The matching `Zone … actuated` value changes from `16#00` to `16#01`.

If all values stay at 0, see [Troubleshooting](#troubleshooting).

## 8. Add the SCL program

The program consists of two external sources:

- `series5x_counter.scl`: the function block `"series5x_counter"` and its instance data block.
- `main.scl`: the cyclic organization block `"Main"` (OB1), which calls the function block and connects it to the process data.

### Function block `"series5x_counter"`

The function block turns the three zones into an up/down counter and decides what the display shows:

- **Zone 1** (lower half) resets the counter to 0 and shows `OK`.
- **Zone 2** (upper left) counts down.
- **Zone 3** (upper right) counts up.

```pascal
FUNCTION_BLOCK "series5x_counter"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR_INPUT
      zone1Raw : Byte;                    // "PDin"."Touch Inputs - Zone 1 actuated"
      zone2Raw : Byte;                    // "PDin"."Touch Inputs - Zone 2 actuated"
      zone3Raw : Byte;                    // "PDin"."Touch Inputs - Zone 3 actuated"
   END_VAR

   VAR_OUTPUT
      zone1 : Bool;                       // zone currently actuated
      zone2 : Bool;
      zone3 : Bool;
      upDown : DInt;                      // counter value, -9999 .. 99999
      textSelect : Byte;                  // 1 = Number given, 2 = Text given
      displayText : Array[0..5] of Char;  // ' OK   ' after a reset
   END_VAR

   VAR
      zone1Last : Bool;
      zone2Last : Bool;
      zone3Last : Bool;
      showOk : Bool;                      // TRUE after reset, until the next count
   END_VAR

BEGIN
   // Raw value -> Bool (any value other than 0 counts as actuated)
   #zone1 := #zone1Raw <> 16#00;
   #zone2 := #zone2Raw <> 16#00;
   #zone3 := #zone3Raw <> 16#00;

   // Count on the rising edge only, within the range of Number to display
   IF #zone3 AND NOT #zone3Last THEN
      IF #upDown < 99999 THEN
         #upDown := #upDown + 1;
      END_IF;
      #showOk := FALSE;
   END_IF;
   IF #zone2 AND NOT #zone2Last THEN
      IF #upDown > -9999 THEN
         #upDown := #upDown - 1;
      END_IF;
      #showOk := FALSE;
   END_IF;
   IF #zone1 AND NOT #zone1Last THEN   // reset last, so it wins
      #upDown := 0;
      #showOk := TRUE;
   END_IF;

   #zone1Last := #zone1;
   #zone2Last := #zone2;
   #zone3Last := #zone3;

   // After a reset show ' OK ' as text, otherwise let the display show the number
   #displayText[0] := ' ';
   #displayText[1] := 'O';
   #displayText[2] := 'K';
   #displayText[3] := ' ';
   #displayText[4] := ' ';
   #displayText[5] := ' ';

   IF #showOk THEN
      #textSelect := 16#02;   // Text given
   ELSE
      #textSelect := 16#01;   // Number given
   END_IF;
END_FUNCTION_BLOCK

DATA_BLOCK "series5x_counter_DB"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
"series5x_counter"
BEGIN
END_DATA_BLOCK
```

The touch zones only deliver the current state (0 or 1). The function block stores the state of the previous cycle in `zone1Last` … `zone3Last` and counts only on the rising edge. Otherwise a single touch would count once per PLC cycle.

Normally the display formats the number itself: `textSelect` is **Number given** (1), and OB1 writes `upDown` to **Number to display**. The counter is limited to -9999 … 99999, the value range of **Number to display**.

A reset sets `showOk`. As long as it is set, `textSelect` is **Text given** (2), and the display shows the six characters of `displayText` (`' OK   '`). The next touch on zone 2 or zone 3 clears `showOk`, and the display switches back to the number.

### Organization block `"Main"`

```pascal
ORGANIZATION_BLOCK "Main"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
   "series5x_counter_DB"(zone1Raw := "PDin"."Touch Inputs - Zone 1 actuated",
                         zone2Raw := "PDin"."Touch Inputs - Zone 2 actuated",
                         zone3Raw := "PDin"."Touch Inputs - Zone 3 actuated");

   // Display: Text Color 3 = Blue, Text Select from the function block
   "PDout"."Display Control - Text Color" := 16#03;
   "PDout"."Display Control - Text Select" := "series5x_counter_DB".textSelect;
   "PDout"."Display Control - Number to display" := "series5x_counter_DB".upDown;
   "PDout"."Display Control - Text to display" := "series5x_counter_DB".displayText;
END_ORGANIZATION_BLOCK
```

OB1 calls the function block with the three zones, sets **Text Color** to **Blue** (3), and copies `textSelect`, `upDown`, and `displayText` into the process data. The text needs only a single assignment because both sides have the same data type, `Array[0..5] of Char`, which you set in step 6.

The function block itself has no fixed addresses. For a second display, create another instance data block and connect it to the tags of that port.

For the meaning of all values, see [series5x IO-Link Process Data](/trms/series5x/io-link-process-data).

### Generate the blocks

1. Add both files under **External source files → Add new external file**.
2. Right-click `series5x_counter.scl` and select **Generate blocks from source**.
3. Then do the same for `main.scl`. It must come **last**, because OB1 refers to the instance data block `"series5x_counter_DB"`, which exists only after the first file has been generated.

![Generate blocks from source on an SCL source file](/img/application-notes/s7-1200/tia-generate-blocks-from-scl.png)

Errors appear in the **Info → Compile** tab under *External source files*, together with the line number in the source file.

![Info → Compile tab after generating series5x_counter.scl without errors](/img/application-notes/s7-1200/tia-compile-generate-success.png)

:::note[Rules for external SCL sources]
- Save the files with **CRLF** line endings, including after the last line. With LF only, TIA Portal treats everything after the first `//` as a comment and reports *unexpected file end*.
- Use only ASCII characters, also in comments.
- Do not use reserved words such as `COUNTER` or `TIMER` as variable names. A single invalid name makes TIA Portal discard the whole `VAR` section.
- TIA Portal copies the file into the project. After you change the file on disk, delete the external source in TIA Portal and add it again.
:::

## 9. Compile and download

1. Right-click the CPU and select **Compile → Hardware and software (only changes)**. If the menu entry is greyed out, select **Go offline** first.

   ![Compile menu of the CPU](/img/application-notes/s7-1200/tia-compile-menu.png)

2. Right-click the CPU and select **Download to device → Hardware and software (only changes)**.

   ![Download to device menu of the CPU](/img/application-notes/s7-1200/tia-download-menu.png)

## 10. Test online

Select **Go online**, open the watch table, and click **Monitor all**. Add `"series5x_counter_DB".upDown` and the display outputs to the watch table.

![Watch table in online mode: counter value in series5x_counter_DB and the display outputs in PDout](/img/application-notes/s7-1200/tia-watch-table-online.png)

Touch zone 3 a few times: the counter increases, and the display shows the value. Zone 2 counts down. Zone 1 resets the counter to 0, and the display shows `OK` until you touch zone 2 or zone 3 again.

---

## Troubleshooting

<table>
  <thead>
    <tr>
      <th>Symptom</th>
      <th>Cause and solution</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>All <code>PDin</code> values stay at 0, <b>C</b> LED of the port is off or flashing</td>
      <td>No IO-Link communication. Check that the device is wired to the port configured in S7-PCT, that the master has its 24 V supply, and that the configuration was loaded with <b>Load</b> in S7-PCT.</td>
    </tr>
    <tr>
      <td>All <code>PDin</code> values stay at 0, <b>C</b> LED is lit</td>
      <td>The tags point to the wrong addresses. Watch the raw bytes <code>%IB8</code> … <code>%IB15</code> in hex format. If a different byte changes, correct the start address of <code>PDin</code>.</td>
    </tr>
    <tr>
      <td><i>PLC data types that contain STRINGS cannot be used in the PLC tag table</i></td>
      <td>Change <b>Text to display</b> in the <code>PIQ - …</code> data type to <code>Array[0..5] of Char</code> (step 6).</td>
    </tr>
    <tr>
      <td><i>… not defined</i> when generating <code>main.scl</code></td>
      <td>Generate <code>series5x_counter.scl</code> first, then <code>main.scl</code>.</td>
    </tr>
    <tr>
      <td><i>unexpected file end</i> when generating</td>
      <td>The source file has LF line endings. Save it with CRLF.</td>
    </tr>
    <tr>
      <td>Program is green online but nothing happens</td>
      <td>A failed generation can leave an empty OB1 behind. Delete the generated blocks and generate the sources again in the correct order.</td>
    </tr>
  </tbody>
</table>

---

## Reference

- [series5x IO-Link Process Data](/trms/series5x/io-link-process-data)
- [series5x Touch Zones](/trms/series5x/touch-zones)
- [series5x IO-Link Interface](/trms/series5x/io-link-interface)

---

## Download: example sources

The SCL sources used in this guide: `series5x_counter.scl` (function block and instance data block) and `main.scl` (OB1). Both files use CRLF line endings and can be added as external sources right away.

<a href="/downloads/SiemensS7CaneoSeries5x.zip" target="_blank">SiemensS7CaneoSeries5x.zip</a>
