> 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/hvac-library/functionblocks/binary/triggen.md).

# TrigGen

## `TrigGen` (FB)

FUNCTION\_BLOCK TrigGen

### Kurzbeschreibung

> Impulserzeugung mit einstellbarem Zeitintervall.

### Darstellung

<figure><img src="/files/3otqsPNWur0SrnRvQFNP" alt=""><figcaption></figcaption></figure>

### Schnittstellen

#### Eingänge

| Name        | Datentyp | Wertebereich | Initialwert | Funktion                    |
| ----------- | -------- | ------------ | ----------- | --------------------------- |
| *xEn*       | BOOL     |              |             | Freigabeeingang             |
| *wInterval* | WORD     |              |             | Zeitwert für Zeitintervall  |
| *eTimeBase* | eTimeMS  |              |             | Zeitbasis für Zeitintervall |
| *xEnImp*    | BOOL     |              |             | Option Freigabe 1. Impuls   |

#### Ausgänge

| Name       | Datentyp | Wertebereich | Initialwert | Funktion                         |
| ---------- | -------- | ------------ | ----------- | -------------------------------- |
| *xTrig*    | BOOL     |              |             | Impulsausgang                    |
| *tNextImp* | TIME     |              |             | Restzeit bis zum nächsten Impuls |

### Funktionsbeschreibung

#### Allgemeines

Am Impulsausgang *xTrig* werden zyklisch Impulse mit einer Zeitdauer von einem Programmzyklus und einem Zeitintervall von (*wInterval* multipliziert mit *eTimeBase*) erzeugt, falls der Freigabeeingang *xEn* aktiv ist.

> **Beschränkung des maximalen Zeitintervalls**
>
> Das Zeitintervall ist dabei auf maximal 48 Tage beschränkt, um einen internen Werteüberlauf zu vermeiden.
>
> **Beispiel zur Berechnung des Zeitintervalls**
>
> *wIntervall* = 1000, *eTimeBase* = Millisecond, es werden Impulse in einem Zeitintervall von 1000ms erzeugt.

#### Freigabe 1.Impuls *xEnImp*

Bei aktiver Option (*xEnImp* = TRUE) wird der 1. Impuls direkt nach der Freigabe *xEn* erzeugt.\
Bei nicht aktiver Option (*xEnImp* = FALSE) wird der 1. Impuls nach der Freigabe *xEn* nach Ablauf eines Zeitintervalls erzeugt.

<figure><img src="/files/mzurAjSXddfJfSKwMnAZ" alt=""><figcaption></figcaption></figure>

#### Restzeit bis zum nächsten Impuls *tNextImp*

An diesem Ausgang wird die Restzeit bis zum nächsten Impuls dargestellt, falls der Freigabeeingang aktiv (\*xEn = TRUE) ist.\
In allen übrigen Situationen wird die Konstante 0.0 dargestellt.

<figure><img src="/files/DEj9uNp0vKwLeYVei3dC" alt=""><figcaption></figcaption></figure>

### Codesys

InOut:

| Scope  | Name        | Type    |
| ------ | ----------- | ------- |
| Input  | `xEn`       | `BOOL`  |
| Input  | `wInterval` | `WORD`  |
| Input  | `eTimeBase` | eTimeMS |
| Input  | `xEnImp`    | `BOOL`  |
| Output | `xTrig`     | `BOOL`  |
| Output | `tNextImp`  | `TIME`  |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/hvac-library/functionblocks/binary/triggen.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
