Digital filter

BD15_DIGITAL_FILTER

PROGRAM BD15_TEST
VAR 
  IN1, OUT1: BOOL;
    FB: LIB.CORE.V1_0.BD15_DIGITAL_FILTER;
END_VAR
   FB(IN:=IN1);
    OUT1:=FB.OUT;
END_PROGRAM

LIB\CORE

V1.0

The block copies the input IN to the output OUT with a functionality that the OUT value changes not more frequently than every T seconds. This means that the block filters fast input changes, see figure below. The block is used to filter, or debounce, the input signal.

InputTypeDescription Default value
IN BOOLInput value False
T TIMEThe block does not change the output OUT faster than once every T secs5s
OutputTypeDescription
OUT BOOLFiltered output signal
TRES TIMETimeout to next possible change of output (TRES = 0 - the block is ready, TRES > 0 - the block is waiting).


The block is used to prevent a digital signal from bouncing. The pulse generator is simulating the bounced signal, at the BD15 block output there is filtered (debounced) signal.

  • © Energocentrum Plus, s.r.o. 2017 - 2024