StopWatchExt
StopWatchExt (FB)
FUNCTION_BLOCK StopWatchExt
Short description
Measurement of time intervals with plus/minus input and reset option. Display of the total time (tElapsed) and the total time before the last measurement (tMeasured).
Representation

Interfaces
Inputs
xUp
BOOL
Enabling the increase of the measuring time
xDown
BOOL
Enabling the decrease of the measuring time
xReset
BOOL
Resetting the stopwatch
Outputs
tMeasured
TIME
0 days
0 … 10 days
Measured time before the last measurement
tElapsed
TIME
0 … 10 days
Measured time duration since the last reset
xTimeError
BOOL
Display of a stopwatch error
Functional description
General
This function block is used to measure individual time intervals. The counter value is increased if the input xUp is active. The counter value is decreased if the input xDown is active. The input xUp has priority over the input xDown. The sum of the measured time intervals is displayed at output tElapsed . The sum of the measured time intervals before the last measurement is displayed at output tMeasured . The sum of the measured time intervals may be a maximum of 14400 minutes (= 10 days) and a minimum of 0 minutes. Each rising edge at the reset input (xReset = FALSE / TRUE) resets the outputs tElapsed and tMeasured to FALSE. If measurement is not enabled (xUp = FALSE and xDown = FALSE) the outputs tElapsed and tMeasured are not changed.
Different reaction to an edge at the reset input xReset
Input xUp = TRUE: Each edge at the reset input resets the outputs tElapsed and tMeasured to 0. Then the counter value immediately increases again continuously. Input xDown = TRUE: Each edge at the reset input resets the outputs tElapsed and tMeasured to 0. The counter value does not change. The error display xTimeError is activated as long as the input xDown remains TRUE in this state.
Error display xTimeError
It is used to display function errors (xTimeError = TRUE).
State
xTimeError
no malfunction
FALSE
measuring time greater / equal 14400 minutes
TRUE
measuring time less than 1 ms and input xDown = TRUE
TRUE
CODESYS
InOut:
Input
xUp
BOOL
Input
xDown
BOOL
Input
xReset
BOOL
Output
tMeasured
TIME
Output
tElapsed
TIME
Output
xTimeError
BOOL
Last updated

