Logic

EdgeDetect Block

Detects rising, falling, or any change in the input signal. Outputs 1 on detected edge, 0 otherwise.

Open EdgeDetect in BlockWerk →

# EdgeDetect Block

Description

Detects changes in the input signal. Can detect rising edges (input increases), falling edges (input decreases), or any change.

Mathematical Model

\begin{aligned} &\text{rising:} && y[n] = \begin{cases} 1, & u[n] > u[n-1] \\ 0, & \text{otherwise} \end{cases} \\ &\text{falling:} && y[n] = \begin{cases} 1, & u[n] < u[n-1] \\ 0, & \text{otherwise} \end{cases} \\ &\text{either:} && y[n] = \begin{cases} 1, & u[n] \neq u[n-1] \\ 0, & \text{otherwise} \end{cases} \end{aligned}

First sample: y[0] = 0 for all modes.

Parameters

mode

Type: select (Default: "rising")

Detection mode to use. Options: Rising, Falling, Either.

threshold

Type: number (Default: 0.5)

Signal level separating low from high. An edge is a crossing of this level; move it outside the noise band to avoid spurious edges.

initialState

Type: number (Default: 0)

Initial State parameter description placeholder.

Remarks

Examples

See Also