FB_ShortLongClick

FB_ShortLongClick 1:

If the bSwitch input is longer than the tSwitchTime, the bLongClick output is set for one PLC cycle. Otherwise, the bShortClick output is set.

VAR_INPUT

bSwitch        : BOOL;
tSwitchTime    : TIME := t#50ms;

bSwitch: Input signal.

tSwitchTime: Duration above which the input signal is to be interpreted as a long button press.

VAR_OUTPUT

bShortClick    : BOOL;
bLongClick     : BOOL;

bShortClick: Indicates a short button press.

bLongClick: Indicates a long button press.

Example

In the following example, two switches are used to control two different lamps. A switch is assigned to each lamp. If a switch is pressed for longer than 500 ms, both lamps are switched off.

FB_ShortLongClick 2: