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 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
|---|---|---|---|---|---|---|---|
| Reserved | Reserved | Reserved | Decode Completed | Decode Success | Reading | Trigger Ack | Trigger Ready |
Control block (PLC to reader)
| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
|---|---|---|---|---|---|---|---|
| Reserved | Reserved | Reserved | Reserved | Reserved | Result Ack | Trigger | Trigger Enable |
Bits 8 to 15 of both blocks are reserved.
Decode results block
| Word 0 | Reserved |
|---|---|
| Word 1 | Trigger Counter: total number of triggers |
| Word 2 | Result Counter: number of successful decodes |
| Word 3 | Result Code: 1 = decoded, 0 = failed |
| Word 4 | Result Data Length |
| Word 5 to 132 | Result Data, ASCII |
The trigger handshake
- The PLC sets Trigger Enable to 1.
- When the reader can be triggered, it sets Trigger Ready.
- The PLC sets Trigger to 1.
- The reader sets Trigger Ack and Reading and starts decoding.
- When decoding ends, the reader sets Decode Completed, and Decode Success if a code was read.
- On success, the PLC reads the string from the decode results block.
- 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.
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.
to be captured
TIA Portal V17 steps
- Create a new project, add the CPU you use and set its IP address.
- Install the GSDML file: Options > Manage general station description files.
- In the network view, open the hardware catalog at Other field devices > PROFINET IO > Sensors and drag the reader into the network.
- Set the reader's Ethernet address and device name, and assign it to the PLC.
- Add the modules you need (see below).
- Go online with Online access > Update accessible devices, find the reader and open Online & diagnostics to assign the name.
- Import the tag table from the example project.
- Copy all tags into a new watch table.
- Compile and download to the PLC.
- Go online, start the CPU and choose Monitor all.
to be captured with the renamed GSDML
Choose the modules
| M1 Status and Control Block | Inputs: status block. Outputs: control block. |
|---|---|
| M2 Decode Results Properties | The first five words of the decode results block |
| M3 Decode Results, 8 byte | The first 8 bytes of result data, as ASCII. Pick a larger results module for longer codes. |
Test a manual trigger
- In the watch table, set Trigger Enable and then Trigger to 1. The reader decodes.
- Set Trigger to 0 to end this trigger.
- Set Result Ack to 1: status bits 1 to 4, Result Code, Result Data Length and Result Data clear.
- Set Result Ack to 0, then Trigger to 1 for the next read.
Tell us the reader and your TIA Portal version and we will send the matching GSDML and example. Contact integration support