Beckhoff Knowledge Base: Communication with an ekey finger scanner

FB_EKEY_FingerScanner

FB_EKEY_FingerScanner 1:

This function block is used for the operation of, and communication with a finger scanner.

It must be called cyclically and once for each scanner. Please note that the finger scanners are equipped with different functions. Not all functions of this function block are supported by all models.

RFID functionalities:

All function blocks with ekey must be executed in one task.

VAR_INPUT

bEnable                     : BOOL;
sSN                         : STRING(8);
bNewFinger                  : BOOL;
byFingerID                  : BYTE;
byUserID                    : BYTE;
bFingerControlRelay         : BOOL;
eEnrollmentFunction         : E_EKEY_EnrollmentFunction;
bRemoveUser                 : BOOL;
bRemoveAllUsers             : BOOL;
byRemoveUserID              : BYTE;
eLedFunction                : E_EKEY_LEDFunction;
diLedClock                  : DINT;
bRelayOn                    : BOOL;
bResetAll                   : BOOL;
bReadTemplate               : BOOL;
bWriteUser                  : BOOL;
bWriteTemplate              : BOOL;
byReadTempFingerID          : BYTE;
byReadTempUserID            : BYTE;
bySetUserID                 : BYTE;
byWriteTempFingerID         : BYTE;
byWriteTempUserID           : BYTE;
stWriteTemplate             : ST_EKEY_FingerTemplate;
bNewRFID                    : BOOL;
bReadRFID                   : BOOL;
bWriteRFID                  : BOOL;
bSwitchFSensor_ON           : BOOL;
bSwitchFSensor_OFF          : BOOL;
bRFIDControlRelay           : BOOL;
byRFIDUserID                : BYTE;								
arrWriteRFID                : ARRAY[0..7] OF BYTE;

bEnable: the function block is processed if this input is TRUE.

sSN: each finger scanner has a unique ID. The ID can be calculated from the last 8 digits of the serial number. The last 8 digits of the serial number of the scanner must be entered at this input. The calculation is performed automatically each time the function block is started.

bNewFinger: sets the finger scanner to teaching mode in order to teach-in a new finger.

byFingerID: finger ID of the finger to be taught in.

byUserID: user ID of the finger to be taught in.

bFingerControlRelay: gives the finger the authorisation during the teach-in to actuate the internal relay on positive recognition of the finger. TRUE: internal relay is actuated, FALSE: internal relay is not actuated.

eEnrollmentFunction: defines the teach-in function. Normal enrollment: the finger is drawn only once over the line sensor. Triple enrollment: the finger is drawn three times over the line sensor. The advantage of the triple enrollment is that several points of recognition can be secured by the repeated scanning.

bRemoveUser: deletes a user from the internal memory of the finger scanner. The user ID to be deleted is specified at the RemoveUserID input.

bRemoveAllUsers: deletes all users from the internal memory of the finger scanner.

byRemoveUserID: see bRemoveUser input.

eLedFunction: defines the functional mode of the onboard LED on the finger scanner. In the case of a change at the input the applied functional mode is executed for the duration of diLedClock. See Enum E_EKEY_LEDFunction for setting options.

diLedClock: defines the duty cycle of the LED functional mode. Duration is specified in milliseconds (1 = 10 ms; -1 = endless). See eLedFunction input.

bRelayOn: switches the internal relay of the finger scanner, if available.

bResetAll: resets the finger scanner.

bReadTemplate: reads a finger template from the memory of the finger scanner. The User ID and Finger ID of the finger to be read must be specified at the byReadTempUserID and byReadTempFingerID inputs. The template is then output at the stRecTemplate output.

bWriteUser: creates a user in the memory of the finger scanner. The User ID is specified at the bySetUserID input.

bWriteTemplate: transfers a finger template to the memory of the finger scanner. The User ID and Finger ID of the finger to be written must be specified at the byWriteTempUserID and byWriteTempFingerID inputs. The template is specified at the stWriteTemplate input. The user must already have been created before a template can be transferred to the finger scanner. See bWriteUser input.

