> 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/button/button4.md).

# Button4

## `Button4` (FB)

FUNCTION\_BLOCK Button4

### Short description

> Switching element with four control inputs and four switching outputs.\
> In addition, one overall output is available.

### Representation

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

### Interfaces

#### Inputs

| Name         | Data type | Value range | Initial value | Function                                  |
| ------------ | --------- | ----------- | ------------- | ----------------------------------------- |
| *xButton1*   | BOOL      |             |               | Input control button 1                    |
| *xButton2*   | BOOL      |             |               | Input control button 2                    |
| *xButton3*   | BOOL      |             |               | Input control button 3                    |
| *xButton4*   | BOOL      |             |               | Input control button 4                    |
| *xButtonOff* | BOOL      |             |               | Input central deactivation of all outputs |

#### Outputs

| Name  | Data type | Value range | Initial value | Function           |
| ----- | --------- | ----------- | ------------- | ------------------ |
| *xQ1* | BOOL      |             |               | Switching output 1 |
| *xQ2* | BOOL      |             |               | Switching output 2 |
| *xQ3* | BOOL      |             |               | Switching output 3 |
| *xQ4* | BOOL      |             |               | Switching output 4 |
| *xQ*  | BOOL      |             |               | Overall output     |

#### Setpoints / Parameters

| Name               | Data type | Value range | Initial value | Function                   |
| ------------------ | --------- | ----------- | ------------- | -------------------------- |
| **xButton1Visu**   | BOOL      |             | FALSE         | Function like *xButton1*   |
| **xButton2Visu**   | BOOL      |             | FALSE         | Function like *xButton2*   |
| **xButton3Visu**   | BOOL      |             | FALSE         | Function like *xButton3*   |
| **xButton4Visu**   | BOOL      |             | FALSE         | Function like *xButton4*   |
| **xButtonOffVisu** | BOOL      |             | FALSE         | Function like *xButtonOff* |

### Functional description

#### General

The five inputs for the control buttons and the five visualization buttons are continuously monitored for rising edges (= button pressed).\
The switching outputs and the overall output are determined depending on which input a rising edge was detected on.\
The input *xButton1* has the highest, the input *xButton2* the second-highest priority, etc.\
If no rising edge is detected at any of the four inputs, the states of the outputs do not change.

#### Overall output *xQ*

The overall output is activated (*xQ* = TRUE) if at least one of the four switching outputs is active.\
It is not active (*xQ* = FALSE) if none of the four switching outputs is active.

| *xButton1*       | *xButton2*       | *xButton3*       | *xButton4* | *xQ1* | *xQ2* | *xQ3* | *xQ4* | Note                 |
| ---------------- | ---------------- | ---------------- | ---------- | ----- | ----- | ----- | ----- | -------------------- |
| L/H              | X                | X                | X          | TRUE  | FALSE | FALSE | FALSE | Actuation - Button 1 |
| FALSE, TRUE, H/L | L/H              | X                | X          | FALSE | TRUE  | FALSE | FALSE | Actuation - Button 2 |
| FALSE, TRUE, H/L | FALSE, TRUE, H/L | L/H              | X          | FALSE | FALSE | TRUE  | FALSE | Actuation - Button 3 |
| FALSE, TRUE, H/L | FALSE, TRUE, H/L | FALSE, TRUE, H/L | L/H        | FALSE | FALSE | FALSE | TRUE  | Actuation - Button 4 |

Legend: X … not relevant, L/H … rising edge, H/L … falling edge

#### Central deactivation of all outputs *xButtonOff* or **xButtonOffVisu**

The outputs *xQ1* to *xQ4* are deactivated (= FALSE) if at the input *xButtonOff* or at the setpoint / parameter **xButtonOffVisu** a rising edge is detected.\
(regardless of the current states at the control inputs *xButton1* to *xButton4*).

### CODESYS

InOut:

| Scope       | Name             | Type   | Initial |
| ----------- | ---------------- | ------ | ------- |
| Input       | `xButton1`       | `BOOL` |         |
| Input       | `xButton2`       | `BOOL` |         |
| Input       | `xButton3`       | `BOOL` |         |
| Input       | `xButton4`       | `BOOL` |         |
| Input       | `xButtonOff`     | `BOOL` |         |
| Input Const | `xButtonOffVisu` | `BOOL` | FALSE   |
| Input Const | `xButton4Visu`   | `BOOL` | FALSE   |
| Input Const | `xButton3Visu`   | `BOOL` | FALSE   |
| Input Const | `xButton2Visu`   | `BOOL` | FALSE   |
| Input Const | `xButton1Visu`   | `BOOL` | FALSE   |
| Output      | `xQ1`            | `BOOL` |         |
| Output      | `xQ2`            | `BOOL` |         |
| Output      | `xQ3`            | `BOOL` |         |
| Output      | `xQ4`            | `BOOL` |         |
| Output      | `xQ`             | `BOOL` |         |


---

# 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/button/button4.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.
