Filtering inputs from the layout


Why do we need filtering

Input lines are typically noisy signals - they do not transition from on-to-off or off-to-on cleanly. Most inputs will oscillate for some time whenever they change state (such as occurs with contact bounce with most switches). Some inputs will glitch to the opposite state even when they are not changing. To handle this signal noise tcc filters all inputs. An input is only recognised when it has been stable in its state for a definable abount of time. This window allows you to define these filtering times.

Categorising inputs

Input lines can be handled in upto four categories. Each input's category is identified in the .tcl script by an optional suffix character to the input name. A plain name is one category, and the other three use '#' (hash), '*' (asterisk) and '@' (business at). To declare one of each you might write (in the .tcl file):

SENSORS:
    input1, input2#, input3*, input4@

Filtering period

Each category of input is assigned a filtering time or period, in milliseconds. Once an input of that category has been stable for the specified time then the input is propagated to the .tcl script. While an input is unstable the script only sees its previous state.

Note that inputs are only sampled a few times per second (typically 10) and so times less than 100ms are not meaningful. For example if you specify a filtering time of 1ms, it will still take at least 100ms before the script can act on the input.

Applying changes

Changes only take effect when the apply button is pressed. Apply may be pressed while the script is running and the changes will take effect immediately.

Filtering QTU inputs

Inputs to QTU modules are filtered by the QTU itself. The QTU samples inputs every millisecond and filtering values from 1ms to 255ms are allowed, and handled accurately. The equations in the QTU will get the input after this filtering time. The signal forwarded to tcc will be filtered again by tcc (in case of noise on the transmission medium) with a minimum filter so the signal must be sampled by tcc twice before the .tcl script gets the input.

Changes to the QTU filtering levels will only take effect after the affected QTU(s) are downloaded.

Last updated 07 Feb 2004

© Howard Amos 2003-2004