# XPulseR

## `XPulseR` (FB)

FUNCTION\_BLOCK XPulseR

### Short description

> Generation of a single pulse with adjustable duration and reset capability.

### Representation

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

### Interfaces

#### Inputs

| Name     | Data type | Value range | Initial value | Function                          |
| -------- | --------- | ----------- | ------------- | --------------------------------- |
| *xIN*    | BOOL      |             |               | Binary input (FALSE > TRUE)       |
| *tPT*    | TIME      |             | T#1s          | Duration of the output pulse in s |
| *xReset* | BOOL      |             |               | Binary reset input (FALSE > TRUE) |

#### Outputs

| Name  | Data type | Value range | Initial value | Function                                   |
| ----- | --------- | ----------- | ------------- | ------------------------------------------ |
| *xQ*  | BOOL      |             |               | Pulse output (FALSE = Off, TRUE = On)      |
| *tET* | TIME      | 0 … *tPT*   |               | Current duration of the pulse at *xQ* in s |

#### Setpoints / parameters

| Name      | Data type | Value range | Initial value | Function                         |
| --------- | --------- | ----------- | ------------- | -------------------------------- |
| **xTest** | BOOL      |             | FALSE         | Binary test input (FALSE > TRUE) |

### Function description

#### General

At the pulse output *xQ* is after each rising edge (FALSE > TRUE) at the binary input *xIN* and/or at the setpoint / parameter **xTest** a pulse with a duration *tPT* generated (precondition: *xReset* = FALSE).\
\
Each rising edge (FALSE > TRUE) at the reset input *xReset* resets the pulse output *xQ* immediately (= FALSE).\
\
The edge detection (FALSE > TRUE) on the inputs *xIN* or **xTest** has a higher priority compared to the edge detection on the input *xReset* (FALSE > TRUE).\
This results in the fact that despite simultaneous edge detection a pulse with a duration *tPT* is generated at the output *xQ* .\
The setpoint / parameter **xTest** is cyclically deactivated (= FALSE).

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

### CODESYS

InOut:

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