1

I use plc4j to read/write string from s7-1500. I can read string with statement:

builder.addItem("value-4.0", "%DB1.DB4.0:STRING");

which get string of "hello world" in it. But I can not write string into the address with statement:

builder.addItem("value-4.0", "%DB1.DB4.0:STRING", "hello,world.");

And the exception is as follow:

org.apache.commons.lang3.NotImplementedException: Serializing STRING not implemented at org.apache.plc4x.java.s7.utils.StaticHelper.serializeS7String(StaticHelper.java:196) at org.apache.plc4x.java.s7.readwrite.io.DataItemIO.staticSerialize(DataItemIO.java:418) at org.apache.plc4x.java.s7.readwrite.io.DataItemIO.staticSerialize(DataItemIO.java:275) at org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.serializePlcValue(S7ProtocolLogic.java:498) at org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.write(S7ProtocolLogic.java:245) at org.apache.plc4x.java.spi.optimizer.BaseOptimizer.lambda$optimizedWrite$2(BaseOptimizer.java:114) at org.apache.plc4x.java.spi.optimizer.BaseOptimizer.send(BaseOptimizer.java:151) at org.apache.plc4x.java.spi.optimizer.BaseOptimizer.optimizedWrite(BaseOptimizer.java:114) at org.apache.plc4x.java.spi.connection.AbstractPlcConnection.write(AbstractPlcConnection.java:159) at org.apache.plc4x.java.spi.messages.DefaultPlcWriteRequest.execute(DefaultPlcWriteRequest.java:65)

Anybody, please give some idea. Thanks a lot.

angelo
  • 11
  • 1
  • The dependencies in pom.xml is as follow: ` org.apache.plc4x plc4j-api 0.8.0 org.apache.plc4x plc4j-driver-s7 0.8.0 runtime ` – angelo Jun 10 '21 at 03:13
  • Writing string into PLC with PLC4J is unsupported for now. You can try Snap7 with the URL http://snap7.sourceforge.net/ . – angelo Jun 25 '21 at 03:03
  • I just wanted to check this, and yes, it's true. But it shouldn't be true ... it seems I missed those 2 todo's in the code. So I'll probably implement this functionality asap and it will then be part of the 0.9.0 release. – Christofer Dutz Jul 11 '21 at 12:29
  • (update) As I won't be able to implement this within a few minutes (gotta reverse engineer the correct format) I won't be able to provide a solution this weekend ... but I will make sure it's in the upcoming 0.9.0 As far as I know Moka7 (the java version of Snap7) doesn't support strings and it's GPL licensed, so depending on your use-case, I would be careful with it. – Christofer Dutz Jul 11 '21 at 13:07

0 Answers0