Beckhoff analog output configuration

  • Platform information:
    • Hardware: PC
    • OS: Windows 10, OH3.1.0
    • Java Runtime Environment: java need to check, OH3.1.0

I was wondering if you could help with the following:
I have OH 3 running on a windows 10 PC with 3 Beckhoff BC9000/BK9000/BK9100 RIO stations. Everything connected with UTP cables, which all work perfectly.

Currently I only use DI and DO which I linked as follows:

MODBUS TCPSlave → MODBUS Poler → MODBUS data read or write.

The above works perfectly for DI/DO.

But now I want to add analog outputs, but I can’t get them to work.

In my test setup, 2 analog output cards are connected to the BC9000 with an end terminal.

The following configuration have i for the analog output:

MODBUS TCPSlave:

UID: modbus:tcp:TCPSlave_23
label: RIO_Schuur
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 5
  connectMaxTries: 1
  reconnectAfterMillis: 0
  port: XXX
  timeBetweenReconnectMillis: 0
  host: XXX.XXX.XX.XX
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false

MODBUS Poler:

UID: modbus:poller:mbpollsschuur2write
label: PollSchuurWrite2
thingTypeUID: modbus:poller
configuration:
  length: 12
  start: 0
  refresh: 5
  maxTries: 3
  cacheMillis: 50
  type: holding
bridgeUID: modbus:tcp:TCPSlave_23

MODBUS data write:

UID: modbus:data:mbpollsschuur2write:analog_schuur22
label: analog_schuur222
thingTypeUID: modbus:data
configuration:
  readTransform: default
  writeType: holding
  writeTransform: default
  updateUnchangedValuesEveryMillis: 1000
  writeValueType: int16
  writeMultipleEvenWithSingleRegisterOrCoil: false
  writeMaxTries: 3
  writeStart: "2"
bridgeUID: modbus:poller:mbpollsschuur2write

When i try to send a value i got this result:

COMMUNICATION_ERROR
Error (ModbusSlaveErrorResponseExceptionImpl) with write. Request: ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=2, registers=ModbusRegisterArray(0027), maxTries=3, getFunctionCode()=WRITE_SINGLE_REGISTER]. Description: ModbusSlaveErrorResponseException(error=2). Message: Slave responsed with error=2

I can’t find out why… the RIO is configured correctly because if I add a DI or DO I can read it in/out directly. In addition, I can also control an analog output via KS2000 software from Beckhoff.

Could someone help me with the correct settings so that I can control the analog output?

Error code=2 means in specification “illegal data address”. Control over software might go over different channel (i.e. ADS), but you can confirm this with wireshark capture, if ks2000 communicates over same TCP port as you try then its matter of finding compatible modbus binding options triggering same network frame.

Thanks for your reply.

I downloaded wireshark, and I see a lot of data flying over. Also from the ADS connection from KS2000. But it looks like ‘abrakadabra’.

To have something similar I decided to set up an AMS/ADS connection with openhab first.

In the absence of current topics (every topic is from before 2020) I want to ask it in this topic.

I have configured the following items:(all highlited green, no errors)

Beckhoff AMS/ADS Network → Beckhoff ADS Network bridge → Beckhoff ADS device

But what do I use to read in/out data from a Beckhoff ADS device?

(with modbus there is a binding “Modbus Data” which I use.)

I can’t find the right documentation/info.

Speaking of ADS binding, connection state tracking there is not perfect (actually it is failing quite often), thus you might have green status for disconnected device. Its boils down to AMS route setup which binding attempts to do (and emits some entries into logs) and whether IO or PLC device is answering readout requests after that.

Best indication whether it is working or not is adding number channel at Beckhoff ADS device. Any ADS index group/offset you see in wireshark or TwinCat 2 engineering software should work as long as you use valid port number. Syntax of field configuration parameter for AMS/ADS binding is field=0x1000/0x01:UINT16 (or any other numeric type).

From low level diagnostics you can enable debug/trace output for org.apache.plc4x and/or org.connectorio.addons category.