I am new to OpenPLC and am currently making my first attempts. Currently I have a problem with establishing the Modbus connection and can't get any further.
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device ESP8266 1 is disconnected. Attempting to reconnect...
Warning: Persistent Storage file not found
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Operation now in progress
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Connection refused
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Connection refused
Server: Client accepted! Creating thread for the new client ID: 9...
Server: waiting for new client...
Server: Thread created for client ID: 9
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Connection refused
Device ESP8266 1 is disconnected. Attempting to reconnect...
Connection failed on MB device ESP8266 1: Connection refused
...
From the D1 board I get the feedback that the Modbus connection has been established:

Here is also the slave setting:

And the Code on the D1 Board:
/*
Modbus-Arduino Example - Master Modbus IP Client (ESP8266/ESP32)
Read Holding Register from Server device
(c)2018 Alexander Emelianov (a.m.emelianov@gmail.com)
https://github.com/emelianov/modbus-esp8266
*/
#ifdef ESP8266
#include <ESP8266WiFi.h>
#else
#include <WiFi.h>
#endif
#include <ModbusIP_ESP8266.h>
const int Testsignal = 800; // Modbus Offset
IPAddress remote(192, 168, 222, 1); // Address of Modbus Slave device
ModbusIP mb; //ModbusIP object
void setup() {
Serial.begin(115200);
WiFi.begin("raspberry-wlan", "az-delivery");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
mb.client();
//mb.Coil(Testsignal);
}
void loop() {
if (mb.isConnected(remote)) { // Check if connection to Modbus Slave is established
Serial.println("Modbus verbunden");
} else {
mb.connect(remote); // Try to connect if no connection
Serial.print(".");
}
mb.task(); // Common local Modbus task
//Serial.println(mb.Coil(Testsignal));
//delay(100);
}
I would be happy if someone can help me with my problem.
P.S.: I come from the field of Siemens programming in particular. I learned the basics of text programming during my studies, but I'm not very good at it.
Thanks Steffen