Example Project: Using the Stopwatch to Count Successive Samples over a Threshold by BrettG
SigmaStudio Example Project: Using the Stopwatch to Count Successive Samples over a Threshold
This example shows how to count the number of samples in a signal that exceed a certain threshold. Three ABCD Logic cells (available in the Basic DSP - Logic library) are used to turn the various flags on and off and to compare signal values to a threshold. DC Input Entry cells are used for the constant values used in the logic comparisons. Attached is an example project, a diagram, and the logic analyzer display of the output of the signal flow.
The red input signal in the example is a simple sine tone.
The blue signal shows the count of the stopwatch. It starts counting once the input signal has exceeded the Threshold value.
The green signal is the output of the last logic cell, which outputs a 1 if the stopwatch has exceeded 3.
This means that the output GPIO will go high if the input signal exceeds a peak amplitude of 0.95 for more than 3 samples.