Comments (3)
v1.2.7中string是不可以写count,只有byte支持,下一个版本支持string添加count
github中master是最新版,比v1.2.7新,如果你想使用可以自行拉最新代码,打包
from iot-communication.
感谢,现在又发现了一个新的问题,writeString写入到PLC后,1200PLC无法处理此字符串,PLC定义string[60]。我看了下代码
public void writeString(String address, String data) { if (data.length() > 253) { throw new IllegalArgumentException("data字符串参数过长,超过253"); } byte[] dataBytes = data.getBytes(StandardCharsets.US_ASCII); byte[] tmp = new byte[2 + dataBytes.length]; tmp[0] = (byte) 0xFE; //这里长度是254 tmp[1] = ByteUtil.toByte(dataBytes.length); System.arraycopy(dataBytes, 0, tmp, 2, dataBytes.length); this.writeByte(address, tmp); }
是不是PLC string的长度要定义要在254以上才可以使用?
from iot-communication.
String提供了最大256个字节,前两个字节分别表示字节中最大的字符数和当前的字符数
一般我遇到的都是string类型,它总字节大小是256,对应最大字符数254
如果是string[60],它总字节大小是62,对应最大字符数60
我这个库确实没法支持string[60]这种情况,需要优化下
from iot-communication.
Related Issues (15)
- 不支持V区读写问题咨询
- modbus对大小端怎么处理啊 HOT 2
- MultiAddressWrite能否增加addString(String address, String data) HOT 9
- 再请教一个多线程读写modbus的问题 HOT 2
- S7读写1200时发现读写不一致的问题 HOT 8
- S7-1200 进行OB1的 uploadFile总是提示失败 HOT 1
- 关于s7文档内的最大读写字节 HOT 1
- Exception message in English HOT 4
- Comminication over Modbus Gate HOT 2
- 支持s200 s300 s400吗 HOT 1
- 可以获取PLC内的符号表吗 HOT 2
- DB块里定义的数组如何读写 HOT 4
- S7-200-Smart 获取VD 和 VW块出现的问题 HOT 2
- readString方法读取到中文字符乱码,怎么解决 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot-communication.