xingshuangs / iot-communication

Now, it is a tool for iot communication, it includes Siemens S7 protocol, Modbus protocol, MITSUBISHI MELSEC (MC) Protocol, RTSP / RTCP / RTP / H264 / MP4(FMP4) protocol, Parse byte array data.
MIT License
173 stars 58 forks source link

S7-1500 read byte exception: object does not exist #23

Closed suna996 closed 2 weeks ago

suna996 commented 1 month ago

你好, 我在连接S7-1500并读取DB数据时, 调用readByteapi发生异常

单元测试代码

public void test3() {
    S7PLC s7PLC = new S7PLC(EPlcType.S1500, "10.120.38.x");
    // print message
    s7PLC.readByte("DB169.1");
    s7PLC.close();
}

异常信息如下

com.github.xingshuangs.iot.net.client.TcpClientBasic - Create and connect S7 server [/10.120.38.x:102] succeed
com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork - PLC[S1500] handshake success, rack[0],slot[1],PDULength[960]

com.github.xingshuangs.iot.exceptions.S7CommException: Return [1] result exception, cause: object does not exist
    at com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork.checkPostedCom(PLCNetwork.java:343)
    at com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork.readFromServer(PLCNetwork.java:219)
    at com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork.lambda$readS7Data$2(PLCNetwork.java:387)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork.readS7Data(PLCNetwork.java:375)
    at com.github.xingshuangs.iot.protocol.s7.service.PLCNetwork.readS7Data(PLCNetwork.java:414)a
    at com.github.xingshuangs.iot.protocol.s7.service.S7PLC.readByte(S7PLC.java:133)
    at com.github.xingshuangs.iot.protocol.s7.service.S7PLC.readByte(S7PLC.java:144)
    at plc.PlcTest.test3(PlcTest.java:45)

请问异常信息中的object does not exist具体是什么, 以及我应该如何正确读写DB数据, 谢谢

suna996 commented 1 month ago

JDK版本: 15 项目版本: 1.5.2

xingshuangs commented 1 month ago

确认地址是否存在