> 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-knx-library/functionblocks/masterudp.md).

# MasterUDP

## `MasterUDP` (FB)

FUNCTION\_BLOCK MasterUDP IMPLEMENTS IKnxConnector

#### Overview

The MasterUDP function block serves as a KNX driver for communication with a KNX Net/IP gateway. It processes telegrams and coordinates communication with slave function blocks.

#### Inputs

| Inputs                   | Initial value                      | Description                         |
| ------------------------ | ---------------------------------- | ----------------------------------- |
| `xEnable`                | *TRUE*                             | Enable/disable the function block   |
| `sIPAddressKNXInterface` | *''*                               | IP address of the KNX interface     |
| `uiPortKNXInterface`     | *gc\_LibPara.gc\_uiPort*           | Port number of the KNX interface    |
| `itfNetworkInterface`    | -                                  | Network interface for communication |
| `uiPortPLC`              | *gc\_LibPara.gc\_uiPortLocal*      | Port number of the PLC              |
| `xResError`              | *FALSE*                            | Error reset flag                    |
| `tResponseTimeout`       | *gc\_LibPara.gc\_tResponseTimeout* | Timeout duration for requests       |

#### Outputs

* `xConnected` (BOOL): Connection status
* `itfKnxConnector` (IKnxConnector): Interface for slave blocks
* `udiConnectedSlaves` (UDINT): Number of connected modules
* `eStatus` (KnxStatus): Current KNX connection status
* `stDeviceInfo` (DeviceInfo): Device information
* `stKnxData` (KnxData): KNX data structure
* `bChannel` (BYTE): Communication channel identifier
* `eError` (ErrorKnx): Current error status
* `eLastError` (ErrorKnx): Last error

#### Usage

1. Configure the KNX interface with `sIPAddressKNXInterface` and `uiPortKNXInterface`.
2. Set `uiPortPLC` according to your PLC configuration.
3. Enable the block with `xEnable = TRUE`.
4. Monitor `xConnected` for the connection status.
5. Use `itfKnxConnector` to interact with slave function blocks.
6. Check `eStatus` and `eError` regularly.
7. Use `xResError` to reset error states.

#### Notes

* Ensure correct network settings (`itfNetworkInterface`) are set.
* Adjust `tResponseTimeout` adjust for network latency if needed.

InOut:

| Scope       | Name                     | Type                               | Initial                          | Comment                      |
| ----------- | ------------------------ | ---------------------------------- | -------------------------------- | ---------------------------- |
| Input       | `xEnable`                | `BOOL`                             | TRUE                             | On/Off                       |
| Input       | `sIPAddressKNXInterface` | `STRING`                           | ‘’                               | IP of the peer e.g. IP/Knx   |
| Input       | `uiPortKNXInterface`     | `UINT`                             | gc\_LibPara.gc\_uiPort           | Port of the peer e.g. KNX GW |
| Input       | `itfNetworkInterface`    | `IIoDrvEthernet.INetworkInterface` |                                  |                              |
| Input       | `uiPortPLC`              | `UINT`                             | gc\_LibPara.gc\_uiPortLocal      | Port of the controller       |
| Input       | `xResError`              | `BOOL`                             | FALSE                            | Error reset                  |
| Input Const | `tResponseTimeout`       | `TIME`                             | gc\_LibPara.gc\_tResponseTimeout | Timeout time for request     |
| Output      | `xConnected`             | `BOOL`                             |                                  |                              |
| Output      | `itfKnxConnector`        | `IKnxConnector`                    | THIS^                            | IF for comm. module FBs      |
| Output      | `udiConnectedSlaves`     | `UDINT`                            |                                  | Number of modules            |
| Output      | `eStatus`                | `KnxStatus`                        |                                  |                              |
| Output      | `stDeviceInfo`           | DeviceInfo                         |                                  |                              |
| Output      | `stKnxData`              | `KnxData`                          |                                  |                              |
| Output      | `bChannel`               | `BYTE`                             |                                  |                              |
| Output      | `eError`                 | ErrorKnx                           |                                  |                              |
| Output      | `eLastError`             | ErrorKnx                           |                                  |                              |


---

# 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-knx-library/functionblocks/masterudp.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.
