FB_BA_SingleDoubleClick

FB_BA_SingleDoubleClick 1:

The function block FB_BA_SingleDoubleClick is used to distinguish between a single and double button press.

If the input signal bSwi is switched to TRUE twice within the time nSwiOvrTi [ms], the output bDoubleClick is set for one PLC cycle. Otherwise, the bSingleClick output is set for one PLC cycle.

Syntax

FUNCTION_BLOCK FB_BA_ShortLongClick
VAR_INPUT
  bSwi            : BOOL;
  nSwiOvrTi       : UDINT := 500;
END_VAR
VAR_OUTPUT
  bSingleClick    : BOOL;
  bDoubleClick    : BOOL;
END_VAR

FB_BA_SingleDoubleClick 2: Inputs

Name

Type

Description

bSwi

BOOL

Input signal.

nSwiOvrTi

UDINT

Time duration in milliseconds within which two consecutive edges at the input bSwi are interpreted as a double button press. Preset to 500 ms

FB_BA_SingleDoubleClick 3: Outputs

Name

Type

Description

bSingleClick

BOOL

Signals a single button press.

bDoubleClick

BOOL

Signals a double button press.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.62

Tc3_BA2 from v5.5.25.0