MeasureFrequence (FB)ΒΆ

FUNCTION_BLOCK MeasureFrequence

This function block will measure the average frequency of an input signal over a defined number of periods.

Note

The function block has to be called with a frequency higher than the maximum frequency of the input signal to be able to calculate the correct result.

InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

Reset

xInput

BOOL

Input signal

usiPeriods

USINT (1..10)

1

Number of time periods the frequency shall be averaged in ( \(1 \leq \mbox{number} \leq 10\) )

Output

lrFrequency

LREAL

Avareged frequency (in Hz)

xValid

BOOL

Validity of result
FALSE: If the required number of time periods has not yet been passed or if the distance in time of two raising edges exceeds \(3 \cdot \mbox{lrFrequency}\)