StopWatchExt (FB)

FUNCTION_BLOCK StopWatchExt

Short Description

Measurement of time periods with plus-/minus-Input and reset option
Display of the total time (tElapsed) and the total time before the last measurement (tMeasured).

Portrayal

../_images/StopWatchExt_FB.png

Interfaces

Inputs

Name

Datatype

Range

Init-Value

Function

xUp BOOL    

Enable increase in measurement time

xDown BOOL    

Enable decrease in measurement time

xReset BOOL    

Reset stopwatch

Outputs

Name

Datatype

Range

Init-Value

Function

tMeasured TIME

0 Days

0 .. 10 Days

Measured time before the last measurement

tElapsed TIME

0 .. 10 Days

 

Time measured since the last reset

xTimeError BOOL    

Display of a stopwatch error

Functional description

General

This function block is used to measure individual time periods.
The counter is increased if the input xUp is active.
The counter is decreased if the input xDown is active.
The xUp input takes precedence over the xDown input.
The sum of the measured time periods is displayed at output tElapsed.
The sum of the measured time periods before the last measurement is displayed at the output tMeasured.
The sum of the measured time periods may not exceed 14400 minutes (= 10 days).
The input xReset (xReset*= TRUE) resets the outputs *tEleapsed*and *tMeasured to 0 regardless of the other states.
Bei nicht freigegebener Messung ( xUp = FALSE und xDown = FALSE ) werden die Ausgänge tElapsed und tMeasured nicht verändert.

Different reaction to one edge at the reset input xReset

Input xUp = TRUE:
Each edge at the reset input resets the outputs tElapsed and tMeasured to 0. The counter then increases again continuously.

Input xDown = TRUE:
Each edge at the reset input resets the outputs tElapsed and tMeasured to 0. The Counter doesn’t change.
Die Fehleranzeige xTimeError wird aktiviert, solange der Eingang xDown in diesem Zustand TRUE verbleibt.

Error output xTimeError

xTimeError is used to show Errors. (xTimeError = TRUE)

State

xTimeError

No Error

FALSE

Measurement time greater than or equal to 14400 minutes

TRUE
Messzeit kleiner 1ms und Eingang xDown = TRUE TRUE

Visualization




Information

Element

Authors

Date

Version

Note

Function

Adam Bartod 01.2017 1.0

Initial version

Programming

Adam Bartod 01.2017 1.0

Initial version

Test Jochen Reu / 02.2017 1.0

Initial version

Documentation

Jochen Reu 10.2017 1.0

Initial version

Codesys

InOut:
Scope Name Type Comment
Input xUp BOOL

Enable increase in measurement time

xDown BOOL

Enable decrease in measurement time

xReset BOOL

Reset stopwatch

Output tMeasured TIME

Measured time before the last measurement

tElapsed TIME

Time measured since the last reset

xTimeError BOOL

Display of a stopwatch error