Beckhoff Modbus

Hello,

I have a problem, to connect a Beckhoff TwinCat2 Windows runtime with Openhab by using Modbus TCP.

Has onyone done it and can halp me?

What I have done is, to Install the ModbusTCP Server and add some Global Variables in Beckhoff:
xMB0 AT %MX0.0 : BOOL;

At the modbus.cfg I have addet the following lines:
poll=300
tcp.slave1.connection=192.168.2.101:502:60:0:0:3:100
tcp.slave1.id=1
tcp.slave1.start=0
tcp.slave1.length=1
tcp.slave1.type=coil

And I have the following items Configuration:
Switch TestitemSPS1 “Test1” (gModbus) {modbus=“slave1:0”}

With this configuration nothing will happen. Have I done anything wrong?

I hope, someone can help me.

What is the type of your beckhoff? I would be surprised that your start address should be 0, mine starts at 32768 for coils:

tcp.slave1.connection=192.168.0.112
tcp.slave1.start=32768
tcp.slave1.length=45
tcp.slave1.type=coil

I have tested it with start adress 32768 but the same problem. Nothing happen.

Where did I get the start adress from?

I have found the Information with the 32768 start adress at Beckhoff Infosys.

Now I have installed Openhab at the same System, where my Beckhoff is running and the Modbus Connection is ok so that I can read and write coils.

But at my Raspberry Pi with Openhabian and the same Openhab Configuration (only the IP-Adress is different) the Connection doesn’t work.

Not sure I completely understand your setup. Did you install openhab on your beckhoff device? What type of Bechkoff do you have?

How can the IP be different that you are referencing? that should be the same for you beckhoff device in your network

can you provide your complete config (items, sitemap, modbus.cfg, variable definition in beckhoff).