Beckhoff Knowledge Base: Communication with an ekey finger scanner

Integration in TwinCAT (CX9020)

This example describes how a simple PLC program for ekey can be written in TwinCAT and how it is linked with the hardware. The aim is to enable users and fingers to be created and evaluated in the finger scanner.

Unpacking the example files Integration in TwinCAT (CX9020) 1:


Setting up the components

The following hardware is required:

Set up the hardware and the ekey components as described in the respective documents.

This example assumes that the serial number of the finger scanner is known.


Creation of the PLC program

Create a new PLC project for PC-based systems (ARM) and add the TcEkey.lib library.

Next, generate the following global variables:

    KL6inData22B     AT%I* : KL6inData22B;
    KL6outData22B    AT%Q* : KL6outData22B;
    stCommandBuffer        : ST_EKEY_CommandBuffer;

KL6inData22B : input variable for the serial terminal.

KL6outData22B : output variable for the serial terminal.

stCommandBuffer: required for communication with ekey.

All blocks with ekey must be executed in one task.

Therefore, create a MAIN program (CFC) in which the FB_EKEY_Communication and FB_EKEY_FingerScanner function blocks are called. Make sure to link the communication block with pComIn, pComOut and stCommandBuffer.

Integration in TwinCAT (CX9020) 2:

The last eight digits of the serial number are entered at the sSN input of the finger scanner and stCommandBuffer is connected to the global variable stCommandBuffer. To create users and fingers, all other local variables are assigned as shown below.

Integration in TwinCAT (CX9020) 3:

Go to the task configuration and give the task a lower interval time. More precise information on this can be found in the description of the FB_EKEY_Communication function block.

Integration in TwinCAT (CX9020) 4:

Load the project to the CX as the boot project and save it.

Configuration in the System Manager

Create a new System Manager project, select the CX as the target system, and search for the associated hardware.

Add the PLC program created above under PLC configuration.

Integration in TwinCAT (CX9020) 5:

Now link the global variables of the PLC program with the Bus Terminal inputs and outputs, create the allocations, and activate the configuration. Then start the device in run mode.
Your CX is now ready for use.

With the appropriate variables, users and fingers can now be created in the finger scanner and fingers drawn over the line sensor can be evaluated.