# ModbusMasterTCP

## `ModbusMasterTCP` (FB)

FUNCTION\_BLOCK ModbusMasterTCP IMPLEMENTS IModbusConnector

InOut:

| Scope       | Name                       | Type             | Initial         | Comment                                                                                                                                                                  |
| ----------- | -------------------------- | ---------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Input       | `xEnable`                  | `BOOL`           | TRUE            |                                                                                                                                                                          |
| Input       | `xResetAuto`               | `BOOL`           |                 | <p>Zurücksetzen manueller Übersteuerung der angeschlossenen<br>Slaves.</p>                                                                                               |
| Input       | `sIPAddress`               | `STRING(15)`     | ‘192.168.60.10’ |                                                                                                                                                                          |
| Input Const | `uiPort`                   | `UINT`           | 502             | Netzwerkport für ModbusTCP                                                                                                                                               |
| Input Const | `tConnectTimeout`          | `TIME`           | TIME#5s0ms      | <p>Timeout zeit für den Verbindungsaufbau. Ist die Zeit<br>abgelaufen erfolgt ein wiederholender reconnect nach Ablauf<br>der Zeit <code>tWatchdogDisconnect</code>.</p> |
| Input Const | `tReplyTimeout`            | `TIME`           | TIME#1s0ms      | <p>Reply timeout für Modbus Anfragen, dieser gilt für alle<br>angeschlossenen Slaves.1</p>                                                                               |
| Input Const | `tWatchdogDisconnect`      | `TIME`           | TIME#25s0ms     | <p>Watchdog welcher eine aktive Verbindung überwacht und nach<br>Ablauf der Zeit einen reconnect durchführt.</p>                                                         |
| Output      | `xConnected`               | `BOOL`           |                 | `TRUE` = Verbindung zu Modbus TCP Teilnehmer hergestellt                                                                                                                 |
| Output      | `itfModbusConnector`       | IModbusConnector | THIS^           |                                                                                                                                                                          |
| Output      | `udiConnectedSlaves`       | `UDINT`          |                 | Anzahl der angeschlossenen Modbus Teilnehmer                                                                                                                             |
| Output      | `udiLastModbusRequestTime` | `UDINT`          |                 | Modbus request Transaktionszeit in Millisekunden                                                                                                                         |
| Output      | `udiNumberOfMsgSent`       | `UDINT`          |                 | Anzahl der gesendeten Modbus requests                                                                                                                                    |
| Output      | `udiNumberOfMsgReply`      | `UDINT`          |                 | Anzahl der empfangenen Modbus requests                                                                                                                                   |


---

# 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-modbusio2-lib/funktionsbausteine/modbusmastertcp.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.
