# MasterUDP

## `MasterUDP` (FB)

FUNCTION\_BLOCK MasterUDP IMPLEMENTS IKnxConnector

#### Überblick

Der MasterUDP Funktionsbaustein dient als KNX-Treiber für die Kommunikation mit einem KNX Net/IP Gateway. Er verarbeitet Telegramme und koordiniert die Kommunikation mit Slave-Funktionsbausteinen.

#### Eingänge

| Eingänge                 | Initialwert                        | Beschreibung                                |
| ------------------------ | ---------------------------------- | ------------------------------------------- |
| `xEnable`                | *TRUE*                             | Ein-/Ausschalten des Funktionsbausteins     |
| `sIPAddressKNXInterface` | *''*                               | IP-Adresse der KNX-Schnittstelle            |
| `uiPortKNXInterface`     | *gc\_LibPara.gc\_uiPort*           | Port-Nummer der KNX-Schnittstelle           |
| `itfNetworkInterface`    | -                                  | Netzwerkschnittstelle für die Kommunikation |
| `uiPortPLC`              | *gc\_LibPara.gc\_uiPortLocal*      | Port-Nummer der SPS                         |
| `xResError`              | *FALSE*                            | Fehler-Reset-Flag                           |
| `tResponseTimeout`       | *gc\_LibPara.gc\_tResponseTimeout* | Timeout-Dauer für Anfragen                  |

#### Ausgänge

* `xConnected` (BOOL): Verbindungsstatus
* `itfKnxConnector` (IKnxConnector): Schnittstelle für Slave-Bausteine
* `udiConnectedSlaves` (UDINT): Anzahl verbundener Module
* `eStatus` (KnxStatus): Aktueller KNX-Verbindungsstatus
* `stDeviceInfo` (DeviceInfo): Geräteinformationen
* `stKnxData` (KnxData): KNX-Datenstruktur
* `bChannel` (BYTE): Kommunikationskanal-Kennung
* `eError` (ErrorKnx): Aktueller Fehlerstatus
* `eLastError` (ErrorKnx): Letzter Fehler

#### Verwendung

1. Konfigurieren Sie die KNX-Schnittstelle mit `sIPAddressKNXInterface` und `uiPortKNXInterface`.
2. Setzen Sie `uiPortPLC` entsprechend Ihrer SPS-Konfiguration.
3. Aktivieren Sie den Baustein mit `xEnable = TRUE`.
4. Überwachen Sie `xConnected` für den Verbindungsstatus.
5. Verwenden Sie `itfKnxConnector` zur Interaktion mit Slave-Bausteinen.
6. Prüfen Sie `eStatus` und `eError` regelmäßig.
7. Nutzen Sie `xResError` zum Zurücksetzen von Fehlerzuständen.

#### Hinweise

* Stellen Sie korrekte Netzwerkeinstellungen (`itfNetworkInterface`) sicher.
* Passen Sie `tResponseTimeout` bei Bedarf an die Netzwerklatenz an.

InOut:

| Scope       | Name                     | Type                               | Initial                          | Comment                         |
| ----------- | ------------------------ | ---------------------------------- | -------------------------------- | ------------------------------- |
| Input       | `xEnable`                | `BOOL`                             | TRUE                             | Ein/Aus                         |
| Input       | `sIPAddressKNXInterface` | `STRING`                           | ‘’                               | IP der Gegenstelle z.B IP/Knx   |
| Input       | `uiPortKNXInterface`     | `UINT`                             | gc\_LibPara.gc\_uiPort           | Port der Gegenstelle z.B KNX GW |
| Input       | `itfNetworkInterface`    | `IIoDrvEthernet.INetworkInterface` |                                  |                                 |
| Input       | `uiPortPLC`              | `UINT`                             | gc\_LibPara.gc\_uiPortLocal      | Port der Steuerung              |
| Input       | `xResError`              | `BOOL`                             | FALSE                            | Error Reset                     |
| Input Const | `tResponseTimeout`       | `TIME`                             | gc\_LibPara.gc\_tResponseTimeout | Timeout zeit für anfrage        |
| Output      | `xConnected`             | `BOOL`                             |                                  |                                 |
| Output      | `itfKnxConnector`        | `IKnxConnector`                    | THIS^                            | IF für Kom. Module FB’s         |
| Output      | `udiConnectedSlaves`     | `UDINT`                            |                                  | Anzahl der Module               |
| Output      | `eStatus`                | `KnxStatus`                        |                                  |                                 |
| Output      | `stDeviceInfo`           | DeviceInfo                         |                                  |                                 |
| Output      | `stKnxData`              | `KnxData`                          |                                  |                                 |
| Output      | `bChannel`               | `BYTE`                             |                                  |                                 |
| Output      | `eError`                 | ErrorKnx                           |                                  |                                 |
| Output      | `eLastError`             | ErrorKnx                           |                                  |                                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/hvac-knx-library/functionblocks/masterudp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
