dathlin / HslCommunication

A very popular industrial Internet of Things communication plug-in. Using this dll can be very convenient, stable, and fast to obtain data from PLC equipment of multiple brands, and also supports redis, mqtt, websocket, etc., which can let your data on the network Free transmission, reducing enterprise development costs.
http://www.hslcommunication.cn
1.64k stars 629 forks source link

西门子字符串 读到历史值怎么处理 #39

Closed nm-1216 closed 1 year ago

nm-1216 commented 1 year ago

西门子字符串 读到历史值怎么处理

dathlin commented 1 year ago

不太明白,读到历史值是什么意思

nm-1216 commented 1 year ago

image

nm-1216 commented 1 year ago

怎么拿实际值? 有方法么

nm-1216 commented 1 year ago

image

随便写了一个,不知道hsl 里面有没有自带

dathlin commented 1 year ago

在hsl里有自带的,例如你得字符串存储在 DB1.0 里面,那么可以直接调用下面的方法

OperateResult<string> read = plc.ReadString("DB1.0"); if (read.IsSuccess) { string value = read.Content; }

nm-1216 commented 1 year ago

不写长度就是得?

nm-1216 commented 1 year ago

在hsl里有自带的,例如你得字符串存储在 DB1.0 里面,那么可以直接调用下面的方法

OperateResult<string> read = plc.ReadString("DB1.0"); if (read.IsSuccess) { string value = read.Content; }

不行,必须输入长度,西门子PLC,开始两个字符是 总长度与有效长度,得转

nm-1216 commented 1 year ago

image image

image

dathlin commented 1 year ago

最新版不需要输入,内部自动分析字符串长度的,或是传0也可以。

如果你用的特别老的版本,则可能不行