HomePLC integrationPROFINET, Siemens TIA Portal

Connect a PROFINET barcode reader to a Siemens S7-1200

From an empty TIA Portal V17 project to a decoded string in the watch table, in ten steps. Written for ReadCell VS600E; the data blocks are the same on the other smart readers.

The three data blocks

The reader and the PLC exchange three blocks of cyclic data. The PLC writes the control block; the reader writes the status block and the decode results block.

Status block (reader to PLC)

Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
ReservedReservedReservedDecode CompletedDecode SuccessReadingTrigger AckTrigger Ready

Control block (PLC to reader)

Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
ReservedReservedReservedReservedReservedResult AckTriggerTrigger Enable

Bits 8 to 15 of both blocks are reserved.

Decode results block

Word 0Reserved
Word 1Trigger Counter: total number of triggers
Word 2Result Counter: number of successful decodes
Word 3Result Code: 1 = decoded, 0 = failed
Word 4Result Data Length
Word 5 to 132Result Data, ASCII

The trigger handshake

  1. The PLC sets Trigger Enable to 1.
  2. When the reader can be triggered, it sets Trigger Ready.
  3. The PLC sets Trigger to 1.
  4. The reader sets Trigger Ack and Reading and starts decoding.
  5. When decoding ends, the reader sets Decode Completed, and Decode Success if a code was read.
  6. On success, the PLC reads the string from the decode results block.
  7. The PLC sets Result Ack to clear the result and status bits 1 to 4, then resets it. With Trigger still at 1, the next read starts.
Continuous mode

The reader can also decode continuously without a trigger; the PLC then only watches the decode results block.

Set up the reader

Open IDManager, select the network adapter on the same subnet as the reader, and enable PROFINET on the reader.

Screenshot: IDManager, PROFINET settings
to be captured

TIA Portal V17 steps

  1. Create a new project, add the CPU you use and set its IP address.
  2. Install the GSDML file: Options > Manage general station description files.
  3. In the network view, open the hardware catalog at Other field devices > PROFINET IO > Sensors and drag the reader into the network.
  4. Set the reader's Ethernet address and device name, and assign it to the PLC.
  5. Add the modules you need (see below).
  6. Go online with Online access > Update accessible devices, find the reader and open Online & diagnostics to assign the name.
  7. Import the tag table from the example project.
  8. Copy all tags into a new watch table.
  9. Compile and download to the PLC.
  10. Go online, start the CPU and choose Monitor all.
Screenshot: device in the network view
to be captured with the renamed GSDML

Choose the modules

M1 Status and Control BlockInputs: status block. Outputs: control block.
M2 Decode Results PropertiesThe first five words of the decode results block
M3 Decode Results, 8 byteThe first 8 bytes of result data, as ASCII. Pick a larger results module for longer codes.

Test a manual trigger

  1. In the watch table, set Trigger Enable and then Trigger to 1. The reader decodes.
  2. Set Trigger to 0 to end this trigger.
  3. Set Result Ack to 1: status bits 1 to 4, Result Code, Result Data Length and Result Data clear.
  4. Set Result Ack to 0, then Trigger to 1 for the next read.
Need the files for another model?

Tell us the reader and your TIA Portal version and we will send the matching GSDML and example. Contact integration support

Integrating a reader this week?

Full request form · Other protocols

The online form is not live yet. Please message us on WhatsApp, +86 185 7152 9912.
Chat on WhatsApp+86 185 7152 9912