Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Overview

Threshold with hysteresis

Discussion

The hysteresis module implements switching above and below a threshold. The module accepts floating-point inputs and outputs 0 when the signal level is below the threshold and 1 when above. Instead of just a single threshold the module incorporates hysteresis by having separate upper and lower thresholds. The output switches from 0->1 when the input signal rises above the upperThreshold and then stays at 1 until the signal drops below the lowerThreshold. The module is thus above to avoid frequent switching when signal levels are close to the threshold.

...

This version of the module works with fract32 data.

Type Definition

Code Block
typedef struct _ModuleHysteresisFract32
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    fract32 upperThreshold;                       // Upper switching threshold
    fract32 lowerThreshold;                       // Lower switching threshold
    INT32* state;                                 // Current state per chanel
} ModuleHysteresisFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

upperThreshold

fract32

parameter

0

0.1

Unrestricted

lowerThreshold

fract32

parameter

0

-0.1

Unrestricted

state

int*

state

0

[1 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: Input signal

...

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: int

MATLAB Usage

File Name: hysteresis_fract32_module.m

...