> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/time/stopwatchext.md).

# 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

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-4abd5b999e5698e2ef1264956995075c541cba03%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name     | Data type | Value range | Initial value | Function                                    |
| -------- | --------- | ----------- | ------------- | ------------------------------------------- |
| *xUp*    | BOOL      |             |               | Enabling the increase of the measuring time |
| *xDown*  | BOOL      |             |               | Enabling the decrease of the measuring time |
| *xReset* | BOOL      |             |               | Resetting the stopwatch                     |

#### Outputs

| Name         | Data type | Value range | Initial value | Function                                    |
| ------------ | --------- | ----------- | ------------- | ------------------------------------------- |
| *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&#x20;*****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:

| Scope  | Name         | Type   |
| ------ | ------------ | ------ |
| Input  | `xUp`        | `BOOL` |
| Input  | `xDown`      | `BOOL` |
| Input  | `xReset`     | `BOOL` |
| Output | `tMeasured`  | `TIME` |
| Output | `tElapsed`   | `TIME` |
| Output | `xTimeError` | `BOOL` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/time/stopwatchext.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
