Sample 3

This example corresponds to a small application. The application includes detection, reading and writing of a transponder in an automatic sequence.

The example was created with a Pepperl+Fuchs RFID reader. Both the 2-channel and the 4-channel model can be used.

In the example, the device is connected directly to the Com port. If a Pepperl+Fuchs RFID reader is used that is connected to a serial Beckhoff terminal instead of to the Com port, the serial background communication in the PLC code must be changed and reconfigured in the TwinCAT System Manager. (See RFID reader interfacing)

Sequence of the implemented application:

Sample 3 1:

Two read/write heads are connected to the RFID device. Both detect transponders arriving in the field fully automatically. After detection, a memory block is read out from the transponder's data memory. The 4-byte value in it is incremented by one by the first read head or decremented by one by the second read head. The new value is immediately written back to the transponder. This process of detection, reading and writing takes about half a second in total. There must be an interval of at least three seconds between two such processes on the same read head in order to avoid unwanted multiple execution. (This can also be solved by checking the tag serial number.)

The program essentially contains a state machine with 6 states:

0: Initialization - running GetReaderVersion, GetConfig etc.
1: Tag detection on read head 1 - buffered GetInventory
2: Tag detection on read head 2 - buffered GetInventory
3: Waiting for tag detection
4: Action at read head 1 - ReadBlock and WriteBlock
5: Action at read head 2 - ReadBlock and WriteBlock

The data carrier type (iUSEDDCTYPE) should be adapted to the transponder types used.

The example project contains the call of the RFID function block with different commands.

For further information on the RFID reader communication process, refer to the section Function block FB_RFIDReader > Handling instructions.

Download: RFID_InfoSys_Sample03.zip

Requirements

Development Environment

Target Platform

PLC Libraries to include

TC3.1.4013

PC or CX (x86, x64)

Tc2_RFID