.TH DEBOUNCE "9" "2007-01-16" "LinuxCNC Documentation" "HAL Component" .SH NAME debounce \- filter noisy digital inputs .SH SYNOPSIS .B loadrt debounce cfg=\fIsize[,size,...]\fB .P Creates debounce groups with the number of filters specified by (\fIsize\fR). Every filter in the same group has the same sample rate and delay. For example cfg=2,3 creates two filter groups with 2 filters in the first group and 3 filters in the second group. .SH NOTE .P An alternate component named \fBdbounce\fR implements similar functionality using conventional count= and names= parameters. Delay settings are implemented by a delay pin for each instance instead of using filter groups. .SH DESCRIPTION The debounce filter works by incrementing a counter whenever the input is true, and decrementing the counter when it is false. If the counter decrements to zero, the output is set false and the counter ignores further decrements. If the counter increments up to a threshold, the output is set true and the counter ignores further increments. If the counter is between zero and the threshold, the output retains its previous state. The threshold determines the amount of filtering: a threshold of 1 does no filtering at all, and a threshold of N requires a signal to be present for N samples before the output changes state. .SH FUNCTIONS .TP .B debounce.\fIG\fR Sample all the input pins in group G and update the output pins. .SH PINS .TP .B debounce.\fIG\fB.\fIF\fB.in\fR bit in The F'th input pin in group G. .TP .B debounce.\fIG\fB.\fIF\fB.out\fR bit out The F'th output pin in group G. Reflects the last "stable" input seen on the corresponding input pin. .TP .B debounce.\fIG\fB.delay\fR signed rw Sets the amount of filtering for all pins in group G.