# Button1

## `Button1` (FB)

FUNCTION\_BLOCK Button1

### Short description

> Switching element with timing program and button.

### Representation

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

### Interfaces

#### Inputs

| Name            | Data type | Value range | Initial value | Function               |
| --------------- | --------- | ----------- | ------------- | ---------------------- |
| *xClockchannel* | BOOL      |             |               | Input - timing program |
| *xButton*       | BOOL      |             |               | Input - control button |

#### Outputs

| Name         | Data type | Value range | Initial value | Function                                      |
| ------------ | --------- | ----------- | ------------- | --------------------------------------------- |
| *xQ*         | BOOL      |             |               | Enable output                                 |
| *xQET*       | BOOL      |             |               | Indicator: extended operating time is active  |
| *tET*        | TIME      |             |               | Remaining time - extended operating time      |
| *tTime*      | TIME      |             |               | Scaled display of **udiTime**                 |
| *udiMinVisu* | UDINT     |             |               | Display of **tMinTime** for the visualization |
| *udiMaxVisu* | UDINT     |             |               | Display of **tMaxTime** for the visualization |

#### Setpoints / Parameters

| Name               | Data type | Value range                                 | Initial value | Function                                                              |
| ------------------ | --------- | ------------------------------------------- | ------------- | --------------------------------------------------------------------- |
| **eManModeB**      | eMANBIN   | eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn | eMANBIN.Auto  | Operating mode of manual override for the digital output *xQ*         |
| **xButtonVisu**    | BOOL      |                                             | FALSE         | Function like *xButton*                                               |
| **xEnClockButton** | BOOL      |                                             | FALSE         | Option 'Enable control button during active timing program input'     |
| **xEnToggle**      | BOOL      |                                             | TRUE          | Option 'Lock-toggle operating mode'                                   |
| **udiTime**        | UDINT     |                                             | 120           | Time input (absolute limits: 0..7 days) depending on scaling          |
| **eTimeScale**     | eTime     |                                             | eTime.Minute  | Definition of the scaling of the time input (seconds, minutes, hours) |
| **tMinTime**       | TIME      |                                             | T#0m          | Lower limit for the time input **udiTime**                            |
| **tMaxTime**       | TIME      |                                             | T#120m        | Upper limit for the time input **udiTime**                            |

### Function description

#### General

The function block is fundamentally used to define the operating modes night operation (*xQ* = FALSE) and day operation (*xQ* = TRUE) depending on the states at the inputs timing program (*xClockchannel*) and control button (*xButton* and / or **xButtonVisu**).\
The operating behavior is influenced by a total of two adjustable options.\
In the basic configuration (see option settings below) the basic functions are available.

#### Enable output *xQ*

The enable output *xQ* always indicates the current state of the switching element depending on the inputs and the two options.

#### Indicator - extended operating time *xQET*

The indicator output *xQET* always indicates the active state of the extended operating time.

#### Remaining time - extended operating time *tET*

The indicator output *tET* always indicates the current remaining time of an active extended operating time.\
Immediately after the first download and before the first start of the timer the value T#0s is always displayed.

#### Option **tEnClockButton**

With this option the button is locked or enabled during the active timing program.\
If the setpoint/parameter **tEnClockButton** TRUE, then the outputs can be switched off and on with the buttons (*xButton* and/or **xButtonVisu**) when the input *xClockchannel*is active, the output *xQ* can be switched off and on.

#### Option **tEnToggle**

If the setpoint / parameter **tEnToggle** TRUE, then in night operation the extended operating time can be switched on and off with the buttons (*xButton* and / or **xButtonVisu**). Otherwise only starting the extended operating time is possible.

#### Scaling / display of the time duration **udiTime**

The indicator output *tTime* permanently shows the current value of the setpoint / parameter **udiTime** in scaled form (**eTimeScale**)\
and absolutely limited by **tMinTime** or **tMaxTime** .

#### Display of the lower time limit *udiMinVisu*

The indicator output *udiMinVisu* permanently shows the current value of the setpoint / parameter **tMinTime** in scaled form (**eTimeScale**)\
and absolutely limited by **tMinTime** or **tMaxTime** .

#### Display of the lower time limit *udiMaxVisu*

The indicator output *udiMaxVisu* permanently shows the current value of the setpoint / parameter **tMaxTime** in scaled form (**eTimeScale**)\
and absolutely limited by **tMinTime** or **tMaxTime** on.\
\
CODESYS

InOut:

| Scope       | Name             | Type    | Initial        |
| ----------- | ---------------- | ------- | -------------- |
| Input       | `xClockchannel`  | `BOOL`  |                |
| Input       | `xButton`        | `BOOL`  |                |
| Output      | `xQ`             | `BOOL`  |                |
| Output      | `xQET`           | `BOOL`  |                |
| Output      | `tET`            | `TIME`  |                |
| Output      | `tTime`          | `TIME`  |                |
| Output      | `udiMinVisu`     | `UDINT` |                |
| Output      | `udiMaxVisu`     | `UDINT` |                |
| Input Const | `tMaxTime`       | `TIME`  | TIME#120m0s0ms |
| Input Const | `tMinTime`       | `TIME`  | TIME#0ms       |
| Input Const | `eTimeScale`     | eTime   | eTime.Minute   |
| Input Const | `udiTime`        | `UDINT` | 120            |
| Input Const | `xEnToggle`      | `BOOL`  | TRUE           |
| Input Const | `xEnClockButton` | `BOOL`  | FALSE          |
| Input Const | `xButtonVisu`    | `BOOL`  | FALSE          |
| Input Const | `eManModeB`      | eManBin | eMANBIN.Auto   |
