FB_SingleDoubleClick

FB_SingleDoubleClick 1:

If the input signal is presented twice within the time tSwitchTime, the bDoubleClick output is set for one PLC cycle. Otherwise, the bSingleClick output is set.

VAR_INPUT

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

bSwitch: Input signal.

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

VAR_OUTPUT

bSingleClick   : BOOL;
bDoublelick    : BOOL;

bSingleClick: Indicates a simple button press.

bDoublelick: Indicates a double 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 twice in rapid succession, both lamps are switched off.

FB_SingleDoubleClick 2: