Beckhoff Knowledge Base: Communication with an ekey finger scanner


FB_EKEY_Communication 1:

This function block is used for background communication with a serial interface.

The cycle time of the PLC task should be no longer than 10 ms. All function blocks with ekey must be executed in one task.


bEnable            : BOOL;
eMode              : ComSerialLineMode_t;
pComIn             : POINTER TO BYTE;
pComOut            : POINTER TO BYTE;
uiSizeComIn        : UINT;

bEnable: communication with the serial interface is started if this input is TRUE.

eMode: clearly defines the serial hardware employed (KL6041 = SERIALLINEMODE_KL6_22B_STANDARD; EL6021 = SERIALLINEMODE_EL6_22B).

pComIn: pointer to the input variables of the process data of the serial terminal.

pComOut: pointer to the output variables of the process data of the serial terminal.

uiSizeComIn: size of the input process image of the serial terminal.


bBusy              : BOOL;
bError             : BOOL;
udiErrorID         : UDINT;

bBusy: this output goes TRUE when a telegram is being transmitted or received.

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.


stCommandBuffer    : ST_EKEY_CommandBuffer;

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