FB_BA_ShortLongPress

FB_BA_ShortLongPress 1:

The function block FB_BA_ShortLongPress is used to differentiate between short and long button presses. In contrast to the function block FB_BA_ShortLongClick, the bLongPress output remains set as long as the bSwi input is TRUE when the long button press is detected.

When a short button press is detected (the bSwi input is not set for longer than nSwiOvrTi [ms]), the bShortClick output is issued for one PLC cycle.

This function block is therefore suitable for switching and dimming processes.

Syntax

FUNCTION_BLOCK FB_BA_ShortLongPress
VAR_INPUT
  bSwi           : BOOL;
  nSwiOvrTi      : UDINT := 500;
END_VAR
VAR_OUTPUT
  bShortClick    : BOOL;
  bLongPress     : BOOL;
END_VAR

FB_BA_ShortLongPress 2: Inputs

Name

Type

Description

bSwi

BOOL

Input signal.

nSwiOvrTi

UDINT

Time duration in milliseconds after which the input signal is interpreted as a long button press. Preset to 500 ms

FB_BA_ShortLongPress 3: Outputs

Name

Type

Description

bShortClick

BOOL

Signals a short button press for a PLC cycle.

bLongPress

BOOL

Signals a long button press that is held as long as bSwi is pressed.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.62

Tc3_BA2 from v5.5.25.0