byReadTempFingerID: see bReadTemplate input.

byReadTempUserID: see bReadTemplate input.

bySetUserID: see bWriteUser input.

byWriteTempFingerID: see bWriteTemplate input.

byWriteTempUserID: see bWriteTemplate input.

stWriteTemplate: see bWriteTemplate input.

bNewRFID: teach RFID, use this command to place the finger scanner in the "learn" mode for RFID, then hold the RFID chip until a signal comes from the scanner ( byRFIDUserID indicates the user for which the RFID is taught).

bReadRFID: reads the RFID template from the finger scanner. The RFID template is displayed at the output arrRecRFID (byRFIDUserID indicates the user for which the RFID template is to be read out).

bWriteRFID: write the RFID template into the finger scanner. The template to be written is specified at the input arrWriteRFID (byRFIDUserID specifies the user for which the RFID template is to be created).

bSwitchFSensor_ON: turns the fingerprint sensor ON.

bSwitchFSensor_OFF: turns the fingerprint sensor OFF.

bRFIDControlRelay: gives the RFID chip the authorisation during the teach-in to actuate the internal relay on positive recognition. TRUE: internal relay is actuated, FALSE: internal relay is not actuated.

byRFIDUserID: used by the "teach-in" function and the RFID template transfer functions.

arrWriteRFID: see bWriteRFID input.

VAR_OUTPUT

bBusy                       : BOOL;
bError                      : BOOL;
udiErrorID                  : UDINT;
bBufferOverload             : BOOL;
eState                      : E_EKEY_Command;
bReceived                   : BOOL;
byRecUserID                 : BYTE;
byRecFingerID               : BYTE;
byRecTempUserID             : BYTE;
byRecTempFingerID           : BYTE;
byRecRFIDUserID             : BYTE;
bBadFinger                  : BOOL;
dwBadFingers                : DWORD;
bGoodFinger                 : BOOL;
dwMaxConfigUser             : DWORD;
dwMaxConfigFinger           : DWORD;
stRecTemplate               : ST_EKEY_FingerTemplate;
arrRecRFID                  : ARRAY[0..7] OF BYTE;

bBusy: the output goes TRUE when a telegram is being transmitted.

bError: this output goes TRUE as soon as an error occurs. This error is described via the udiErrId variable.

udiErrorID: this output outputs an error code in the event of an error. bError goes TRUE at the same time.

bBufferOverload: indicates whether the communication buffer is full.

eState: indicates the state of the finger scanner.

bReceived: is TRUE when a telegram is being received. Changes to FALSE when the telegram has been received.

byRecUserID: indicates the received User ID in case of the positive recognition of a finger.

byRecFingerID: indicates the received Finger ID in case of the positive recognition of a finger.

byRecRFIDUserID: returns the user to the read-out RFID template.

byRecTempUserID: indicates the User ID of a received template.

byRecTempFingerID: indicates the Finger ID of a received template.

bBadFinger: indicates whether the finger on the scanner is invalid (no authorisation; not correctly identified).

dwBadFingers: counter for invalid fingers. See bBadFinger output.

bGoodFinger: indicates whether the finger on the scanner is valid.

dwMaxConfigUser: indicates how many users have been taught into in the finger scanner. This value is taken directly from the finger scanner and is not calculated by the function block. This value may deviate if there is no communication with the finger scanner.

dwMaxConfigFinger: indicates how many fingers have been taught into the finger scanner in total. This value is taken directly from the finger scanner and is not calculated by the function block. This value may deviate if there is no communication with the finger scanner.

stRecTemplate: outputs a received finger template. see bReadTemplate input.

arrRecRFID: see bReadRFID input.

VAR_IN_OUT

stCommandBuffer             : ST_EKEY_CommandBuffer;

stCommandBuffer: the FB_EKEY_Communication function block is connected to the scanner blocks via this structure.