FB_SingleDoubleClick
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 single push of the button.
bDoublelick: Indicates a double push of the button.
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.
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4020.32 | Tc2_BABasic from v3.1.0.0 |