FB_ShortLongClick
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 push of the button.
bLongClick: Indicates a long push of the button.
Example
In the following example, two push buttons are used to control two different lamps. A switch is assigned to each lamp. If a button is pressed for longer than 500 ms, both lamps are switched off.
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4020.32 | Tc2_BABasic from v3.1.0.0 |