Skip to main content

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: CAPTRON-CANEO-series53-Multi-Touch-Display-20260915-IODD1.1.zip. See 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

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:

DirectionMemberPLC data typeAddress
InTouch Inputs - ReservedDWord%ID8
InTouch Inputs - Reserved_1Byte%IB12
InTouch Inputs - Zone 3 actuatedByte%IB13
InTouch Inputs - Zone 2 actuatedByte%IB14
InTouch Inputs - Zone 1 actuatedByte%IB15
OutDisplay Control - Text to displayString (6 bytes)%QB8 … %QB13
OutDisplay Control - Text ColorByte%QB14
OutDisplay Control - Text SelectByte%QB15
OutDisplay Control - Number to displayDInt%QD16
OutDisplay Control - Active Scenes (Bitmask)Word%QW20
OutDisplay Control - ReservedByte%QB22
OutDisplay Control - Scene Selection ModeByte%QB23

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.

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

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.

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.

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

6. Create the PLC tags​

Open the default tag table and add two tags:

NameData typeAddress
PDin"PII - …"%I8.0
PDout"PIQ - …"%Q8.0

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

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

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

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.

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.
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"​

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.

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

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

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

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

    Download to device menu of the CPU

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

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​

SymptomCause and solution
All PDin values stay at 0, C LED of the port is off or flashingNo 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 Load in S7-PCT.
All PDin values stay at 0, C LED is litThe tags point to the wrong addresses. Watch the raw bytes %IB8 … %IB15 in hex format. If a different byte changes, correct the start address of PDin.
PLC data types that contain STRINGS cannot be used in the PLC tag tableChange Text to display in the PIQ - … data type to Array[0..5] of Char (step 6).
… not defined when generating main.sclGenerate series5x_counter.scl first, then main.scl.
unexpected file end when generatingThe source file has LF line endings. Save it with CRLF.
Program is green online but nothing happensA failed generation can leave an empty OB1 behind. Delete the generated blocks and generate the sources again in the correct order.

Reference​


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.

SiemensS7CaneoSeries5x.zip