Modbus Connect

This function block facilitates connection to a Modbus server over TCP. It is designed to create and manage a connection that allows for communication with Modbus devices.

📥 Inputs

This function block does not have any inputs.

📤 Outputs

Modbus Client This output provides the Modbus client instance, allowing for further interactions with Modbus devices.

🕹️ Controls

IP Address A text field where you can enter the IP address of the Modbus server you wish to connect to. Default is set to 192.168.0.1.

Modbus TCP Port A text field for specifying the port number for the Modbus TCP connection. Default is set to 502.

🎨 Features

Dynamic Connection Management Automatically manages and reconnects to the Modbus server if connection parameters change.

Non-blocking Operation Utilizes asynchronous programming for connecting without freezing the user interface.

📝 Usage Instructions

  1. Configure IP Address: Enter the IP address of the target Modbus server in the IP Address text field.

  2. Set TCP Port: Specify the Modbus TCP port in the Modbus TCP Port text field.

  3. Establish Connection: The connection will be established when the node is evaluated. You can then retrieve the Modbus client from the output.

📊 Evaluation

Upon evaluation, this function block tries to connect to the specified Modbus server using the provided IP address and port number. If successful, it returns a reference to the Modbus client for further communication.

💡 Tips and Tricks

Testing Connection

If you're unsure whether your configuration is correct, use a tool like Modbus Tester to verify connectivity before setting up the block.

IP Address Format

Ensure that your IP address is in correctly formatted as a standard IPv4 address (e.g., 192.168.1.100).

Port Configuration

If the standard port 502 does not work, confirm with the device manufacturer's documentation for correct port settings.

🛠️ Troubleshooting

Connection Issues

If you're experiencing issues connecting, double-check your IP address and port settings. Ensure the Modbus server is active and reachable on the network.

No Output on Evaluation

Make sure the Modbus server is running and accessible from your network. If the server isn't reachable, the function block won't be able to establish a client connection.

Last updated