# Siemens S7 Connect

This function block sets up connection parameters for a Siemens S7 PLC so other communication blocks can access the PLC using those settings. Use it to provide a reusable `S7 Client` output that can be connected to read and write blocks.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

This function block does not have any inputs.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`S7 Client` Generic client handle containing the connection information for the configured PLC.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`IP Address` Enter the PLC IP address (default shown in the control).

`Rack` Enter the PLC rack number (common default: 0).

`Slot` Enter the PLC slot number (common default: 1).

`TCP Port` Enter the PLC TCP port (default: 102). Use this if your PLC uses a non-standard port.

Each control is a simple text input you can edit directly to match your PLC configuration.

## 🎯 Features <a href="#features" id="features"></a>

* Simple UI for entering standard Siemens S7 connection parameters without coding.
* Produces a connection handle that other blocks can use to communicate with the PLC.
* Keeps configuration visible and editable in the visual scenario.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Fill the connection controls: set `IP Address`, `Rack`, `Slot`, and `TCP Port` to match your PLC.
2. Connect the block's `S7 Client` output to communication blocks that perform operations on the PLC (for example, read or write blocks).
3. Run the scenario. The connection information will be available to downstream blocks so they can establish communication with the PLC.

## ⚙️ Running Mechanism <a href="#evaluation" id="evaluation"></a>

When evaluated during a run, this function block provides the configured connection handle through its `S7 Client` output. Other communication blocks can use that handle to open a session with the PLC and perform read/write operations.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Use this block together with `Siemens S7 Read` and `Siemens S7 Write` to perform data exchange with the PLC.
* If you need to share PLC data across multiple parts of your scenario, pair the communication blocks with `Data Write Global` and `Data Read Global` so values are accessible where needed.
* For testing connectivity, combine with `Debug Input` or a simple logging block to verify that reads/writes are returning expected values.
* If you plan to integrate with other industrial systems, consider using this block alongside `OPC UA Client` or `REST API - Post` blocks to bridge PLC data into other services or dashboards.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* Connection fails: verify the `IP Address` is correct and reachable from the machine running the scenario.
* Port blocked: ensure TCP port 102 (or your configured port) is not blocked by a firewall.
* Wrong rack/slot: confirm the PLC's rack and slot numbers from the device documentation or manufacturer tools.
* Network issues: check physical network connections and that no other application is interfering with access to the PLC.


---

# 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://docs.augelab.com/function-blocks/input-output/communication/siemens-s7-connect.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.
