# XPulse

## `XPulse` (FB)

FUNCTION\_BLOCK XPulse

### Short description

> Generation of an exclusive pulse with adjustable duration.

### Representation

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

### Interfaces

#### Inputs

| Name  | Data type | Value range | Initial value | Function       |
| ----- | --------- | ----------- | ------------- | -------------- |
| *xIN* | BOOL      |             |               | Input          |
| *tPT* | TIME      |             | T#1s          | Pulse duration |

#### Outputs

| Name  | Data type | Value range | Initial value | Function                       |
| ----- | --------- | ----------- | ------------- | ------------------------------ |
| *xQ*  | BOOL      |             |               | Output                         |
| *tET* | TIME      | 0 … *tPT*   |               | Time difference to pulse start |

#### Set values / parameters

| Name      | Data type | Value range | Initial value | Function                      |
| --------- | --------- | ----------- | ------------- | ----------------------------- |
| **xTest** | BOOL      |             | FALSE         | Simulation of the input *xIN* |

### Function description

#### General

This function block is used to generate a pulse of defined duration (*tPT*) after a rising edge at the input *xIN*.\
The generation of the pulse can also be triggered independently by the simulation input **xTest**  (rising edge).\
The time difference to the pulse start is displayed at the output *tET*  (value range: 0 … *tPT*) .

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

### CODESYS

InOut:

| Scope       | Name    | Type   | Initial    |
| ----------- | ------- | ------ | ---------- |
| Input       | `xIN`   | `BOOL` |            |
| Input       | `tPT`   | `TIME` | TIME#1s0ms |
| Input Const | `xTest` | `BOOL` | FALSE      |
| Output      | `xQ`    | `BOOL` |            |
| Output      | `tET`   | `TIME` |            |
