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

# TrigGen

## `TrigGen` (FB)

FUNCTION\_BLOCK TrigGen

### Short description

> Pulse generation with adjustable time interval.

### Representation

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

### Interfaces

#### Inputs

| Name        | Data type | Value range | Initial value | Function                     |
| ----------- | --------- | ----------- | ------------- | ---------------------------- |
| *xEn*       | BOOL      |             |               | Enable input                 |
| *wInterval* | WORD      |             |               | Time value for time interval |
| *eTimeBase* | eTimeMS   |             |               | Time base for time interval  |
| *xEnImp*    | BOOL      |             |               | Enable option for 1st pulse  |

#### Outputs

| Name       | Data type | Value range | Initial value | Function                            |
| ---------- | --------- | ----------- | ------------- | ----------------------------------- |
| *xTrig*    | BOOL      |             |               | Pulse output                        |
| *tNextImp* | TIME      |             |               | Remaining time until the next pulse |

### Functional description

#### General

At the pulse output *xTrig* pulses are generated cyclically with a duration of one program cycle and an interval of (*wInterval* multiplied by *eTimeBase*) are generated if the enable input *xEn* is active.

> **Limitation of the maximum time interval**
>
> The time interval is limited to a maximum of 48 days to avoid an internal value overflow.
>
> **Example for calculating the time interval**
>
> *wIntervall* = 1000, *eTimeBase* = Millisecond, pulses are generated in an interval of 1000 ms.

#### Enable 1st pulse *xEnImp*

With the option active (*xEnImp* = TRUE) the 1st pulse is generated immediately after enable *xEn* generated.\
With the option inactive (*xEnImp* = FALSE) the 1st pulse is generated after enable *xEn* after the elapsed time interval.

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

#### Remaining time until the next pulse *tNextImp*

At this output, the remaining time until the next pulse is displayed if the enable input is active (\*xEn = TRUE).\
In all other situations, the constant 0.0 is displayed.

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-c2fb61201db44dee9dbcf30fa0623414ba7efa27%2FTrigGen_Bild_2.png?alt=media" 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 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/binary/triggen.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.
