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
TRUE: function block is active and measures the frequency of the input signalFALSE: function block resets its output and is idlexInput
BOOL
Input signal
usiPeriods
USINT (1..10)
1
Number of time periods the frequency shall be averaged in ( \(1 \leq \mbox{number} \leq 10\) ). If this value is changed during operation, a restart of the measuring is executed
Output
lrFrequency
LREAL
Avareged frequency (in Hz)
xValid
BOOL
Validity of resultFALSE
: 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}\)